[try 5][Gdiplus 5/6] Implement GdipGetRegionDataSize

Adam Petaccia adam at tpetaccia.com
Thu Jul 24 18:01:45 CDT 2008


---
 dlls/gdiplus/region.c       |   10 ++++++++--
 dlls/gdiplus/tests/region.c |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 501e81e..6c52623 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -267,9 +267,15 @@ GpStatus WINGDIPAPI GdipGetRegionData(GpRegion *region, BYTE *buffer, UINT size,
 
 GpStatus WINGDIPAPI GdipGetRegionDataSize(GpRegion *region, UINT *needed)
 {
-    FIXME("(%p, %p): stub\n", region, needed);
+    if (!(region && needed))
+        return InvalidParameter;
 
-    return NotImplemented;
+    TRACE("%p, %p\n", region, needed);
+
+    /* header.size doesn't count header.size and header.checksum */
+    *needed = region->header.size + sizeof(DWORD) * 2;
+
+    return Ok;
 }
 
 GpStatus WINGDIPAPI GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hrgn)
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index 554dab9..8c3bada 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -67,14 +67,17 @@ static void test_getregiondata(void)
     status = GdipCreateRegion(&region);
     ok(status == Ok, "status %08x\n", status);
 
-todo_wine
-{
     status = GdipGetRegionDataSize(region, &needed);
     ok(status == Ok, "status %08x\n", status);
     expect(20, needed);
+todo_wine
+{
     status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
     ok(status == Ok, "status %08x\n", status);
+}
     expect(20, needed);
+todo_wine
+{
     expect_dword(buf, 12);
     trace("buf[1] = %08x\n", buf[1]);
     expect_magic((DWORD*)(buf + 2));
@@ -87,11 +90,15 @@ todo_wine
 todo_wine
 {
     status = GdipGetRegionDataSize(region, &needed);
+}
     ok(status == Ok, "status %08x\n", status);
     expect(20, needed);
     status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+todo_wine
     ok(status == Ok, "status %08x\n", status);
     expect(20, needed);
+todo_wine
+{
     expect_dword(buf, 12);
     trace("buf[1] = %08x\n", buf[1]);
     expect_magic((DWORD*)(buf + 2));
@@ -102,13 +109,14 @@ todo_wine
     status = GdipSetInfinite(region);
     ok(status == Ok, "status %08x\n", status);
     status = GdipGetRegionDataSize(region, &needed);
-todo_wine
-{
     ok(status == Ok, "status %08x\n", status);
     expect(20, needed);
     status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+todo_wine
     ok(status == Ok, "status %08x\n", status);
     expect(20, needed);
+todo_wine
+{
     expect_dword(buf, 12);
     trace("buf[1] = %08x\n", buf[1]);
     expect_magic((DWORD*)(buf + 2));
-- 
1.5.4.3




More information about the wine-patches mailing list