From aa42c9af6ea2158a685ebf9b338e6d2355712268 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Tue, 16 Oct 2012 17:36:16 -0700 Subject: Correctly adjust clip regions that lie offscreen We were clamping the x/y location of the scissor to 0,0, but not adjusting the width/height appropriately. This fix adjusts width/height and also clamps them to 0 to correctly clip out offscreen operations. Issue #7221524 Top left and top right portions of the screen blanks out after some time Change-Id: I47f23336ea612409ed86652b9a68e272819ef00e --- libs/hwui/Caches.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'libs') diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp index d18a5b0..e7085b0 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -399,9 +399,20 @@ bool Caches::setScissor(GLint x, GLint y, GLint width, GLint height) { if (scissorEnabled && (x != mScissorX || y != mScissorY || width != mScissorWidth || height != mScissorHeight)) { - if (x < 0) x = 0; - if (y < 0) y = 0; - + if (x < 0) { + width += x; + x = 0; + } + if (y < 0) { + height += y; + y = 0; + } + if (width < 0) { + width = 0; + } + if (height < 0) { + height = 0; + } glScissor(x, y, width, height); mScissorX = x; -- cgit v1.1