diff options
author | Leon Scroggins III <scroggo@google.com> | 2021-01-20 15:28:39 -0500 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2021-01-27 16:54:03 +0000 |
commit | be969efdb0234b7b39636ec0a586dbb708ec480d (patch) | |
tree | b0db6a64e1e3664759b528707dd1d365cf791327 /tools/aapt2/java/JavaClassGenerator.cpp | |
parent | e363da126961e6ee2a4fd81d49ef095b3ce5d88a (diff) |
Implement AnimatedImageDrawable#setBounds
Bug: 160617841
Test: If6edcada514977c2f08c29927380d35000173dc5
AnimatedImageDrawable.java:
- Override onBoundsChange. Silently do nothing if mNativePtr is 0. This
matches setRepeatCount, setAutoMirrored, and onLayoutDirectionChanged.
While some other methods throw an IllegalStateException, doing nothing
is safer for backwards compatibility.
AnimatedImageDrawable.h:
- Add Properties.mBounds. Putting it here provides a safe way for the UI
thread to change it, like it does for other properties (alpha, color
filter).
- Remove redundant "virtual" modifiers on "override" methods.
hwui/AnimatedImageDrawable.cpp:
- Initialize mStagingProperties.mBounds to use the intrinsic bounds. The
official documentation requires a client of Drawable to call setBounds,
but AnimatedImageDrawable as introduced in P started with the intrinsic
bounds. This ensures we maintain that behavior without special casing a
client that never calls the method.
- Handle the bounds, using a scale and translate
- Update the SkAutoCanvasRestores to save, removing the need to manually
determine whether it's necessary to call save().
- Update onGetBounds to return SkRectMakeLargest. This matches
RenderNodeDrawable and ReorderBarrierDrawables. Since the Drawable may
be updated by a call to setBounds to draw anywhere, this ensures the
bounds always contains the drawing.
jni/AnimatedImageDrawable.cpp:
- Plumb the new bounds to the native object.
Change-Id: If8d7ed51a56e0f64714f15e6041ed883e8ce23f8
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator.cpp')
0 files changed, 0 insertions, 0 deletions