gdiplus: Implemented GdipSetClipRegion with basic tests.
This commit is contained in:
parent
fb57a66378
commit
0df5fb50f7
|
@ -2737,14 +2737,17 @@ GpStatus WINGDIPAPI GdipSetClipRectI(GpGraphics *graphics, INT x, INT y,
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region,
|
GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics *graphics, GpRegion *region,
|
||||||
CombineMode combineMode)
|
CombineMode mode)
|
||||||
{
|
{
|
||||||
static int calls;
|
TRACE("(%p, %p, %d)\n", graphics, region, mode);
|
||||||
|
|
||||||
if(!(calls++))
|
if(!graphics || !region)
|
||||||
FIXME("not implemented\n");
|
return InvalidParameter;
|
||||||
|
|
||||||
return NotImplemented;
|
if(graphics->busy)
|
||||||
|
return ObjectBusy;
|
||||||
|
|
||||||
|
return GdipCombineRegionRegion(graphics->clip, region, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile,
|
GpStatus WINGDIPAPI GdipSetMetafileDownLevelRasterizationLimit(GpMetafile *metafile,
|
||||||
|
|
|
@ -485,6 +485,7 @@ static void test_Get_Release_DC(void)
|
||||||
GpPoint pt[5];
|
GpPoint pt[5];
|
||||||
GpRectF rectf[2];
|
GpRectF rectf[2];
|
||||||
GpRect rect[2];
|
GpRect rect[2];
|
||||||
|
GpRegion *clip;
|
||||||
INT i;
|
INT i;
|
||||||
|
|
||||||
pt[0].X = 10;
|
pt[0].X = 10;
|
||||||
|
@ -523,6 +524,7 @@ static void test_Get_Release_DC(void)
|
||||||
GdipCreateRegion(®ion);
|
GdipCreateRegion(®ion);
|
||||||
GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
|
GdipCreateSolidFill((ARGB)0xdeadbeef, &brush);
|
||||||
GdipCreatePath(FillModeAlternate, &path);
|
GdipCreatePath(FillModeAlternate, &path);
|
||||||
|
GdipCreateRegion(&clip);
|
||||||
|
|
||||||
status = GdipCreateFromHDC(hdc, &graphics);
|
status = GdipCreateFromHDC(hdc, &graphics);
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
|
@ -702,7 +704,8 @@ static void test_Get_Release_DC(void)
|
||||||
expect(ObjectBusy, status); status = Ok;
|
expect(ObjectBusy, status); status = Ok;
|
||||||
status = GdipSetClipRectI(graphics, 0, 0, 10, 10, CombineModeReplace);
|
status = GdipSetClipRectI(graphics, 0, 0, 10, 10, CombineModeReplace);
|
||||||
expect(ObjectBusy, status); status = Ok;
|
expect(ObjectBusy, status); status = Ok;
|
||||||
/* GdipSetClipRegion */
|
status = GdipSetClipRegion(graphics, clip, CombineModeReplace);
|
||||||
|
expect(ObjectBusy, status);
|
||||||
status = GdipDrawPolygon(graphics, pen, ptf, 5);
|
status = GdipDrawPolygon(graphics, pen, ptf, 5);
|
||||||
expect(ObjectBusy, status); status = Ok;
|
expect(ObjectBusy, status); status = Ok;
|
||||||
status = GdipDrawPolygonI(graphics, pen, pt, 5);
|
status = GdipDrawPolygonI(graphics, pen, pt, 5);
|
||||||
|
@ -730,6 +733,7 @@ static void test_Get_Release_DC(void)
|
||||||
GdipDeleteBrush((GpBrush*)brush);
|
GdipDeleteBrush((GpBrush*)brush);
|
||||||
GdipDeleteRegion(region);
|
GdipDeleteRegion(region);
|
||||||
GdipDeleteMatrix(m);
|
GdipDeleteMatrix(m);
|
||||||
|
GdipDeleteRegion(region);
|
||||||
|
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(0, hdc);
|
||||||
}
|
}
|
||||||
|
@ -764,7 +768,7 @@ static void test_transformpoints(void)
|
||||||
ReleaseDC(0, hdc);
|
ReleaseDC(0, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_getclip(void)
|
static void test_get_set_clip(void)
|
||||||
{
|
{
|
||||||
GpStatus status;
|
GpStatus status;
|
||||||
GpGraphics *graphics = NULL;
|
GpGraphics *graphics = NULL;
|
||||||
|
@ -789,6 +793,11 @@ static void test_getclip(void)
|
||||||
status = GdipGetClip(NULL, clip);
|
status = GdipGetClip(NULL, clip);
|
||||||
expect(InvalidParameter, status);
|
expect(InvalidParameter, status);
|
||||||
|
|
||||||
|
status = GdipSetClipRegion(NULL, NULL, CombineModeReplace);
|
||||||
|
expect(InvalidParameter, status);
|
||||||
|
status = GdipSetClipRegion(graphics, NULL, CombineModeReplace);
|
||||||
|
expect(InvalidParameter, status);
|
||||||
|
|
||||||
res = FALSE;
|
res = FALSE;
|
||||||
status = GdipGetClip(graphics, clip);
|
status = GdipGetClip(graphics, clip);
|
||||||
expect(Ok, status);
|
expect(Ok, status);
|
||||||
|
@ -823,7 +832,7 @@ START_TEST(graphics)
|
||||||
test_GdipDrawLinesI();
|
test_GdipDrawLinesI();
|
||||||
test_Get_Release_DC();
|
test_Get_Release_DC();
|
||||||
test_transformpoints();
|
test_transformpoints();
|
||||||
test_getclip();
|
test_get_set_clip();
|
||||||
|
|
||||||
GdiplusShutdown(gdiplusToken);
|
GdiplusShutdown(gdiplusToken);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,7 @@ GpStatus WINGDIPAPI GdipFillRectangles(GpGraphics*,GpBrush*,GDIPCONST GpRectF*,I
|
||||||
GpStatus WINGDIPAPI GdipFillRectanglesI(GpGraphics*,GpBrush*,GDIPCONST GpRect*,INT);
|
GpStatus WINGDIPAPI GdipFillRectanglesI(GpGraphics*,GpBrush*,GDIPCONST GpRect*,INT);
|
||||||
GpStatus WINGDIPAPI GdipGetCompositingMode(GpGraphics*,CompositingMode*);
|
GpStatus WINGDIPAPI GdipGetCompositingMode(GpGraphics*,CompositingMode*);
|
||||||
GpStatus WINGDIPAPI GdipGetClip(GpGraphics*,GpRegion*);
|
GpStatus WINGDIPAPI GdipGetClip(GpGraphics*,GpRegion*);
|
||||||
|
GpStatus WINGDIPAPI GdipSetClipRegion(GpGraphics*,GpRegion*,CombineMode);
|
||||||
GpStatus WINGDIPAPI GdipGetCompositingQuality(GpGraphics*,CompositingQuality*);
|
GpStatus WINGDIPAPI GdipGetCompositingQuality(GpGraphics*,CompositingQuality*);
|
||||||
GpStatus WINGDIPAPI GdipGetDC(GpGraphics*,HDC*);
|
GpStatus WINGDIPAPI GdipGetDC(GpGraphics*,HDC*);
|
||||||
GpStatus WINGDIPAPI GdipGetImageDimension(GpImage*,REAL*,REAL*);
|
GpStatus WINGDIPAPI GdipGetImageDimension(GpImage*,REAL*,REAL*);
|
||||||
|
|
Loading…
Reference in New Issue