summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2014-09-15 13:46:43 -0700
committerChet Haase <chet@google.com>2014-09-15 15:33:10 -0700
commit27652eff447a3331701466cf969a50cc106a9940 (patch)
tree7a2aa4ca99b2c4cc0b2d7f146e104c8248b932e1 /core/java/android/view
parenta2f945e227d8059e3ff9c41676146b057cd7ddbe (diff)
downloadframeworks_base-27652eff447a3331701466cf969a50cc106a9940.zip
frameworks_base-27652eff447a3331701466cf969a50cc106a9940.tar.gz
frameworks_base-27652eff447a3331701466cf969a50cc106a9940.tar.bz2
Avoid invalidating view during some outline invalidations
We were invalidating the view during outline invalidation far too often. Sometimes, it's appropriate to invalidate the view when the outline changes, but not when the outline is being invalidated in the middle of drawing the view, which is done in reaction to a view invalidation. Issue #17460940 Volantis: panning in Calendar from month to month is only at 30fps Change-Id: I7bdee17dc9c7df89d4cd3d781010823cef931222
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/View.java38
1 files changed, 31 insertions, 7 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 87ad036..83dfe85 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2400,6 +2400,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
static final int PFLAG3_NESTED_SCROLLING_ENABLED = 0x80;
+ /**
+ * Flag indicating that outline was invalidated and should be rebuilt the next time
+ * the DisplayList is updated.
+ */
+ static final int PFLAG3_OUTLINE_INVALID = 0x100;
+
/* End of masks for mPrivateFlags3 */
static final int DRAG_MASK = PFLAG2_DRAG_CAN_ACCEPT | PFLAG2_DRAG_HOVERED;
@@ -11079,6 +11085,22 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @see #setOutlineProvider(ViewOutlineProvider)
*/
public void invalidateOutline() {
+ mPrivateFlags3 |= PFLAG3_OUTLINE_INVALID;
+
+ notifySubtreeAccessibilityStateChangedIfNeeded();
+ invalidateViewProperty(false, false);
+ }
+
+ /**
+ * Internal version of {@link #invalidateOutline()} which invalidates the
+ * outline without invalidating the view itself. This is intended to be called from
+ * within methods in the View class itself which are the result of the view being
+ * invalidated already. For example, when we are drawing the background of a View,
+ * we invalidate the outline in case it changed in the meantime, but we do not
+ * need to invalidate the view because we're already drawing the background as part
+ * of drawing the view in response to an earlier invalidation of the view.
+ */
+ private void rebuildOutline() {
// Unattached views ignore this signal, and outline is recomputed in onAttachedToWindow()
if (mAttachInfo == null) return;
@@ -11093,9 +11115,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mOutlineProvider.getOutline(this, outline);
mRenderNode.setOutline(outline);
}
-
- notifySubtreeAccessibilityStateChangedIfNeeded();
- invalidateViewProperty(false, false);
}
/**
@@ -12936,7 +12955,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
resetSubtreeAccessibilityStateChanged();
- invalidateOutline();
+ // rebuild, since Outline not maintained while View is detached
+ rebuildOutline();
if (isFocused()) {
InputMethodManager imm = InputMethodManager.peekInstance();
@@ -14656,6 +14676,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
void setDisplayListProperties(RenderNode renderNode) {
if (renderNode != null) {
+ if ((mPrivateFlags3 & PFLAG3_OUTLINE_INVALID) != 0) {
+ rebuildOutline();
+ mPrivateFlags3 &= ~PFLAG3_OUTLINE_INVALID;
+ }
renderNode.setHasOverlappingRendering(hasOverlappingRendering());
if (mParent instanceof ViewGroup) {
renderNode.setClipToBounds(
@@ -15305,7 +15329,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if (mBackgroundSizeChanged) {
background.setBounds(0, 0, mRight - mLeft, mBottom - mTop);
mBackgroundSizeChanged = false;
- invalidateOutline();
+ mPrivateFlags3 |= PFLAG3_OUTLINE_INVALID;
}
// Attempt to use a display list if requested.
@@ -15680,7 +15704,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
mOverlay.getOverlayView().setRight(newWidth);
mOverlay.getOverlayView().setBottom(newHeight);
}
- invalidateOutline();
+ mPrivateFlags3 |= PFLAG3_OUTLINE_INVALID;
}
/**
@@ -15717,7 +15741,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
invalidate(dirty.left + scrollX, dirty.top + scrollY,
dirty.right + scrollX, dirty.bottom + scrollY);
- invalidateOutline();
+ mPrivateFlags3 |= PFLAG3_OUTLINE_INVALID;
}
}