[PATCH] GdiPlus: define GpHatchStyle
Hugh Bellamy
hughbellars at gmail.com
Fri Sep 15 10:44:37 CDT 2017
Fixes https://bugs.winehq.org/show_bug.cgi?id=43707
`GpHatchStyle` was missing from the definitions inside gdiplusstubs.h
(or indeed from GdiPlus.h). This means that code referring to
`GpHatchStyle` would not compile on Wine.
Signed off by: Hugh Bellamy <hughbellars at gmail.com>
---
dlls/gdiplus/brush.c | 6 +++---
dlls/gdiplus/gdiplus_private.h | 4 ++--
dlls/gdiplus/tests/brush.c | 22 ++++++++++++++++++++++
include/gdiplusflat.h | 4 ++--
include/gdiplusgpstubs.h | 1 +
5 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
index 201fadf11a..151bc71ffa 100644
--- a/dlls/gdiplus/brush.c
+++ b/dlls/gdiplus/brush.c
@@ -230,7 +230,7 @@ static const char HatchBrushes[][8] = {
{ 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff }, /* HatchStyleDarkHorizontal */
};
-GpStatus get_hatch_data(HatchStyle hatchstyle, const char **result)
+GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
{
if (hatchstyle < sizeof(HatchBrushes) / sizeof(HatchBrushes[0]))
{
@@ -244,7 +244,7 @@ GpStatus get_hatch_data(HatchStyle hatchstyle, const char **result)
/******************************************************************************
* GdipCreateHatchBrush [GDIPLUS.@]
*/
-GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
+GpStatus WINGDIPAPI GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, ARGB backcol, GpHatch **brush)
{
TRACE("(%d, %d, %d, %p)\n", hatchstyle, forecol, backcol, brush);
@@ -938,7 +938,7 @@ GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch *brush, ARGB *forecol)
return Ok;
}
-GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, HatchStyle *hatchstyle)
+GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle)
{
TRACE("(%p, %p)\n", brush, hatchstyle);
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 6bb7f88d50..33f6ceb143 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -139,7 +139,7 @@ extern GpStatus trace_path(GpGraphics *graphics, GpPath *path) DECLSPEC_HIDDEN;
typedef struct region_element region_element;
extern void delete_element(region_element *element) DECLSPEC_HIDDEN;
-extern GpStatus get_hatch_data(HatchStyle hatchstyle, const char **result) DECLSPEC_HIDDEN;
+extern GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result) DECLSPEC_HIDDEN;
static inline INT gdip_round(REAL x)
{
@@ -276,7 +276,7 @@ struct GpBrush{
struct GpHatch{
GpBrush brush;
- HatchStyle hatchstyle;
+ GpHatchStyle hatchstyle;
ARGB forecol;
ARGB backcol;
};
diff --git a/dlls/gdiplus/tests/brush.c b/dlls/gdiplus/tests/brush.c
index 045d5e5b8a..7a31e095be 100644
--- a/dlls/gdiplus/tests/brush.c
+++ b/dlls/gdiplus/tests/brush.c
@@ -1529,6 +1529,27 @@ static void test_pathgradientblend(void)
expect(Ok, status);
}
+static void test_getHatchStyle(void)
+{
+ GpStatus status;
+ GpHatch *brush;
+ GpHatchStyle hatchStyle;
+
+ GdipCreateHatchBrush(HatchStyleHorizontal, 11, 12, &brush);
+
+ status = GdipGetHatchStyle(NULL, &hatchStyle);
+ expect(InvalidParameter, status);
+
+ status = GdipGetHatchStyle(brush, NULL);
+ expect(InvalidParameter, status);
+
+ status = GdipGetHatchStyle(brush, &hatchStyle);
+ expect(Ok, status);
+ expect(HatchStyleHorizontal, hatchStyle);
+
+ GdipDeleteBrush(brush);
+}
+
START_TEST(brush)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -1578,6 +1599,7 @@ START_TEST(brush)
test_pathgradientcenterpoint();
test_pathgradientpresetblend();
test_pathgradientblend();
+ test_getHatchStyle();
GdiplusShutdown(gdiplusToken);
DestroyWindow(hwnd);
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index f2ac91e83d..8bfe8b8db9 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -387,10 +387,10 @@ GpStatus WINGDIPAPI GdipWarpPath(GpPath*,GpMatrix*,GDIPCONST GpPointF*,INT,REAL,
GpStatus WINGDIPAPI GdipWidenPath(GpPath*,GpPen*,GpMatrix*,REAL);
/* HatchBrush */
-GpStatus WINGDIPAPI GdipCreateHatchBrush(HatchStyle,ARGB,ARGB,GpHatch**);
+GpStatus WINGDIPAPI GdipCreateHatchBrush(GpHatchStyle,ARGB,ARGB,GpHatch**);
GpStatus WINGDIPAPI GdipGetHatchBackgroundColor(GpHatch*,ARGB*);
GpStatus WINGDIPAPI GdipGetHatchForegroundColor(GpHatch*,ARGB*);
-GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch*,HatchStyle*);
+GpStatus WINGDIPAPI GdipGetHatchStyle(GpHatch*,GpHatchStyle*);
/* Image */
GpStatus WINGDIPAPI GdipCloneImage(GpImage*, GpImage**);
diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h
index 5a65cd83e9..67b6ac1e34 100644
--- a/include/gdiplusgpstubs.h
+++ b/include/gdiplusgpstubs.h
@@ -95,5 +95,6 @@ typedef FlushIntention GpFlushIntention;
typedef CoordinateSpace GpCoordinateSpace;
typedef PenAlignment GpPenAlignment;
typedef PenType GpPenType;
+typedef HatchStyle GpHatchStyle;
#endif
--
2.11.0 (Apple Git-81)
More information about the wine-patches
mailing list