diff options
author | Romain Guy <romainguy@google.com> | 2011-03-01 14:55:21 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-03-01 14:55:21 -0800 |
commit | d643bb56fdf21973ea75984f0816b7dc024698df (patch) | |
tree | fa0b758dfebc484db04a7d7f052ac8c961e35b10 | |
parent | 321dce646dc3c2ecfbd72a693d8d9294a6119736 (diff) | |
download | frameworks_base-d643bb56fdf21973ea75984f0816b7dc024698df.zip frameworks_base-d643bb56fdf21973ea75984f0816b7dc024698df.tar.gz frameworks_base-d643bb56fdf21973ea75984f0816b7dc024698df.tar.bz2 |
Correctly mark layers dirty when drawing WebView.
Change-Id: I7ae0c3cfa0916d8fbeaf01e8da127c621a06a0f4
-rw-r--r-- | core/java/android/view/ViewGroup.java | 25 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 11 |
2 files changed, 26 insertions, 10 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 5c06151..7ecf281 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2447,21 +2447,26 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } cache = child.getDrawingCache(true); } else { - if (layerType == LAYER_TYPE_SOFTWARE) { - child.buildDrawingCache(true); - cache = child.getDrawingCache(true); - } else if (layerType == LAYER_TYPE_NONE) { - // Delay getting the display list until animation-driven alpha values are - // set up and possibly passed on to the view - hasDisplayList = child.canHaveDisplayList(); + switch (layerType) { + case LAYER_TYPE_SOFTWARE: + child.buildDrawingCache(true); + cache = child.getDrawingCache(true); + break; + case LAYER_TYPE_NONE: + // Delay getting the display list until animation-driven alpha values are + // set up and possibly passed on to the view + hasDisplayList = child.canHaveDisplayList(); + break; } } } final boolean hasNoCache = cache == null || hasDisplayList; + final boolean offsetForScroll = cache == null && !hasDisplayList && + layerType != LAYER_TYPE_HARDWARE; final int restoreTo = canvas.save(); - if (cache == null && !hasDisplayList) { + if (offsetForScroll) { canvas.translate(cl - sx, ct - sy); } else { canvas.translate(cl, ct); @@ -2477,7 +2482,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager int transX = 0; int transY = 0; - if (cache == null && !hasDisplayList) { + if (offsetForScroll) { transX = -sx; transY = -sy; } @@ -2532,7 +2537,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } if ((flags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN) { - if (cache == null && !hasDisplayList) { + if (offsetForScroll) { canvas.clipRect(sx, sy, sx + (cr - cl), sy + (cb - ct)); } else { if (!scalingRequired || cache == null) { diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 48b3d6e..361815a 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -213,6 +213,17 @@ bool OpenGLRenderer::callDrawGLFunction(Functor *functor) { if (mDirtyClip) { setScissorFromClip(); } + +#if RENDER_LAYERS_AS_REGIONS + // Since we don't know what the functor will draw, let's dirty + // tne entire clip region + if (hasLayer()) { + Rect clip(*mSnapshot->clipRect); + clip.snapToPixelBoundaries(); + dirtyLayerUnchecked(clip, getRegion()); + } +#endif + status_t result = (*functor)(); resume(); return (result == 0) ? false : true; |