[v2 PATCH] gdiplus: Implement stub for GdipGraphicsSetAbort
Andrew Eikum
aeikum at codeweavers.com
Thu Jul 27 08:35:33 CDT 2017
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
---
v2: Fix releasing resources in tests.
I looked into adding a GdiplusAbort struct in the tests, but we don't
already have a definition for this struct, and it's a C++ object, so I
just left this the same as the GdipImageSetAbort tests. If we ever
implement this function, we can add real tests for it then.
dlls/gdiplus/gdiplus.spec | 2 +-
dlls/gdiplus/graphics.c | 13 +++++++++++++
dlls/gdiplus/tests/graphics.c | 34 ++++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 1 +
4 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index dd8d9098a5..25b27e71eb 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -622,7 +622,7 @@
622 stdcall GdipBitmapGetHistogramSize(long ptr)
623 stdcall GdipBitmapConvertFormat(ptr long long long ptr float)
624 stdcall GdipImageSetAbort(ptr ptr)
-625 stub GdipGraphicsSetAbort
+625 stdcall GdipGraphicsSetAbort(ptr ptr)
626 stub GdipDrawImageFX
627 stdcall GdipConvertToEmfPlus(ptr ptr ptr long ptr ptr)
628 stdcall GdipConvertToEmfPlusToFile(ptr ptr ptr ptr long ptr ptr)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 543593e63c..4b2ae49884 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -7147,3 +7147,16 @@ GpStatus WINGDIPAPI GdipResetPageTransform(GpGraphics *graphics)
return NotImplemented;
}
+
+GpStatus WINGDIPAPI GdipGraphicsSetAbort(GpGraphics *graphics, GdiplusAbort *pabort)
+{
+ TRACE("(%p, %p)\n", graphics, pabort);
+
+ if (!graphics)
+ return InvalidParameter;
+
+ if (pabort)
+ FIXME("Abort callback is not supported.\n");
+
+ return Ok;
+}
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 4dcfac8c19..680218472b 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -29,6 +29,8 @@
#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
#define expectf(expected, got) expectf_((expected), (got), 0.001)
+static GpStatus (WINAPI *pGdipGraphicsSetAbort)(GpGraphics*,GdiplusAbort*);
+
static const REAL mm_per_inch = 25.4;
static const REAL point_per_inch = 72.0;
static HWND hwnd;
@@ -6149,11 +6151,40 @@ static void test_container_rects(void)
ReleaseDC(hwnd, hdc);
}
+static void test_GdipGraphicsSetAbort(void)
+{
+ HDC hdc;
+ GpStatus status;
+ GpGraphics *graphics;
+
+ if (!pGdipGraphicsSetAbort)
+ {
+ win_skip("GdipGraphicsSetAbort() is not supported.\n");
+ return;
+ }
+
+ hdc = GetDC(hwnd);
+
+ status = GdipCreateFromHDC(hdc, &graphics);
+ expect(Ok, status);
+
+ status = pGdipGraphicsSetAbort(NULL, NULL);
+ expect(InvalidParameter, status);
+
+ status = pGdipGraphicsSetAbort(graphics, NULL);
+ expect(Ok, status);
+
+ GdipDeleteGraphics(graphics);
+
+ ReleaseDC(hwnd, hdc);
+}
+
START_TEST(graphics)
{
struct GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
WNDCLASSA class;
+ HMODULE gdiplus_mod = GetModuleHandleA("gdiplus.dll");
HMODULE hmsvcrt;
int (CDECL * _controlfp_s)(unsigned int *cur, unsigned int newval, unsigned int mask);
@@ -6162,6 +6193,8 @@ START_TEST(graphics)
_controlfp_s = (void*)GetProcAddress(hmsvcrt, "_controlfp_s");
if (_controlfp_s) _controlfp_s(0, 0, 0x0008001e);
+ pGdipGraphicsSetAbort = (void*)GetProcAddress(gdiplus_mod, "GdipGraphicsSetAbort");
+
memset( &class, 0, sizeof(class) );
class.lpszClassName = "gdiplus_test";
class.style = CS_HREDRAW | CS_VREDRAW;
@@ -6230,6 +6263,7 @@ START_TEST(graphics)
test_GdipFillRectangles();
test_GdipGetVisibleClipBounds_memoryDC();
test_container_rects();
+ test_GdipGraphicsSetAbort();
GdiplusShutdown(gdiplusToken);
DestroyWindow( hwnd );
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 6e5b23fb2c..10d537a017 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -263,6 +263,7 @@ GpStatus WINGDIPAPI GdipGetTextContrast(GpGraphics*,UINT*);
GpStatus WINGDIPAPI GdipGetTextRenderingHint(GpGraphics*,TextRenderingHint*);
GpStatus WINGDIPAPI GdipGetWorldTransform(GpGraphics*,GpMatrix*);
GpStatus WINGDIPAPI GdipGraphicsClear(GpGraphics*,ARGB);
+GpStatus WINGDIPAPI GdipGraphicsSetAbort(GpGraphics*,GdiplusAbort*);
GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics*,GpRectF*);
GpStatus WINGDIPAPI GdipGetVisibleClipBoundsI(GpGraphics*,GpRect*);
GpStatus WINGDIPAPI GdipIsClipEmpty(GpGraphics*, BOOL*);
--
2.13.3
More information about the wine-patches
mailing list