Make ImageDecoder return animated Drawables
Bug: 63909536 Bug: 63908092 Test: TODO If ImageDecoder.decodeDrawable is called with an animated image Source (currently GIF or WebP), return an object of a new (hidden) Drawable subclass. The new Drawable animates, and it implements Animatable (TODO: implement Animatable2) so users have some control over the animation. In addition to the normal features of Drawable, this new one supports many of the features of ImageDecoder, including scaling, cropping and PostProcess, which enables circle masks/rounded corners and other arbitrary after-effects. It does *not* support decoding directly to a Hardware Bitmap, since it cycles through frames and reuses the same bitmap memory. But it could be made to use shared memory (TODO?). TODO: Use a better number for the native allocation registry TODO: Use the RenderThread to drive the animation, and remove decoding on the UI thread. TODO: Add support for modifying the loop count Android.bp: - build new AnimatedImageDrawable.cpp AndroidRuntime.cpp: - register new native methods AnimatedImageDrawable.java AnimatedImageDrawable.cpp: - new Drawable that handles animated images Canvas.h, SkiaCanvas.h/.cpp - New virtual method and implementation for drawing SkAnimatedImages RecordingCanvas.h/.cpp - Stub implementation of drawing SkAnimatedImages ImageDecoder.h/cpp - Allow code sharing with AnimatedImageDrawable.cpp - postProcess - access the ImageDecoder struct Depends on https://skia-review.googlesource.com/c/skia/+/94660 in Skia. Change-Id: Ie2ec98d9c52deda4d439c6ef8e5dea2861bb93a3
Loading
Please register or sign in to comment