From ad37cd3b5d3de9dd0858af04fbccd102e8ff4b0e Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Tue, 15 Mar 2011 11:12:25 -0700 Subject: [PATCH] Fix disappearing edges in lists/scrollviews/etc. Bug #4093871 This bug was introduced by a change that modified the way fade areas are cleared. The previous change relied on Rect::intersect() to empty the intersected rect when the two rects don't intersect. Unfortunately this is not what intersect() does. The fix is rather simple and sets the layer's bounds to empty when they don't intersect with the clip or the viewport. This has the side effect of ignoring the layer which is the expected result. Change-Id: Icf0038b9a476c53f8eff7084136aba3033d093e6 --- libs/hwui/OpenGLRenderer.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 5d9522e29fa0e..b8bd7d6758d27 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -407,15 +407,19 @@ bool OpenGLRenderer::createLayer(sp snapshot, float left, float top, mSnapshot->transform->mapRect(bounds); // Layers only make sense if they are in the framebuffer's bounds - bounds.intersect(*snapshot->clipRect); + if (bounds.intersect(*snapshot->clipRect)) { + // We cannot work with sub-pixels in this case + bounds.snapToPixelBoundaries(); - // We cannot work with sub-pixels in this case - bounds.snapToPixelBoundaries(); - - // When the layer is not an FBO, we may use glCopyTexImage so we - // need to make sure the layer does not extend outside the bounds - // of the framebuffer - bounds.intersect(snapshot->previous->viewport); + // When the layer is not an FBO, we may use glCopyTexImage so we + // need to make sure the layer does not extend outside the bounds + // of the framebuffer + if (!bounds.intersect(snapshot->previous->viewport)) { + bounds.setEmpty(); + } + } else { + bounds.setEmpty(); + } } if (bounds.isEmpty() || bounds.getWidth() > mCaches.maxTextureSize ||