diff --git a/engine/src/flutter/lib/ui/painting/image_decoding.cc b/engine/src/flutter/lib/ui/painting/image_decoding.cc index ff67de20576..50a4bc8f461 100644 --- a/engine/src/flutter/lib/ui/painting/image_decoding.cc +++ b/engine/src/flutter/lib/ui/painting/image_decoding.cc @@ -16,10 +16,6 @@ #include "lib/tonic/typed_data/uint8_list.h" #include "third_party/skia/include/core/SkImageGenerator.h" -#ifdef OS_ANDROID -#include -#endif - using tonic::DartInvoke; using tonic::DartPersistentValue; using tonic::ToDart; @@ -34,24 +30,14 @@ sk_sp DecodeImage(sk_sp buffer) { return nullptr; } - auto raster_image = SkImage::MakeFromEncoded(std::move(buffer)); - - if (raster_image == nullptr) { - return nullptr; - } - - if (auto context = ResourceContext::Get()) { + GrContext* context = ResourceContext::Get(); + if (context) { // TODO: Supply actual destination color space once available - if (auto texture_image = - raster_image->makeTextureImage(context, nullptr)) { -#ifdef OS_ANDROID - glFlush(); -#endif - return texture_image; - } + return SkImage::MakeCrossContextFromEncoded(context, std::move(buffer), + false, nullptr); + } else { + return SkImage::MakeFromEncoded(std::move(buffer)); } - - return raster_image; } void InvokeImageCallback(sk_sp image,