summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/View.java
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2013-04-17 15:54:52 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-04-17 15:54:52 -0700
commit68293ecb916677c51fa5ef826dc28f90b2dd6a96 (patch)
treeb70a1ce3996d14414f2ad02df5f7038fb446948d /core/java/android/view/View.java
parent61cc1b632ad250c359499173f37b9f013f0f9415 (diff)
parent78296cb760bff8bf951e88d6f4ec9a6ff3059406 (diff)
downloadframeworks_base-68293ecb916677c51fa5ef826dc28f90b2dd6a96.zip
frameworks_base-68293ecb916677c51fa5ef826dc28f90b2dd6a96.tar.gz
frameworks_base-68293ecb916677c51fa5ef826dc28f90b2dd6a96.tar.bz2
am 78296cb7: am bc09a364: Merge "Fixes for setClipBounds()" into jb-mr2-dev
* commit '78296cb760bff8bf951e88d6f4ec9a6ff3059406': Fixes for setClipBounds()
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r--core/java/android/view/View.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 789fe40..2903b6f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -13395,18 +13395,32 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
/**
* Sets a rectangular area on this view to which the view will be clipped
- * it is drawn. Setting the value to null will remove the clip bounds
+ * when it is drawn. Setting the value to null will remove the clip bounds
* and the view will draw normally, using its full bounds.
*
* @param clipBounds The rectangular area, in the local coordinates of
* this view, to which future drawing operations will be clipped.
*/
public void setClipBounds(Rect clipBounds) {
- mClipBounds = clipBounds;
if (clipBounds != null) {
- invalidate(clipBounds);
+ if (clipBounds.equals(mClipBounds)) {
+ return;
+ }
+ if (mClipBounds == null) {
+ invalidate();
+ mClipBounds = new Rect(clipBounds);
+ } else {
+ invalidate(Math.min(mClipBounds.left, clipBounds.left),
+ Math.min(mClipBounds.top, clipBounds.top),
+ Math.max(mClipBounds.right, clipBounds.right),
+ Math.max(mClipBounds.bottom, clipBounds.bottom));
+ mClipBounds.set(clipBounds);
+ }
} else {
- invalidate();
+ if (mClipBounds != null) {
+ invalidate();
+ mClipBounds = null;
+ }
}
}