2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
#include <freerdp/gdi/gdi.h>
|
|
|
|
|
|
|
|
#include <freerdp/gdi/dc.h>
|
|
|
|
#include <freerdp/gdi/pen.h>
|
|
|
|
#include <freerdp/gdi/region.h>
|
|
|
|
#include <freerdp/gdi/bitmap.h>
|
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
#include "line.h"
|
|
|
|
#include "brush.h"
|
|
|
|
#include "clipping.h"
|
|
|
|
|
|
|
|
static int test_gdi_ClipCoords(void)
|
2013-12-11 01:35:46 +04:00
|
|
|
{
|
2017-11-15 11:11:12 +03:00
|
|
|
int rc = -1;
|
2015-06-26 15:32:38 +03:00
|
|
|
BOOL draw;
|
2013-12-11 01:35:46 +04:00
|
|
|
HGDI_DC hdc;
|
2017-11-15 11:11:12 +03:00
|
|
|
HGDI_RGN rgn1 = NULL;
|
|
|
|
HGDI_RGN rgn2 = NULL;
|
|
|
|
HGDI_BITMAP bmp = NULL;
|
2016-04-05 18:07:45 +03:00
|
|
|
const UINT32 format = PIXEL_FORMAT_ARGB32;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2015-05-08 22:39:23 +03:00
|
|
|
if (!(hdc = gdi_GetDC()))
|
|
|
|
{
|
|
|
|
printf("failed to get gdi device context\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
hdc->format = format;
|
2016-07-15 17:22:09 +03:00
|
|
|
bmp = gdi_CreateBitmapEx(1024, 768, PIXEL_FORMAT_XRGB32, 0, NULL, NULL);
|
2013-12-11 01:35:46 +04:00
|
|
|
gdi_SelectObject(hdc, (HGDIOBJECT) bmp);
|
|
|
|
gdi_SetNullClipRgn(hdc);
|
|
|
|
rgn1 = gdi_CreateRectRgn(0, 0, 0, 0);
|
|
|
|
rgn2 = gdi_CreateRectRgn(0, 0, 0, 0);
|
2016-10-06 14:41:52 +03:00
|
|
|
rgn1->null = TRUE;
|
|
|
|
rgn2->null = TRUE;
|
2013-12-11 01:35:46 +04:00
|
|
|
/* null clipping region */
|
|
|
|
gdi_SetNullClipRgn(hdc);
|
|
|
|
gdi_SetRgn(rgn1, 20, 20, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 20, 20, 100, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* region all inside clipping region */
|
|
|
|
gdi_SetClipRgn(hdc, 0, 0, 1024, 768);
|
|
|
|
gdi_SetRgn(rgn1, 20, 20, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 20, 20, 100, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* region all outside clipping region, on the left */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 20, 20, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 0, 0, 0, 0);
|
2016-07-15 17:22:09 +03:00
|
|
|
draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL,
|
|
|
|
NULL);
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (draw)
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* region all outside clipping region, on the right */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 420, 420, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 0, 0, 0, 0);
|
2016-07-15 17:22:09 +03:00
|
|
|
draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL,
|
|
|
|
NULL);
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (draw)
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* region all outside clipping region, on top */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 20, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 0, 0, 0, 0);
|
2016-07-15 17:22:09 +03:00
|
|
|
draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL,
|
|
|
|
NULL);
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (draw)
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* region all outside clipping region, at the bottom */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 420, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 0, 0, 0, 0);
|
2016-07-15 17:22:09 +03:00
|
|
|
draw = gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL,
|
|
|
|
NULL);
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (draw)
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* left outside, right = clip, top = clip, bottom = clip */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 100, 300, 300, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* left outside, right inside, top = clip, bottom = clip */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 100, 300, 250, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 50, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* left = clip, right outside, top = clip, bottom = clip */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 300, 300, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* left inside, right outside, top = clip, bottom = clip */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 350, 300, 200, 100);
|
|
|
|
gdi_SetRgn(rgn2, 350, 300, 50, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* top outside, bottom = clip, left = clip, right = clip */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 100, 300, 300);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* top = clip, bottom outside, left = clip, right = clip */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 300, 100, 200);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* top = clip, bottom = clip, top = clip, bottom = clip */
|
|
|
|
gdi_SetClipRgn(hdc, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 100);
|
|
|
|
gdi_ClipCoords(hdc, &(rgn1->x), &(rgn1->y), &(rgn1->w), &(rgn1->h), NULL, NULL);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(rgn1, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2017-11-15 11:11:12 +03:00
|
|
|
rc = 0;
|
|
|
|
fail:
|
|
|
|
|
2017-12-12 12:47:17 +03:00
|
|
|
gdi_DeleteObject((HGDIOBJECT)rgn1);
|
|
|
|
gdi_DeleteObject((HGDIOBJECT)rgn2);
|
|
|
|
gdi_DeleteObject((HGDIOBJECT)bmp);
|
2017-11-15 11:11:12 +03:00
|
|
|
|
|
|
|
gdi_DeleteDC(hdc);
|
|
|
|
return rc;
|
2013-12-11 01:35:46 +04:00
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
static int test_gdi_InvalidateRegion(void)
|
2013-12-11 01:35:46 +04:00
|
|
|
{
|
2017-11-15 11:11:12 +03:00
|
|
|
int rc = -1;
|
2013-12-11 01:35:46 +04:00
|
|
|
HGDI_DC hdc;
|
2017-11-15 11:11:12 +03:00
|
|
|
HGDI_RGN rgn1 = NULL;
|
|
|
|
HGDI_RGN rgn2 = NULL;
|
|
|
|
HGDI_RGN invalid = NULL;
|
|
|
|
HGDI_BITMAP bmp = NULL;
|
2016-07-15 17:22:09 +03:00
|
|
|
const UINT32 format = PIXEL_FORMAT_XRGB32;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2015-05-08 22:39:23 +03:00
|
|
|
if (!(hdc = gdi_GetDC()))
|
|
|
|
{
|
|
|
|
printf("failed to get gdi device context\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-04-05 18:07:45 +03:00
|
|
|
hdc->format = format;
|
2016-07-15 17:22:09 +03:00
|
|
|
bmp = gdi_CreateBitmapEx(1024, 768, PIXEL_FORMAT_XRGB32, 0, NULL, NULL);
|
2013-12-11 01:35:46 +04:00
|
|
|
gdi_SelectObject(hdc, (HGDIOBJECT) bmp);
|
|
|
|
gdi_SetNullClipRgn(hdc);
|
2015-03-16 16:26:38 +03:00
|
|
|
hdc->hwnd = (HGDI_WND) calloc(1, sizeof(GDI_WND));
|
2013-12-11 01:35:46 +04:00
|
|
|
hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
|
2016-10-06 14:41:52 +03:00
|
|
|
hdc->hwnd->invalid->null = TRUE;
|
2013-12-11 01:35:46 +04:00
|
|
|
invalid = hdc->hwnd->invalid;
|
|
|
|
hdc->hwnd->count = 16;
|
2015-03-16 16:26:38 +03:00
|
|
|
hdc->hwnd->cinvalid = (HGDI_RGN) calloc(hdc->hwnd->count, sizeof(GDI_RGN));
|
2013-12-11 01:35:46 +04:00
|
|
|
rgn1 = gdi_CreateRectRgn(0, 0, 0, 0);
|
|
|
|
rgn2 = gdi_CreateRectRgn(0, 0, 0, 0);
|
2016-10-06 14:41:52 +03:00
|
|
|
rgn1->null = TRUE;
|
|
|
|
rgn2->null = TRUE;
|
2013-12-11 01:35:46 +04:00
|
|
|
/* no previous invalid region */
|
2016-10-06 14:41:52 +03:00
|
|
|
invalid->null = TRUE;
|
2013-12-11 01:35:46 +04:00
|
|
|
gdi_SetRgn(rgn1, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 100);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* region same as invalid region */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 100);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* left outside */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 100, 300, 300, 100);
|
|
|
|
gdi_SetRgn(rgn2, 100, 300, 300, 100);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* right outside */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 300, 300, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 300, 100);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* top outside */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 100, 100, 300);
|
|
|
|
gdi_SetRgn(rgn2, 300, 100, 100, 300);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* bottom outside */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 300, 100, 300);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 300);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* left outside, right outside */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 100, 300, 600, 300);
|
|
|
|
gdi_SetRgn(rgn2, 100, 300, 600, 300);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* top outside, bottom outside */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 100, 100, 500);
|
|
|
|
gdi_SetRgn(rgn2, 300, 100, 100, 500);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* all outside, left */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 100, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 100, 300, 300, 100);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* all outside, right */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 700, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 500, 100);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* all outside, top */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 100, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 100, 100, 300);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* all outside, bottom */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 300, 500, 100, 100);
|
|
|
|
gdi_SetRgn(rgn2, 300, 300, 100, 300);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* all outside */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 100, 100, 600, 600);
|
|
|
|
gdi_SetRgn(rgn2, 100, 100, 600, 600);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
2013-12-11 01:35:46 +04:00
|
|
|
|
|
|
|
/* everything */
|
|
|
|
gdi_SetRgn(invalid, 300, 300, 100, 100);
|
|
|
|
gdi_SetRgn(rgn1, 0, 0, 1024, 768);
|
|
|
|
gdi_SetRgn(rgn2, 0, 0, 1024, 768);
|
|
|
|
gdi_InvalidateRegion(hdc, rgn1->x, rgn1->y, rgn1->w, rgn1->h);
|
|
|
|
|
2015-06-26 15:32:38 +03:00
|
|
|
if (!gdi_EqualRgn(invalid, rgn2))
|
2017-11-15 11:11:12 +03:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
rc = 0;
|
|
|
|
fail:
|
|
|
|
|
2017-12-12 12:47:17 +03:00
|
|
|
gdi_DeleteObject((HGDIOBJECT)rgn1);
|
|
|
|
gdi_DeleteObject((HGDIOBJECT)rgn2);
|
|
|
|
gdi_DeleteObject((HGDIOBJECT)bmp);
|
2013-12-11 01:35:46 +04:00
|
|
|
|
2017-11-15 11:11:12 +03:00
|
|
|
gdi_DeleteDC(hdc);
|
2013-12-11 01:35:46 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int TestGdiClip(int argc, char* argv[])
|
|
|
|
{
|
2015-03-16 16:26:38 +03:00
|
|
|
fprintf(stderr, "test_gdi_ClipCoords()\n");
|
|
|
|
|
2013-12-11 01:35:46 +04:00
|
|
|
if (test_gdi_ClipCoords() < 0)
|
|
|
|
return -1;
|
|
|
|
|
2015-03-16 16:26:38 +03:00
|
|
|
fprintf(stderr, "test_gdi_InvalidateRegion()\n");
|
|
|
|
|
2013-12-11 01:35:46 +04:00
|
|
|
if (test_gdi_InvalidateRegion() < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|