diff options
| author | Romain Guy <romainguy@google.com> | 2012-02-15 16:41:29 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-02-15 16:41:29 -0800 |
| commit | f7280ccbfe6d71686a4e609ee7628f84e514a32d (patch) | |
| tree | 68dfe3ce37f18200ff32fb249efab9629edf6f62 /core/java/android/view/ViewGroup.java | |
| parent | 687bdf0ae12addc095ba9f195e4ef3aa1133aa38 (diff) | |
| parent | fe455af277183f910eb74653a3ad172c717e7abf (diff) | |
| download | frameworks_base-f7280ccbfe6d71686a4e609ee7628f84e514a32d.zip frameworks_base-f7280ccbfe6d71686a4e609ee7628f84e514a32d.tar.gz frameworks_base-f7280ccbfe6d71686a4e609ee7628f84e514a32d.tar.bz2 | |
Merge "Add a compile time condition to remove unnecessary code"
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 223 |
1 files changed, 114 insertions, 109 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 7e00cba..e6a8334 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -3604,130 +3604,135 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // through final boolean drawAnimation = (child.mPrivateFlags & DRAW_ANIMATION) == DRAW_ANIMATION; - if (dirty == null) { - if (child.mLayerType != LAYER_TYPE_NONE) { - mPrivateFlags |= INVALIDATED; - mPrivateFlags &= ~DRAWING_CACHE_VALID; - child.mLocalDirtyRect.setEmpty(); - } - do { - View view = null; - if (parent instanceof View) { - view = (View) parent; - if (view.mLayerType != LAYER_TYPE_NONE) { - view.mLocalDirtyRect.setEmpty(); - if (view.getParent() instanceof View) { - final View grandParent = (View) view.getParent(); - grandParent.mPrivateFlags |= INVALIDATED; - grandParent.mPrivateFlags &= ~DRAWING_CACHE_VALID; + //noinspection PointlessBooleanExpression + if (!HardwareRenderer.RENDER_DIRTY_REGIONS) { + if (dirty == null) { + if (child.mLayerType != LAYER_TYPE_NONE) { + mPrivateFlags |= INVALIDATED; + mPrivateFlags &= ~DRAWING_CACHE_VALID; + child.mLocalDirtyRect.setEmpty(); + } + do { + View view = null; + if (parent instanceof View) { + view = (View) parent; + if (view.mLayerType != LAYER_TYPE_NONE) { + view.mLocalDirtyRect.setEmpty(); + if (view.getParent() instanceof View) { + final View grandParent = (View) view.getParent(); + grandParent.mPrivateFlags |= INVALIDATED; + grandParent.mPrivateFlags &= ~DRAWING_CACHE_VALID; + } + } + if ((view.mPrivateFlags & DIRTY_MASK) != 0) { + // already marked dirty - we're done + break; } } - if ((view.mPrivateFlags & DIRTY_MASK) != 0) { - // already marked dirty - we're done - break; - } - } - - if (drawAnimation) { - if (view != null) { - view.mPrivateFlags |= DRAW_ANIMATION; - } else if (parent instanceof ViewRootImpl) { - ((ViewRootImpl) parent).mIsAnimating = true; + + if (drawAnimation) { + if (view != null) { + view.mPrivateFlags |= DRAW_ANIMATION; + } else if (parent instanceof ViewRootImpl) { + ((ViewRootImpl) parent).mIsAnimating = true; + } } - } - - if (parent instanceof ViewRootImpl) { - ((ViewRootImpl) parent).invalidate(); - parent = null; - } else if (view != null) { - if ((view.mPrivateFlags & DRAWN) == DRAWN || - (view.mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) { - view.mPrivateFlags &= ~DRAWING_CACHE_VALID; - view.mPrivateFlags |= DIRTY; - parent = view.mParent; - } else { + + if (parent instanceof ViewRootImpl) { + ((ViewRootImpl) parent).invalidate(); parent = null; + } else if (view != null) { + if ((view.mPrivateFlags & DRAWN) == DRAWN || + (view.mPrivateFlags & DRAWING_CACHE_VALID) == DRAWING_CACHE_VALID) { + view.mPrivateFlags &= ~DRAWING_CACHE_VALID; + view.mPrivateFlags |= DIRTY; + parent = view.mParent; + } else { + parent = null; + } } - } - } while (parent != null); - } else { - // Check whether the child that requests the invalidate is fully opaque - // Views being animated or transformed are not considered opaque because we may - // be invalidating their old position and need the parent to paint behind them. - Matrix childMatrix = child.getMatrix(); - final boolean isOpaque = child.isOpaque() && !drawAnimation && - child.getAnimation() == null && childMatrix.isIdentity(); - // Mark the child as dirty, using the appropriate flag - // Make sure we do not set both flags at the same time - int opaqueFlag = isOpaque ? DIRTY_OPAQUE : DIRTY; - - if (child.mLayerType != LAYER_TYPE_NONE) { - mPrivateFlags |= INVALIDATED; - mPrivateFlags &= ~DRAWING_CACHE_VALID; - child.mLocalDirtyRect.union(dirty); + } while (parent != null); } - final int[] location = attachInfo.mInvalidateChildLocation; - location[CHILD_LEFT_INDEX] = child.mLeft; - location[CHILD_TOP_INDEX] = child.mTop; - if (!childMatrix.isIdentity()) { - RectF boundingRect = attachInfo.mTmpTransformRect; - boundingRect.set(dirty); - //boundingRect.inset(-0.5f, -0.5f); - childMatrix.mapRect(boundingRect); - dirty.set((int) (boundingRect.left - 0.5f), - (int) (boundingRect.top - 0.5f), - (int) (boundingRect.right + 0.5f), - (int) (boundingRect.bottom + 0.5f)); - } + return; + } - do { - View view = null; - if (parent instanceof View) { - view = (View) parent; - if (view.mLayerType != LAYER_TYPE_NONE && - view.getParent() instanceof View) { - final View grandParent = (View) view.getParent(); - grandParent.mPrivateFlags |= INVALIDATED; - grandParent.mPrivateFlags &= ~DRAWING_CACHE_VALID; - } - } + // Check whether the child that requests the invalidate is fully opaque + // Views being animated or transformed are not considered opaque because we may + // be invalidating their old position and need the parent to paint behind them. + Matrix childMatrix = child.getMatrix(); + final boolean isOpaque = child.isOpaque() && !drawAnimation && + child.getAnimation() == null && childMatrix.isIdentity(); + // Mark the child as dirty, using the appropriate flag + // Make sure we do not set both flags at the same time + int opaqueFlag = isOpaque ? DIRTY_OPAQUE : DIRTY; + + if (child.mLayerType != LAYER_TYPE_NONE) { + mPrivateFlags |= INVALIDATED; + mPrivateFlags &= ~DRAWING_CACHE_VALID; + child.mLocalDirtyRect.union(dirty); + } - if (drawAnimation) { - if (view != null) { - view.mPrivateFlags |= DRAW_ANIMATION; - } else if (parent instanceof ViewRootImpl) { - ((ViewRootImpl) parent).mIsAnimating = true; - } + final int[] location = attachInfo.mInvalidateChildLocation; + location[CHILD_LEFT_INDEX] = child.mLeft; + location[CHILD_TOP_INDEX] = child.mTop; + if (!childMatrix.isIdentity()) { + RectF boundingRect = attachInfo.mTmpTransformRect; + boundingRect.set(dirty); + //boundingRect.inset(-0.5f, -0.5f); + childMatrix.mapRect(boundingRect); + dirty.set((int) (boundingRect.left - 0.5f), + (int) (boundingRect.top - 0.5f), + (int) (boundingRect.right + 0.5f), + (int) (boundingRect.bottom + 0.5f)); + } + + do { + View view = null; + if (parent instanceof View) { + view = (View) parent; + if (view.mLayerType != LAYER_TYPE_NONE && + view.getParent() instanceof View) { + final View grandParent = (View) view.getParent(); + grandParent.mPrivateFlags |= INVALIDATED; + grandParent.mPrivateFlags &= ~DRAWING_CACHE_VALID; } + } - // If the parent is dirty opaque or not dirty, mark it dirty with the opaque - // flag coming from the child that initiated the invalidate + if (drawAnimation) { if (view != null) { - if ((view.mViewFlags & FADING_EDGE_MASK) != 0 && - view.getSolidColor() == 0) { - opaqueFlag = DIRTY; - } - if ((view.mPrivateFlags & DIRTY_MASK) != DIRTY) { - view.mPrivateFlags = (view.mPrivateFlags & ~DIRTY_MASK) | opaqueFlag; - } + view.mPrivateFlags |= DRAW_ANIMATION; + } else if (parent instanceof ViewRootImpl) { + ((ViewRootImpl) parent).mIsAnimating = true; } + } - parent = parent.invalidateChildInParent(location, dirty); - if (view != null) { - // Account for transform on current parent - Matrix m = view.getMatrix(); - if (!m.isIdentity()) { - RectF boundingRect = attachInfo.mTmpTransformRect; - boundingRect.set(dirty); - m.mapRect(boundingRect); - dirty.set((int) boundingRect.left, (int) boundingRect.top, - (int) (boundingRect.right + 0.5f), - (int) (boundingRect.bottom + 0.5f)); - } + // If the parent is dirty opaque or not dirty, mark it dirty with the opaque + // flag coming from the child that initiated the invalidate + if (view != null) { + if ((view.mViewFlags & FADING_EDGE_MASK) != 0 && + view.getSolidColor() == 0) { + opaqueFlag = DIRTY; } - } while (parent != null); - } + if ((view.mPrivateFlags & DIRTY_MASK) != DIRTY) { + view.mPrivateFlags = (view.mPrivateFlags & ~DIRTY_MASK) | opaqueFlag; + } + } + + parent = parent.invalidateChildInParent(location, dirty); + if (view != null) { + // Account for transform on current parent + Matrix m = view.getMatrix(); + if (!m.isIdentity()) { + RectF boundingRect = attachInfo.mTmpTransformRect; + boundingRect.set(dirty); + m.mapRect(boundingRect); + dirty.set((int) boundingRect.left, (int) boundingRect.top, + (int) (boundingRect.right + 0.5f), + (int) (boundingRect.bottom + 0.5f)); + } + } + } while (parent != null); } } |
