skia2/include/android
Leon Scroggins III 4aafb3a8d1 Alternate between two SkBitmaps in SkAnimatedImage
Bug: 78866720

The client in Android calls newPictureSnapshot, which results in copying
the mutable SkBitmap into a newly allocated one in each frame. Avoid
this by calling SkMakeImageFromRasterBitmap with
kNever_SkCopyPixelsMode. Make SkAnimatedImage copy on write, by copying
before decoding if the bitmap's pixel ref is not unique.

Android's AnimatedImageDrawable's current architecture only decodes one
frame in advance, so it will never need to perform the copy on write.
This will save one bitmap allocation per GIF frame.

Add a test to verify that copy on write works as expected.

Change-Id: I87eb6e84089096cd2d618b91fb627fc58677e66a
Reviewed-on: https://skia-review.googlesource.com/129841
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
2018-05-23 20:49:42 +00:00
..
SkAndroidFrameworkUtils.h Add a private API for writing the clip to the stencil 2017-08-02 19:56:07 +00:00
SkAnimatedImage.h Alternate between two SkBitmaps in SkAnimatedImage 2018-05-23 20:49:42 +00:00
SkBitmapRegionDecoder.h Add SK_API to APIs used by the android framework. 2017-09-21 18:14:36 +00:00
SkBRDAllocator.h Move SkBitmapRegionDecoder to include/android and src/android 2015-11-13 06:11:09 -08:00