5#include "flutter/lib/ui/painting/single_frame_codec.h"
7#include "flutter/lib/ui/ui_dart_state.h"
14 uint32_t target_width,
15 uint32_t target_height)
16 : descriptor_(descriptor),
17 target_width_(target_width),
18 target_height_(target_height) {}
35 if (status_ == Status::kComplete) {
36 if (!cached_image_->image()) {
47 pending_callbacks_.emplace_back(dart_state, callback_handle);
49 if (status_ == Status::kInProgress) {
55 auto decoder = dart_state->GetImageDecoder();
59 "Failed to access the internal image decoder "
60 "registry on this isolate. Please file a bug on "
61 "https://github.com/flutter/flutter/issues.");
72 descriptor_, target_width_, target_height_,
73 [raw_codec_ref](
auto image,
auto decode_error) {
74 std::unique_ptr<fml::RefPtr<SingleFrameCodec>> codec_ref(raw_codec_ref);
77 auto state = codec->pending_callbacks_.front().dart_state().lock();
89 auto canvas_image = fml::MakeRefCounted<CanvasImage>();
90 canvas_image->set_image(std::move(
image));
92 codec->cached_image_ = std::move(canvas_image);
97 codec->status_ = Status::kComplete;
101 codec->pending_callbacks_) {
103 {tonic::ToDart(codec->cached_image_),
104 tonic::ToDart(0), tonic::ToDart(decode_error)});
106 codec->pending_callbacks_.clear();
111 descriptor_ =
nullptr;
113 status_ = Status::kInProgress;
SingleFrameCodec(const fml::RefPtr< ImageDescriptor > &descriptor, uint32_t target_width, uint32_t target_height)
~SingleFrameCodec() override
int frameCount() const override
int repetitionCount() const override
Dart_Handle getNextFrame(Dart_Handle args) override
static UIDartState * Current()
struct _Dart_Handle * Dart_Handle
DART_EXPORT Dart_Handle Dart_Null(void)
DART_EXPORT bool Dart_IsClosure(Dart_Handle object)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
sk_sp< const SkImage > image
Dart_Handle ToDart(const T &object)
Dart_Handle DartInvoke(Dart_Handle closure, std::initializer_list< Dart_Handle > args)