mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
add negative x,y checking in dimRect
This commit is contained in:
21
blitbuffer.c
21
blitbuffer.c
@@ -489,6 +489,27 @@ static int dimRect(lua_State *L) {
|
||||
uint8_t *dstptr;
|
||||
|
||||
int cy, cx;
|
||||
|
||||
if (x < 0) {
|
||||
if ( x + w > 0 ) {
|
||||
w = w + x;
|
||||
x = 0;
|
||||
} else {
|
||||
//printf("## invertRect x out of bound\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
if ( y + h > 0 ) {
|
||||
h = h + y;
|
||||
y = 0;
|
||||
} else {
|
||||
//printf("## invertRect y out of bound\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(w <= 0 || h <= 0 || x >= dst->w || y >= dst->h) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user