Nikolay Sivov : gdiplus: Added GdipGetCustomLineCapType().
Alexandre Julliard
julliard at winehq.org
Fri Feb 3 13:31:34 CST 2017
Module: wine
Branch: master
Commit: 4e685ebb9bf3cb2f2a1c33975acdee96ac984d45
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4e685ebb9bf3cb2f2a1c33975acdee96ac984d45
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Feb 3 16:42:06 2017 +0300
gdiplus: Added GdipGetCustomLineCapType().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdiplus/customlinecap.c | 12 ++++++++++
dlls/gdiplus/gdiplus.spec | 2 +-
dlls/gdiplus/gdiplus_private.h | 1 +
dlls/gdiplus/tests/customlinecap.c | 45 ++++++++++++++++++++++++++++++++++++++
include/gdiplusenums.h | 7 ++++++
include/gdiplusflat.h | 1 +
6 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/dlls/gdiplus/customlinecap.c b/dlls/gdiplus/customlinecap.c
index 9f4eb40..ca81bee 100644
--- a/dlls/gdiplus/customlinecap.c
+++ b/dlls/gdiplus/customlinecap.c
@@ -77,6 +77,7 @@ GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath
*customCap = heap_alloc_zero(sizeof(GpCustomLineCap));
if(!*customCap) return OutOfMemory;
+ (*customCap)->type = CustomLineCapTypeDefault;
if(strokePath){
(*customCap)->fill = FALSE;
pathdata = &strokePath->pathdata;
@@ -245,6 +246,17 @@ GpStatus WINGDIPAPI GdipGetCustomLineCapBaseCap(GpCustomLineCap *customCap, GpLi
return Ok;
}
+GpStatus WINGDIPAPI GdipGetCustomLineCapType(GpCustomLineCap *customCap, CustomLineCapType *type)
+{
+ TRACE("(%p, %p)\n", customCap, type);
+
+ if(!customCap || !type)
+ return InvalidParameter;
+
+ *type = customCap->type;
+ return Ok;
+}
+
GpStatus WINGDIPAPI GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL fill,
GpAdjustableArrowCap **cap)
{
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 98167af..8cf5ab3 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -240,7 +240,7 @@
240 stdcall GdipGetCustomLineCapBaseInset(ptr ptr)
241 stub GdipGetCustomLineCapStrokeCaps
242 stdcall GdipGetCustomLineCapStrokeJoin(ptr ptr)
-243 stub GdipGetCustomLineCapType
+243 stdcall GdipGetCustomLineCapType(ptr ptr)
244 stdcall GdipGetCustomLineCapWidthScale(ptr ptr)
245 stdcall GdipGetDC(ptr ptr)
246 stdcall GdipGetDpiX(ptr ptr)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 340e9bd..b44340f 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -327,6 +327,7 @@ struct GpPathIterator{
};
struct GpCustomLineCap{
+ CustomLineCapType type;
GpPathData pathdata;
BOOL fill; /* TRUE for fill, FALSE for stroke */
GpLineCap cap; /* as far as I can tell, this value is ignored */
diff --git a/dlls/gdiplus/tests/customlinecap.c b/dlls/gdiplus/tests/customlinecap.c
index c2a1dab..704f70e 100644
--- a/dlls/gdiplus/tests/customlinecap.c
+++ b/dlls/gdiplus/tests/customlinecap.c
@@ -267,6 +267,50 @@ todo_wine
GdipDeleteCustomLineCap((GpCustomLineCap*)cap);
}
+static void test_captype(void)
+{
+ GpAdjustableArrowCap *arrowcap;
+ GpCustomLineCap *custom;
+ CustomLineCapType type;
+ GpStatus stat;
+ GpPath *path;
+
+ stat = GdipGetCustomLineCapType(NULL, NULL);
+ ok(stat == InvalidParameter, "Unexpected return code, %d\n", stat);
+
+ type = 10;
+ stat = GdipGetCustomLineCapType(NULL, &type);
+ ok(stat == InvalidParameter, "Unexpected return code, %d\n", stat);
+ ok(type == 10, "Unexpected cap type, %d\n", type);
+
+ /* default cap */
+ stat = GdipCreatePath(FillModeAlternate, &path);
+ ok(stat == Ok, "Failed to create path, %d\n", stat);
+ stat = GdipAddPathRectangle(path, 5.0, 5.0, 10.0, 10.0);
+ ok(stat == Ok, "AddPathRectangle failed, %d\n", stat);
+
+ stat = GdipCreateCustomLineCap(NULL, path, LineCapFlat, 0.0, &custom);
+ ok(stat == Ok, "Failed to create cap, %d\n", stat);
+ stat = GdipGetCustomLineCapType(custom, &type);
+ ok(stat == Ok, "Failed to get cap type, %d\n", stat);
+ ok(type == CustomLineCapTypeDefault, "Unexpected cap type %d\n", stat);
+ GdipDeleteCustomLineCap(custom);
+ GdipDeletePath(path);
+
+ /* arrow cap */
+ stat = GdipCreateAdjustableArrowCap(17.0, 15.0, TRUE, &arrowcap);
+todo_wine
+ ok(stat == Ok, "Failed to create adjustable cap, %d\n", stat);
+ if (stat != Ok)
+ return;
+
+ stat = GdipGetCustomLineCapType((GpCustomLineCap*)arrowcap, &type);
+ ok(stat == Ok, "Failed to get cap type, %d\n", stat);
+ ok(type == CustomLineCapTypeAdjustableArrow, "Unexpected cap type %d\n", stat);
+
+ GdipDeleteCustomLineCap((GpCustomLineCap*)arrowcap);
+}
+
START_TEST(customlinecap)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -284,6 +328,7 @@ START_TEST(customlinecap)
test_inset();
test_scale();
test_create_adjustable_cap();
+ test_captype();
GdiplusShutdown(gdiplusToken);
}
diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h
index 1b1db6f..905a87a 100644
--- a/include/gdiplusenums.h
+++ b/include/gdiplusenums.h
@@ -73,6 +73,12 @@ enum LineCap
LineCapAnchorMask = 0xf0
};
+enum CustomLineCapType
+{
+ CustomLineCapTypeDefault = 0,
+ CustomLineCapTypeAdjustableArrow = 1
+};
+
enum PathPointType{
PathPointTypeStart = 0, /* start of a figure */
PathPointTypeLine = 1,
@@ -712,6 +718,7 @@ typedef enum BrushType BrushType;
typedef enum DriverStringOptions DriverStringOptions;
typedef enum FillMode FillMode;
typedef enum LineCap LineCap;
+typedef enum CustomLineCapType CustomLineCapType;
typedef enum PathPointType PathPointType;
typedef enum LineJoin LineJoin;
typedef enum QualityMode QualityMode;
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 101d73d..6e5b23f 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -94,6 +94,7 @@ GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeJoin(GpCustomLineCap*,GpLineJoin);
GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale(GpCustomLineCap*,REAL*);
GpStatus WINGDIPAPI GdipSetCustomLineCapWidthScale(GpCustomLineCap*,REAL);
GpStatus WINGDIPAPI GdipSetCustomLineCapBaseInset(GpCustomLineCap*,REAL);
+GpStatus WINGDIPAPI GdipGetCustomLineCapType(GpCustomLineCap*,CustomLineCapType*);
/* Font */
GpStatus WINGDIPAPI GdipCloneFont(GpFont*,GpFont**);
More information about the wine-cvs
mailing list