Commit 1f61f482 authored by Evan Stade's avatar Evan Stade Committed by Alexandre Julliard

gdiplus: Draw custom dashes.

parent 4e4c150b
......@@ -26,6 +26,7 @@
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
#define MAX_ARC_PTS (13)
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
COLORREF ARGB2COLORREF(ARGB color);
extern INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2,
......
......@@ -98,8 +98,9 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
{
HPEN gdipen;
REAL width;
INT save_state = SaveDC(graphics->hdc);
INT save_state = SaveDC(graphics->hdc), i, numdashes;
GpPointF pt[2];
DWORD dash_array[MAX_DASHLEN];
EndPath(graphics->hdc);
......@@ -116,7 +117,22 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
width *= pen->width * convert_unit(graphics->hdc,
pen->unit == UnitWorld ? graphics->unit : pen->unit);
gdipen = ExtCreatePen(pen->style, roundr(width), &pen->brush->lb, 0, NULL);
if(pen->dash == DashStyleCustom){
numdashes = min(pen->numdashes, MAX_DASHLEN);
TRACE("dashes are: ");
for(i = 0; i < numdashes; i++){
dash_array[i] = roundr(width * pen->dashes[i]);
TRACE("%d, ", dash_array[i]);
}
TRACE("\n and the pen style is %x\n", pen->style);
gdipen = ExtCreatePen(pen->style, roundr(width), &pen->brush->lb,
numdashes, dash_array);
}
else
gdipen = ExtCreatePen(pen->style, roundr(width), &pen->brush->lb, 0, NULL);
SelectObject(graphics->hdc, gdipen);
return save_state;
......
......@@ -29,8 +29,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
static DWORD gdip_to_gdi_dash(GpDashStyle dash)
{
static int calls;
switch(dash){
case DashStyleSolid:
return PS_SOLID;
......@@ -43,9 +41,7 @@ static DWORD gdip_to_gdi_dash(GpDashStyle dash)
case DashStyleDashDotDot:
return PS_DASHDOTDOT;
case DashStyleCustom:
if(!(calls++))
FIXME("DashStyleCustom not implemented\n");
return PS_SOLID;
return PS_USERSTYLE;
default:
ERR("Not a member of GpDashStyle enumeration\n");
return 0;
......@@ -240,7 +236,7 @@ GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash,
return OutOfMemory;
}
pen->dash = DashStyleCustom;
GdipSetPenDashStyle(pen, DashStyleCustom);
memcpy(pen->dashes, dash, count * sizeof(REAL));
pen->numdashes = count;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment