gdiplus: Added rendering of fill-path type custom line caps.

This commit is contained in:
Evan Stade 2007-07-20 17:50:02 -07:00 committed by Alexandre Julliard
parent 1cec4e3b6e
commit 8c5bcef9f3
2 changed files with 19 additions and 8 deletions

View File

@ -23,6 +23,9 @@
#include "gdiplus.h" #include "gdiplus.h"
#include "gdiplus_private.h" #include "gdiplus_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from, GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
GpCustomLineCap** to) GpCustomLineCap** to)
@ -52,11 +55,15 @@ GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
return Ok; return Ok;
} }
/* FIXME: Sometimes when fillPath is non-null and stroke path is null, the native
* version of this function returns NotImplemented. I cannot figure out why. */
GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath, GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath,
GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap) GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap)
{ {
GpPathData *pathdata; GpPathData *pathdata;
TRACE("%p %p %d %f %p\n", fillPath, strokePath, baseCap, baseInset, customCap);
if(!customCap || !(fillPath || strokePath)) if(!customCap || !(fillPath || strokePath))
return InvalidParameter; return InvalidParameter;

View File

@ -130,7 +130,8 @@ static void calc_curve_bezier_endp(REAL xend, REAL yend, REAL xadj, REAL yadj,
} }
/* Draws the linecap the specified color and size on the hdc. The linecap is in /* Draws the linecap the specified color and size on the hdc. The linecap is in
* direction of the line from x1, y1 to x2, y2 and is anchored on x2, y2. */ * direction of the line from x1, y1 to x2, y2 and is anchored on x2, y2. Probably
* should not be called on an hdc that has a path you care about. */
static void draw_cap(HDC hdc, COLORREF color, GpLineCap cap, REAL size, static void draw_cap(HDC hdc, COLORREF color, GpLineCap cap, REAL size,
const GpCustomLineCap *custom, REAL x1, REAL y1, REAL x2, REAL y2) const GpCustomLineCap *custom, REAL x1, REAL y1, REAL x2, REAL y2)
{ {
@ -158,7 +159,8 @@ static void draw_cap(HDC hdc, COLORREF color, GpLineCap cap, REAL size,
lb.lbColor = color; lb.lbColor = color;
lb.lbHatch = 0; lb.lbHatch = 0;
pen = ExtCreatePen(PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT, pen = ExtCreatePen(PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT,
(cap == LineCapCustom ? size : 1), &lb, 0, NULL); ((cap == LineCapCustom) && custom && (custom->fill)) ? size : 1,
&lb, 0, NULL);
oldbrush = SelectObject(hdc, brush); oldbrush = SelectObject(hdc, brush);
oldpen = SelectObject(hdc, pen); oldpen = SelectObject(hdc, pen);
@ -267,11 +269,6 @@ static void draw_cap(HDC hdc, COLORREF color, GpLineCap cap, REAL size,
if(!custom) if(!custom)
break; break;
if(custom->fill){
FIXME("fill-path custom line caps not implemented\n");
break;
}
count = custom->pathdata.Count; count = custom->pathdata.Count;
custptf = GdipAlloc(count * sizeof(PointF)); custptf = GdipAlloc(count * sizeof(PointF));
custpt = GdipAlloc(count * sizeof(POINT)); custpt = GdipAlloc(count * sizeof(POINT));
@ -294,7 +291,14 @@ static void draw_cap(HDC hdc, COLORREF color, GpLineCap cap, REAL size,
tp[i] = convert_path_point_type(custom->pathdata.Types[i]); tp[i] = convert_path_point_type(custom->pathdata.Types[i]);
} }
PolyDraw(hdc, custpt, tp, count); if(custom->fill){
BeginPath(hdc);
PolyDraw(hdc, custpt, tp, count);
EndPath(hdc);
StrokeAndFillPath(hdc);
}
else
PolyDraw(hdc, custpt, tp, count);
custend: custend:
GdipFree(custptf); GdipFree(custptf);