22 #include <freerdp/config.h>
28 #include <freerdp/freerdp.h>
29 #include <freerdp/gdi/gdi.h>
31 #include <freerdp/gdi/region.h>
35 BOOL gdi_SetClipRgn(
HGDI_DC hdc, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, INT32 nHeight)
37 return gdi_SetRgn(hdc->clip, nXLeft, nYLeft, nWidth, nHeight);
59 BOOL gdi_SetNullClipRgn(
HGDI_DC hdc)
61 gdi_SetClipRgn(hdc, 0, 0, 0, 0);
62 hdc->clip->null = TRUE;
78 BOOL gdi_ClipCoords(
HGDI_DC hdc, INT32* x, INT32* y, INT32* w, INT32* h, INT32* srcx, INT32* srcy)
97 gdi_CRgnToRect(0, 0, hBmp->width, hBmp->height, &clip);
101 gdi_RgnToRect(hdc->clip, &clip);
102 gdi_CRgnToRect(0, 0, hBmp->width, hBmp->height, &bmp);
104 if (clip.left < bmp.left)
105 clip.left = bmp.left;
107 if (clip.right > bmp.right)
108 clip.right = bmp.right;
110 if (clip.top < bmp.top)
113 if (clip.bottom > bmp.bottom)
114 clip.bottom = bmp.bottom;
119 gdi_RgnToRect(hdc->clip, &clip);
122 gdi_CRgnToRect(*x, *y, *w, *h, &coords);
124 if (coords.right >= clip.left && coords.left <= clip.right && coords.bottom >= clip.top &&
125 coords.top <= clip.bottom)
128 if (coords.left < clip.left)
130 dx = (clip.left - coords.left);
131 coords.left = clip.left;
134 if (coords.right > clip.right)
135 coords.right = clip.right;
137 if (coords.top < clip.top)
139 dy = (clip.top - coords.top);
140 coords.top = clip.top;
143 if (coords.bottom > clip.bottom)
144 coords.bottom = clip.bottom;
162 gdi_RectToCRgn(&coords, x, y, w, h);