From 183e2a351daa8071be69eacb514b9405193a7a35 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Mon, 10 Jun 2013 22:28:58 -0700 Subject: [PATCH] Propagate pivot values of 0 to native layer Logic in pivotXY setters noops when the new value equals the previous value. However, the initial value is "0" even though we actually use a value of the view's midpoint by default. If an app sets a new value of 0, we don't send it down to the native layer because it's the same as the initial value, even though we're actually using a midpoint value instead. This causes a conflict between the matrix used for invalidations (which use the actual values the app set) and the matrix used for rendering (which uses the default midpoint values). The fix is to make sure we send down the initial value, even when it equals the default value, by checking to see whether this is the first time we're setting the pivot. Issue #9337635 Clipping and bad rendering of view corners when y pivot is set Change-Id: I4aa20c4a3c9a866ca17df3e067232b832d0ef504 --- core/java/android/view/View.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 8616aba39f71..650d6989bb49 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -9546,9 +9546,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public void setPivotX(float pivotX) { ensureTransformationInfo(); - mPrivateFlags |= PFLAG_PIVOT_EXPLICITLY_SET; final TransformationInfo info = mTransformationInfo; - if (info.mPivotX != pivotX) { + boolean pivotSet = (mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == + PFLAG_PIVOT_EXPLICITLY_SET; + if (info.mPivotX != pivotX || !pivotSet) { + mPrivateFlags |= PFLAG_PIVOT_EXPLICITLY_SET; invalidateViewProperty(true, false); info.mPivotX = pivotX; info.mMatrixDirty = true; @@ -9596,9 +9598,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ public void setPivotY(float pivotY) { ensureTransformationInfo(); - mPrivateFlags |= PFLAG_PIVOT_EXPLICITLY_SET; final TransformationInfo info = mTransformationInfo; - if (info.mPivotY != pivotY) { + boolean pivotSet = (mPrivateFlags & PFLAG_PIVOT_EXPLICITLY_SET) == + PFLAG_PIVOT_EXPLICITLY_SET; + if (info.mPivotY != pivotY || !pivotSet) { + mPrivateFlags |= PFLAG_PIVOT_EXPLICITLY_SET; invalidateViewProperty(true, false); info.mPivotY = pivotY; info.mMatrixDirty = true; -- 2.11.0