From eb3b38e22cb29c6a7fccb7031263f50663cc76d0 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Tue, 20 Mar 2018 11:11:13 -0400 Subject: Report native allocation size of AnimatedImageDrawable Bug: 73641604 Test: infeasible Fix nNativeByteSize's return value to be jlong, instead of long. Add up the bytes used by the SkAnimatedImage and SkPictures and store them on the AnimatedImageDrawable for registration. Note that this is an approximation, and it assumes it will be drawn to a hardware canvas and animated. --- graphics/java/android/graphics/drawable/AnimatedImageDrawable.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'graphics/java') diff --git a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java index c0f49208e27e..a47ecf517c70 100644 --- a/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimatedImageDrawable.java @@ -292,8 +292,7 @@ public class AnimatedImageDrawable extends Drawable implements Animatable2 { mState = new State(nCreate(nativeImageDecoder, decoder, width, height, cropRect), inputStream, afd); - // FIXME: Use the right size for the native allocation. - long nativeSize = 200; + final long nativeSize = nNativeByteSize(mState.mNativePtr); NativeAllocationRegistry registry = new NativeAllocationRegistry( AnimatedImageDrawable.class.getClassLoader(), nGetNativeFinalizer(), nativeSize); registry.registerNativeAllocation(mState, mState.mNativePtr); -- cgit v1.2.3-59-g8ed1b