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
Loading
Please register or sign in to comment