From 33deb7ed4d583c88187ba240efb749e9a1fd6843 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Wed, 7 Jun 2017 12:31:51 -0400 Subject: Make SkCodec more flexible about its required frame SkCodec sets fRequiredFrame to be the earliest possible frame that a given frame can depend on. e.g. - Frame A fills the screen, Keep - Frame B does not cover A, Keep - Frame C covers B but not A, and is opaque Frame C can depend on either A or B. SkCodec already reports that C depends on A. This CL allows a client of SkCodec to use either A or B to create C. Also expose the DisposalMethod. Since any frame between A and C can be used to create C except for DisposePrevious frames, the client needs to be able to know the disposal method so they do not try to use such a frame to create C. Further, the disposal method can be used to give the client a better idea whether they will continue to need a frame. (e.g. if frame i is DisposePrevious and depends on i-1, the client may not want to steal i-1 to create i, since i+1 may also depend on i-1.) TODO: Share code for decoding prior frames between GIF and WEBP Change-Id: I91a5ae22ba3d8dfbe0bde833fa67ae3da0d81ed6 Reviewed-on: https://skia-review.googlesource.com/13722 Reviewed-by: Mike Reed Reviewed-by: Chris Blume Reviewed-by: Matt Sarett Commit-Queue: Leon Scroggins --- gm/animatedGif.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gm') diff --git a/gm/animatedGif.cpp b/gm/animatedGif.cpp index 5f4fe71cb0..80bcdd9ee2 100644 --- a/gm/animatedGif.cpp +++ b/gm/animatedGif.cpp @@ -53,7 +53,6 @@ private: SkCodec::Options opts; opts.fFrameIndex = frameIndex; - opts.fHasPriorFrame = false; const int requiredFrame = fFrameInfos[frameIndex].fRequiredFrame; if (requiredFrame != SkCodec::kNone) { SkASSERT(requiredFrame >= 0 @@ -62,7 +61,7 @@ private: // For simplicity, do not try to cache old frames if (requiredBitmap.getPixels() && sk_tool_utils::copy_to(&bm, requiredBitmap.colorType(), requiredBitmap)) { - opts.fHasPriorFrame = true; + opts.fPriorFrame = requiredFrame; } } -- cgit v1.2.3