Skip to content

Commit

Permalink
Handle decompressed images in InstantiateImageCodec (flutter#9901)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons committed Jul 18, 2019
1 parent ad5ae0f commit 5ed71f1
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/ui/painting/codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,22 @@ static void InstantiateImageCodec(Dart_NativeArguments args) {
const int targetHeight =
tonic::DartConverter<int>::FromDart(Dart_GetNativeArgument(args, 4));

auto codec = SkCodec::MakeFromData(buffer);

if (!codec) {
Dart_SetReturnValue(args, ToDart("Could not instantiate image codec."));
return;
std::unique_ptr<SkCodec> codec;
bool single_frame;
if (image_info) {
single_frame = true;
} else {
codec = SkCodec::MakeFromData(buffer);
if (!codec) {
Dart_SetReturnValue(args, ToDart("Could not instantiate image codec."));
return;
}
single_frame = codec->getFrameCount() == 1;
}

fml::RefPtr<Codec> ui_codec;

if (codec->getFrameCount() == 1) {
if (single_frame) {
ImageDecoder::ImageDescriptor descriptor;
descriptor.decompressed_image_info = image_info;

Expand Down

0 comments on commit 5ed71f1

Please sign in to comment.