summaryrefslogtreecommitdiff
path: root/graphics/java
diff options
context:
space:
mode:
author Leon Scroggins III <scroggo@google.com> 2018-03-20 11:11:13 -0400
committer Leon Scroggins III <scroggo@google.com> 2018-03-21 09:28:00 -0400
commiteb3b38e22cb29c6a7fccb7031263f50663cc76d0 (patch)
tree020068ada31d756c10864558c63da49f37a8fe10 /graphics/java
parentbf190fd9641cd3ad76bc7bb289b4a3de83d0335a (diff)
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.
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedImageDrawable.java3
1 files changed, 1 insertions, 2 deletions
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);