From da489796e5836b7db4cf3c925c40db449ac6e9ec Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Thu, 3 Feb 2011 01:05:15 -0800 Subject: [PATCH] Fast transform properties setters. Bug #3413510 Change-Id: I2c83e219faff697a48a160fee627f87422a2cd08 --- core/java/android/view/View.java | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 9db43a1f56120..1ecf320c235ab 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -6406,6 +6406,53 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } } + /** + * @hide + */ + public void setFastX(float x) { + mTranslationX = x - mLeft; + mMatrixDirty = true; + } + + /** + * @hide + */ + public void setFastY(float y) { + mTranslationY = y - mTop; + mMatrixDirty = true; + } + + /** + * @hide + */ + public void setFastScaleX(float x) { + mScaleX = x; + mMatrixDirty = true; + } + + /** + * @hide + */ + public void setFastScaleY(float y) { + mScaleY = y; + mMatrixDirty = true; + } + + /** + * @hide + */ + public void setFastAlpha(float alpha) { + mAlpha = alpha; + } + + /** + * @hide + */ + public void setFastRotationY(float y) { + mRotationY = y; + mMatrixDirty = true; + } + /** * Hit rectangle in parent's coordinates * @@ -6946,6 +6993,25 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } } + /** + * @hide + */ + public void fastInvalidate() { + if ((mPrivateFlags & (DRAWN | HAS_BOUNDS)) == (DRAWN | HAS_BOUNDS) || + (mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID || + (mPrivateFlags & INVALIDATED) != INVALIDATED) { + if (mParent instanceof View) { + ((View) mParent).mPrivateFlags |= INVALIDATED; + } + mPrivateFlags &= ~DRAWN; + mPrivateFlags |= INVALIDATED; + mPrivateFlags &= ~DRAWING_CACHE_VALID; + if (mParent != null && mAttachInfo != null && mAttachInfo.mHardwareAccelerated) { + mParent.invalidateChild(this, null); + } + } + } + /** * Used to indicate that the parent of this view should clear its caches. This functionality * is used to force the parent to rebuild its display list (when hardware-accelerated),