#include "clipping.h"
-BOOL gdi_SetClipRgn(HGDI_DC hdc, UINT32 nXLeft, UINT32 nYLeft, UINT32 nWidth, UINT32 nHeight)
+BOOL gdi_SetClipRgn(HGDI_DC hdc, UINT32 nXLeft, UINT32 nYLeft, UINT32 nWidth,
+ UINT32 nHeight)
{
return gdi_SetRgn(hdc->clip, nXLeft, nYLeft, nWidth, nHeight);
}
* @return nonzero if there is something to draw, 0 otherwise
*/
-BOOL gdi_ClipCoords(HGDI_DC hdc, UINT32 *x, UINT32 *y, UINT32 *w, UINT32 *h,
- UINT32 *srcx, UINT32 *srcy)
+BOOL gdi_ClipCoords(HGDI_DC hdc, UINT32* x, UINT32* y, UINT32* w, UINT32* h,
+ UINT32* srcx, UINT32* srcy)
{
GDI_RECT bmp;
GDI_RECT clip;
GDI_RECT coords;
HGDI_BITMAP hBmp;
-
int dx = 0;
int dy = 0;
BOOL draw = TRUE;
gdi_CRgnToRect(*x, *y, *w, *h, &coords);
if (coords.right >= clip.left && coords.left <= clip.right &&
- coords.bottom >= clip.top && coords.top <= clip.bottom)
+ coords.bottom >= clip.top && coords.top <= clip.bottom)
{
/* coordinates overlap with clipping region */
-
if (coords.left < clip.left)
{
- dx = (clip.left - coords.left) + 1;
+ dx = (clip.left - coords.left);
coords.left = clip.left;
}
if (coords.top < clip.top)
{
- dy = (clip.top - coords.top) + 1;
+ dy = (clip.top - coords.top);
coords.top = clip.top;
}
else
{
/* coordinates do not overlap with clipping region */
-
coords.left = 0;
coords.right = 0;
coords.top = 0;
}
if (srcx != NULL)
- {
- if (dx > 0)
- {
- *srcx += dx - 1;
- }
- }
+ *srcx += dx;
if (srcy != NULL)
- {
- if (dy > 0)
- {
- *srcy += dy - 1;
- }
- }
+ *srcy += dy;
gdi_RectToCRgn(&coords, x, y, w, h);
-
return draw;
}