gdiplus: Implemented GdipIsVisiblePathPoint with tests.
This commit is contained in:
parent
820981b39d
commit
5c31643452
|
@ -1384,16 +1384,33 @@ GpStatus WINGDIPAPI GdipIsVisiblePathPointI(GpPath* path, INT x, INT y, GpGraphi
|
|||
return GdipIsVisiblePathPoint(path, x, y, graphics, result);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* GdipIsVisiblePathPoint [GDIPLUS.@]
|
||||
*/
|
||||
GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, GpGraphics *graphics, BOOL *result)
|
||||
{
|
||||
static int calls;
|
||||
GpRegion *region;
|
||||
HRGN hrgn;
|
||||
GpStatus status;
|
||||
|
||||
if(!path) return InvalidParameter;
|
||||
if(!path || !result) return InvalidParameter;
|
||||
|
||||
if(!(calls++))
|
||||
FIXME("not implemented\n");
|
||||
status = GdipCreateRegionPath(path, ®ion);
|
||||
if(status != Ok)
|
||||
return status;
|
||||
|
||||
return NotImplemented;
|
||||
status = GdipGetRegionHRgn(region, graphics, &hrgn);
|
||||
if(status != Ok){
|
||||
GdipDeleteRegion(region);
|
||||
return status;
|
||||
}
|
||||
|
||||
*result = PtInRegion(hrgn, roundr(x), roundr(y));
|
||||
|
||||
DeleteObject(hrgn);
|
||||
GdipDeleteRegion(region);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipStartPathFigure(GpPath *path)
|
||||
|
|
|
@ -1057,6 +1057,58 @@ static void test_flatten(void)
|
|||
GdipDeletePath(path);
|
||||
}
|
||||
|
||||
static void test_isvisible(void)
|
||||
{
|
||||
GpPath *path;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
BOOL result;
|
||||
GpStatus status;
|
||||
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
expect(Ok, status);
|
||||
status = GdipCreatePath(FillModeAlternate, &path);
|
||||
expect(Ok, status);
|
||||
|
||||
/* NULL */
|
||||
status = GdipIsVisiblePathPoint(NULL, 0.0, 0.0, NULL, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
status = GdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
/* empty path */
|
||||
result = TRUE;
|
||||
status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, &result);
|
||||
expect(Ok, status);
|
||||
expect(FALSE, result);
|
||||
/* rect */
|
||||
status = GdipAddPathRectangle(path, 0.0, 0.0, 10.0, 10.0);
|
||||
expect(Ok, status);
|
||||
result = FALSE;
|
||||
status = GdipIsVisiblePathPoint(path, 0.0, 0.0, NULL, &result);
|
||||
expect(Ok, status);
|
||||
expect(TRUE, result);
|
||||
result = TRUE;
|
||||
status = GdipIsVisiblePathPoint(path, 11.0, 11.0, NULL, &result);
|
||||
expect(Ok, status);
|
||||
expect(FALSE, result);
|
||||
/* not affected by clipping */
|
||||
status = GdipSetClipRect(graphics, 5.0, 5.0, 5.0, 5.0, CombineModeReplace);
|
||||
expect(Ok, status);
|
||||
result = FALSE;
|
||||
status = GdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, &result);
|
||||
expect(Ok, status);
|
||||
expect(TRUE, result);
|
||||
|
||||
GdipDeletePath(path);
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
}
|
||||
|
||||
START_TEST(graphicspath)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -1085,6 +1137,7 @@ START_TEST(graphicspath)
|
|||
test_reverse();
|
||||
test_addpie();
|
||||
test_flatten();
|
||||
test_isvisible();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue