gdiplus: Implement GdipIsVisiblePoint.
This commit is contained in:
parent
39f6f491a6
commit
d06dd2d7cb
|
@ -3252,7 +3252,11 @@ GpStatus WINGDIPAPI GdipIsClipEmpty(GpGraphics *graphics, BOOL *res)
|
|||
|
||||
GpStatus WINGDIPAPI GdipIsVisiblePoint(GpGraphics *graphics, REAL x, REAL y, BOOL *result)
|
||||
{
|
||||
FIXME("(%p, %.2f, %.2f, %p) stub\n", graphics, x, y, result);
|
||||
GpStatus stat;
|
||||
GpRegion* rgn;
|
||||
GpPointF pt;
|
||||
|
||||
TRACE("(%p, %.2f, %.2f, %p)\n", graphics, x, y, result);
|
||||
|
||||
if(!graphics || !result)
|
||||
return InvalidParameter;
|
||||
|
@ -3260,20 +3264,28 @@ GpStatus WINGDIPAPI GdipIsVisiblePoint(GpGraphics *graphics, REAL x, REAL y, BOO
|
|||
if(graphics->busy)
|
||||
return ObjectBusy;
|
||||
|
||||
return NotImplemented;
|
||||
pt.X = x;
|
||||
pt.Y = y;
|
||||
if((stat = GdipTransformPoints(graphics, CoordinateSpaceDevice,
|
||||
CoordinateSpaceWorld, &pt, 1)) != Ok)
|
||||
return stat;
|
||||
|
||||
if((stat = GdipCreateRegion(&rgn)) != Ok)
|
||||
return stat;
|
||||
|
||||
if((stat = get_visible_clip_region(graphics, rgn)) != Ok)
|
||||
goto cleanup;
|
||||
|
||||
stat = GdipIsVisibleRegionPoint(rgn, pt.X, pt.Y, graphics, result);
|
||||
|
||||
cleanup:
|
||||
GdipDeleteRegion(rgn);
|
||||
return stat;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipIsVisiblePointI(GpGraphics *graphics, INT x, INT y, BOOL *result)
|
||||
{
|
||||
FIXME("(%p, %d, %d, %p) stub\n", graphics, x, y, result);
|
||||
|
||||
if(!graphics || !result)
|
||||
return InvalidParameter;
|
||||
|
||||
if(graphics->busy)
|
||||
return ObjectBusy;
|
||||
|
||||
return NotImplemented;
|
||||
return GdipIsVisiblePoint(graphics, (REAL)x, (REAL)y, result);
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics* graphics,
|
||||
|
|
|
@ -1928,6 +1928,185 @@ static void test_fromMemoryBitmap(void)
|
|||
GdipDisposeImage((GpImage*)bitmap);
|
||||
}
|
||||
|
||||
static void test_GdipIsVisiblePoint(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
REAL x, y;
|
||||
BOOL val;
|
||||
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
expect(Ok, status);
|
||||
ok(graphics != NULL, "Expected graphics to be initialized\n");
|
||||
|
||||
/* null parameters */
|
||||
status = GdipIsVisiblePoint(NULL, 0, 0, &val);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipIsVisiblePoint(graphics, 0, 0, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipIsVisiblePointI(NULL, 0, 0, &val);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipIsVisiblePointI(graphics, 0, 0, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = -10;
|
||||
y = 0;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 0;
|
||||
y = -5;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 1;
|
||||
y = 1;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
status = GdipSetClipRect(graphics, 10, 20, 30, 40, CombineModeReplace);
|
||||
expect(Ok, status);
|
||||
|
||||
x = 1;
|
||||
y = 1;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 15.5;
|
||||
y = 40.5;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "After clipping, expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
/* translate into the center of the rect */
|
||||
GdipTranslateWorldTransform(graphics, 25, 40, MatrixOrderAppend);
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = 25;
|
||||
y = 40;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
GdipTranslateWorldTransform(graphics, -25, -40, MatrixOrderAppend);
|
||||
|
||||
/* corner cases */
|
||||
x = 9;
|
||||
y = 19;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 9.25;
|
||||
y = 19.25;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 9.5;
|
||||
y = 19.5;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "After clipping, expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = 9.75;
|
||||
y = 19.75;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "After clipping, expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = 10;
|
||||
y = 20;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "After clipping, expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = 40;
|
||||
y = 20;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 39;
|
||||
y = 59;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "After clipping, expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = 39.25;
|
||||
y = 59.25;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "After clipping, expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = 39.5;
|
||||
y = 39.5;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 39.75;
|
||||
y = 59.75;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 40;
|
||||
y = 60;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 40.15;
|
||||
y = 60.15;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
x = 10;
|
||||
y = 60;
|
||||
status = GdipIsVisiblePoint(graphics, x, y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
/* integer version */
|
||||
x = 25;
|
||||
y = 30;
|
||||
status = GdipIsVisiblePointI(graphics, (INT)x, (INT)y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == TRUE, "After clipping, expected (%.2f, %.2f) to be visible\n", x, y);
|
||||
|
||||
x = 50;
|
||||
y = 100;
|
||||
status = GdipIsVisiblePointI(graphics, (INT)x, (INT)y, &val);
|
||||
expect(Ok, status);
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
}
|
||||
|
||||
START_TEST(graphics)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -1955,6 +2134,7 @@ START_TEST(graphics)
|
|||
test_GdipDrawLinesI();
|
||||
test_GdipDrawString();
|
||||
test_GdipGetVisibleClipBounds();
|
||||
test_GdipIsVisiblePoint();
|
||||
test_Get_Release_DC();
|
||||
test_BeginContainer2();
|
||||
test_transformpoints();
|
||||
|
|
Loading…
Reference in New Issue