gdiplus: Added GdipGetCustomLineCapType().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-02-03 16:42:06 +03:00 committed by Alexandre Julliard
parent 8e4b3c0b02
commit 4e685ebb9b
6 changed files with 67 additions and 1 deletions

View File

@ -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)
{

View File

@ -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)

View File

@ -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 */

View File

@ -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);
}

View File

@ -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;

View File

@ -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**);