Merge "Avoid drawable invalidation during draw()" into mnc-dr1.5-dev
am: cf6885b7b7
* commit 'cf6885b7b7665b5589c0640e1cf4b98780f3aeec':
Avoid drawable invalidation during draw()
This commit is contained in:
@@ -3481,6 +3481,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
|
|
||||||
private int[] mDrawableState = null;
|
private int[] mDrawableState = null;
|
||||||
|
|
||||||
|
/** Whether draw() is currently being called. */
|
||||||
|
private boolean mInDraw = false;
|
||||||
|
|
||||||
ViewOutlineProvider mOutlineProvider = ViewOutlineProvider.BACKGROUND;
|
ViewOutlineProvider mOutlineProvider = ViewOutlineProvider.BACKGROUND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16151,6 +16154,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
*/
|
*/
|
||||||
@CallSuper
|
@CallSuper
|
||||||
public void draw(Canvas canvas) {
|
public void draw(Canvas canvas) {
|
||||||
|
mInDraw = true;
|
||||||
|
|
||||||
final int privateFlags = mPrivateFlags;
|
final int privateFlags = mPrivateFlags;
|
||||||
final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
|
final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
|
||||||
(mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState);
|
(mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState);
|
||||||
@@ -16195,6 +16200,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
onDrawForeground(canvas);
|
onDrawForeground(canvas);
|
||||||
|
|
||||||
// we're done...
|
// we're done...
|
||||||
|
mInDraw = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16342,6 +16348,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
|
|
||||||
// Step 6, draw decorations (foreground, scrollbars)
|
// Step 6, draw decorations (foreground, scrollbars)
|
||||||
onDrawForeground(canvas);
|
onDrawForeground(canvas);
|
||||||
|
|
||||||
|
mInDraw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16786,7 +16794,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void invalidateDrawable(@NonNull Drawable drawable) {
|
public void invalidateDrawable(@NonNull Drawable drawable) {
|
||||||
if (verifyDrawable(drawable)) {
|
// Don't invalidate if a drawable changes during drawing.
|
||||||
|
if (verifyDrawable(drawable) && !mInDraw) {
|
||||||
final Rect dirty = drawable.getDirtyBounds();
|
final Rect dirty = drawable.getDirtyBounds();
|
||||||
final int scrollX = mScrollX;
|
final int scrollX = mScrollX;
|
||||||
final int scrollY = mScrollY;
|
final int scrollY = mScrollY;
|
||||||
|
|||||||
Reference in New Issue
Block a user