summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Romain Guy <romainguy@android.com> 2010-10-22 10:42:48 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-10-22 10:42:48 -0700
commitb0be86e08ea124c525eebc41f256a96ee4fc10cc (patch)
treeb3998060ca41379eb3f4beb3c58ab72b42fcff09
parentd15949e65d128a89957d62e5c6b0f799d096fb81 (diff)
parentae517591d96be39f5f18a1716c856ade13a8bcc7 (diff)
Merge "Don't perform glCopyTextImage with coordinates outside the buffer."
-rw-r--r--libs/hwui/OpenGLRenderer.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 17ef598b2dd6..38e153f1db50 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -355,8 +355,16 @@ bool OpenGLRenderer::createLayer(sp<Snapshot> snapshot, float left, float top,
Rect bounds(left, top, right, bottom);
if (!fboLayer) {
mSnapshot->transform->mapRect(bounds);
+
// Layers only make sense if they are in the framebuffer's bounds
bounds.intersect(*mSnapshot->clipRect);
+
+ // 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);
+
+ // We cannot work with sub-pixels in this case
bounds.snapToPixelBoundaries();
}