Skip to content

Commit aa42c9a

Browse files
committed
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
1 parent d07fa6e commit aa42c9a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

libs/hwui/Caches.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,20 @@ bool Caches::setScissor(GLint x, GLint y, GLint width, GLint height) {
399399
if (scissorEnabled && (x != mScissorX || y != mScissorY ||
400400
width != mScissorWidth || height != mScissorHeight)) {
401401

402-
if (x < 0) x = 0;
403-
if (y < 0) y = 0;
404-
402+
if (x < 0) {
403+
width += x;
404+
x = 0;
405+
}
406+
if (y < 0) {
407+
height += y;
408+
y = 0;
409+
}
410+
if (width < 0) {
411+
width = 0;
412+
}
413+
if (height < 0) {
414+
height = 0;
415+
}
405416
glScissor(x, y, width, height);
406417

407418
mScissorX = x;

0 commit comments

Comments
 (0)