Nikolay Sivov : gdiplus: Implemented GdipIsVisiblePathPoint with tests.

Alexandre Julliard julliard at winehq.org
Mon Feb 16 09:35:15 CST 2009


Module: wine
Branch: master
Commit: 5c316434524c8bd618f37dc14b6f26e461a97ce4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5c316434524c8bd618f37dc14b6f26e461a97ce4

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Sat Feb 14 16:38:34 2009 +0300

gdiplus: Implemented GdipIsVisiblePathPoint with tests.

---

 dlls/gdiplus/graphicspath.c       |   27 +++++++++++++++---
 dlls/gdiplus/tests/graphicspath.c |   53 +++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 5 deletions(-)

diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 4703ace..ca33082 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -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, &region);
+    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)
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index d256cac..6e257eb 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -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);
 }




More information about the wine-cvs mailing list