Skip to content

Commit be29d82

Browse files
chethaaseAndroid (Google) Code Review
authored andcommitted
Merge "Correctly adjust clip regions that lie offscreen" into jb-mr1-dev
2 parents 91ffedd + aa42c9a commit be29d82

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)