TINYGL: Fixed a bug with image clipping.
This commit is contained in:
parent
7bacf3c6b5
commit
78aa22180b
1 changed files with 12 additions and 4 deletions
|
@ -121,16 +121,26 @@ public:
|
|||
if (dstX >= scissorRect.right || dstY >= scissorRect.bottom)
|
||||
return false;
|
||||
|
||||
if (dstX + width < scissorRect.left || dstY + height < scissorRect.top) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dstX < scissorRect.left) {
|
||||
srcX += scissorRect.left - dstX;
|
||||
srcX += (scissorRect.left - dstX);
|
||||
width -= (scissorRect.left - dstX);
|
||||
dstX = scissorRect.left;
|
||||
}
|
||||
|
||||
if (dstY < scissorRect.top) {
|
||||
srcY += scissorRect.top - dstY;
|
||||
srcY += (scissorRect.top - dstY);
|
||||
height -= (scissorRect.top - dstY);
|
||||
dstY = scissorRect.top;
|
||||
}
|
||||
|
||||
if (width < 0 || height < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dstX + width > scissorRect.right)
|
||||
clampWidth = scissorRect.right - dstX;
|
||||
else
|
||||
|
@ -141,8 +151,6 @@ public:
|
|||
else
|
||||
clampHeight = height;
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue