summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2011-06-22 09:18:31 -0700
committerChet Haase <chet@google.com>2011-06-22 15:53:53 -0700
commitad4f70306b2089a273635b73a101fe48aa36cbe2 (patch)
treeed8fb993089e8b27401dabe4e3d64b37b5c3a6ea /core/java
parent8969d9924c662ab4cdacc342bbdc33756db730be (diff)
Fix flashing artifacts caused by invalidation bugs
Therea re 2 fixes here: - We sometimes cleared a flag in ViewAncestor too soon that controlled how invalidated areas were redrawn (related to whether the invalidates happened on opaque views or not). - TransitionDrawable was always setting/restoring alpha values on its drawables every time it was drawn. setAlpha on BitmapDrawable causes an invalidation, so essentially this was an infinite invalidation/redrawing loop. The fix was to notice when the animation was done and to simply draw the appropriate drawable[s]. Change-Id: I1849a5a909b0039a0e9bce0aa3cfc33c50f8f854
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/ViewAncestor.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/core/java/android/view/ViewAncestor.java b/core/java/android/view/ViewAncestor.java
index afbedafa6eac..ca11c70b21c7 100644
--- a/core/java/android/view/ViewAncestor.java
+++ b/core/java/android/view/ViewAncestor.java
@@ -288,6 +288,10 @@ public final class ViewAncestor extends Handler implements ViewParent,
private final int mDensity;
+ // This flag tracks when the mIgnoreDirtyState flag is set during draw(), to avoid
+ // clearing that flag prematurely
+ private boolean mSetIgnoreDirtyState = false;
+
/**
* Consistency verifier for debugging purposes.
*/
@@ -672,6 +676,7 @@ public final class ViewAncestor extends Handler implements ViewParent,
}
}
if (!mDirty.isEmpty() && !mDirty.contains(dirty)) {
+ mSetIgnoreDirtyState = true;
mAttachInfo.mIgnoreDirtyState = true;
}
mDirty.union(dirty);
@@ -1748,7 +1753,7 @@ public final class ViewAncestor extends Handler implements ViewParent,
mAttachInfo.mIgnoreDirtyState = true;
dirty.union(0, 0, (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f));
}
-
+
if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
if (!dirty.isEmpty() || mIsAnimating) {
mIsAnimating = false;
@@ -1878,9 +1883,13 @@ public final class ViewAncestor extends Handler implements ViewParent,
}
canvas.setScreenDensity(scalingRequired
? DisplayMetrics.DENSITY_DEVICE : 0);
+ mSetIgnoreDirtyState = false;
mView.draw(canvas);
} finally {
- mAttachInfo.mIgnoreDirtyState = false;
+ if (!mSetIgnoreDirtyState) {
+ // Only clear the flag if it was not set during the mView.draw() call
+ mAttachInfo.mIgnoreDirtyState = false;
+ }
}
if (false && ViewDebug.consistencyCheckEnabled) {