mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-06 09:17:14 +00:00
gdiplus: Add GdipSetCustomLineCapStrokeCaps implementation and usage.
This commit is contained in:
parent
cd17de8827
commit
e0f32f53d5
|
@ -97,6 +97,8 @@ static GpStatus init_custom_linecap(GpCustomLineCap *cap, GpPathData *pathdata,
|
|||
|
||||
cap->inset = base_inset;
|
||||
cap->basecap = basecap;
|
||||
cap->strokeStartCap = LineCapFlat;
|
||||
cap->strokeEndCap = LineCapFlat;
|
||||
cap->join = LineJoinMiter;
|
||||
cap->scale = 1.0;
|
||||
|
||||
|
@ -177,19 +179,17 @@ GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale(GpCustomLineCap* custom,
|
|||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* custom,
|
||||
GpLineCap start, GpLineCap end)
|
||||
GpLineCap startcap, GpLineCap endcap)
|
||||
{
|
||||
static int calls;
|
||||
TRACE("(%p,%u,%u)\n", custom, startcap, endcap);
|
||||
|
||||
TRACE("(%p,%u,%u)\n", custom, start, end);
|
||||
|
||||
if(!custom)
|
||||
if(!custom || startcap > LineCapTriangle || endcap > LineCapTriangle)
|
||||
return InvalidParameter;
|
||||
|
||||
if(!(calls++))
|
||||
FIXME("not implemented\n");
|
||||
custom->strokeStartCap = startcap;
|
||||
custom->strokeEndCap = endcap;
|
||||
|
||||
return NotImplemented;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipSetCustomLineCapBaseCap(GpCustomLineCap* custom,
|
||||
|
|
|
@ -353,6 +353,8 @@ struct GpCustomLineCap{
|
|||
BOOL fill; /* TRUE for fill, FALSE for stroke */
|
||||
GpLineCap basecap; /* cap used together with customLineCap */
|
||||
REAL inset; /* distance between line end and cap beginning */
|
||||
GpLineCap strokeStartCap;
|
||||
GpLineCap strokeEndCap;
|
||||
GpLineJoin join; /* joins used for drawing custom cap*/
|
||||
REAL scale;
|
||||
};
|
||||
|
|
|
@ -2145,7 +2145,7 @@ static void add_anchor(const GpPointF *endpoint, const GpPointF *nextpoint,
|
|||
if ((custom->pathdata.Types[custom->pathdata.Count - 1] & PathPointTypeCloseSubpath) == PathPointTypeCloseSubpath)
|
||||
widen_closed_figure(tmp_points, 0, custom->pathdata.Count - 1, pen, pen_width, last_point);
|
||||
else
|
||||
widen_open_figure(tmp_points, 0, custom->pathdata.Count - 1, pen, pen_width, LineCapFlat, LineCapFlat, last_point);
|
||||
widen_open_figure(tmp_points, 0, custom->pathdata.Count - 1, pen, pen_width, custom->strokeEndCap, custom->strokeStartCap, last_point);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -380,6 +380,33 @@ static void test_captype(void)
|
|||
GdipDeleteCustomLineCap((GpCustomLineCap*)arrowcap);
|
||||
}
|
||||
|
||||
static void test_strokecap(void)
|
||||
{
|
||||
GpCustomLineCap *cap;
|
||||
GpStatus stat;
|
||||
GpPath *path;
|
||||
|
||||
/* 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, &cap);
|
||||
ok(stat == Ok, "Failed to create cap, %d\n", stat);
|
||||
|
||||
stat = GdipSetCustomLineCapStrokeCaps((GpCustomLineCap*)cap, LineCapSquare, LineCapFlat);
|
||||
ok(stat == Ok, "Unexpected return code, %d\n", stat);
|
||||
|
||||
stat = GdipSetCustomLineCapStrokeCaps((GpCustomLineCap*)cap, LineCapSquareAnchor, LineCapFlat);
|
||||
ok(stat == InvalidParameter, "Unexpected return code, %d\n", stat);
|
||||
|
||||
stat = GdipSetCustomLineCapStrokeCaps((GpCustomLineCap*)cap, LineCapFlat, LineCapSquareAnchor);
|
||||
ok(stat == InvalidParameter, "Unexpected return code, %d\n", stat);
|
||||
GdipDeleteCustomLineCap(cap);
|
||||
GdipDeletePath(path);
|
||||
}
|
||||
|
||||
START_TEST(customlinecap)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -405,6 +432,7 @@ START_TEST(customlinecap)
|
|||
test_scale();
|
||||
test_create_adjustable_cap();
|
||||
test_captype();
|
||||
test_strokecap();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue