From ae517591d96be39f5f18a1716c856ade13a8bcc7 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 22 Oct 2010 10:40:27 -0700 Subject: Don't perform glCopyTextImage with coordinates outside the buffer. Bug #3122179 Change-Id: I91ed397e9e553a8eeb69d82d0c5b1e49a3cdd5ff --- libs/hwui/OpenGLRenderer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libs/hwui/OpenGLRenderer.cpp') 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, 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(); } -- cgit v1.2.3-59-g8ed1b