[3/3] gdiplus: Implement LineCapRound in GdipWidenPath.
Vincent Povirk
madewokherd at gmail.com
Thu Sep 20 16:52:14 CDT 2012
-------------- next part --------------
From 946bfefe218696646aef3de3a7be084a0a3c9e94 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Thu, 20 Sep 2012 16:45:36 -0500
Subject: [PATCH 3/3] gdiplus: Implement LineCapRound in GdipWidenPath.
---
dlls/gdiplus/graphicspath.c | 47 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 8b3a132..47a864b 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -1799,6 +1799,49 @@ static void widen_cap(const GpPointF *endpoint, const GpPointF *nextpoint,
break;
}
+ case LineCapRound:
+ {
+ REAL segment_dy = nextpoint->Y-endpoint->Y;
+ REAL segment_dx = nextpoint->X-endpoint->X;
+ REAL segment_length = sqrtf(segment_dy*segment_dy + segment_dx*segment_dx);
+ REAL distance = pen->width/2.0;
+ REAL dx, dy, dx2, dy2;
+ const REAL control_point_distance = 0.5522847498307935; /* 4/3 * (sqrt(2) - 1) */
+
+ if (add_first_points)
+ {
+ dx = -distance * segment_dx / segment_length;
+ dy = -distance * segment_dy / segment_length;
+
+ dx2 = dx * control_point_distance;
+ dy2 = dy * control_point_distance;
+
+ /* first 90-degree arc */
+ *last_point = add_path_list_node(*last_point, endpoint->X + dy,
+ endpoint->Y - dx, PathPointTypeLine);
+
+ *last_point = add_path_list_node(*last_point, endpoint->X + dy + dx2,
+ endpoint->Y - dx + dy2, PathPointTypeBezier);
+
+ *last_point = add_path_list_node(*last_point, endpoint->X + dx + dy2,
+ endpoint->Y + dy - dx2, PathPointTypeBezier);
+
+ /* midpoint */
+ *last_point = add_path_list_node(*last_point, endpoint->X + dx,
+ endpoint->Y + dy, PathPointTypeBezier);
+
+ /* second 90-degree arc */
+ *last_point = add_path_list_node(*last_point, endpoint->X + dx - dy2,
+ endpoint->Y + dy + dx2, PathPointTypeBezier);
+
+ *last_point = add_path_list_node(*last_point, endpoint->X - dy + dx2,
+ endpoint->Y + dx + dy2, PathPointTypeBezier);
+
+ *last_point = add_path_list_node(*last_point, endpoint->X - dy,
+ endpoint->Y + dx, PathPointTypeBezier);
+ }
+ break;
+ }
}
}
@@ -1905,10 +1948,10 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
{
last_point = points;
- if (pen->endcap > LineCapSquare)
+ if (pen->endcap > LineCapRound)
FIXME("unimplemented end cap %x\n", pen->endcap);
- if (pen->startcap > LineCapSquare)
+ if (pen->startcap > LineCapRound)
FIXME("unimplemented start cap %x\n", pen->startcap);
if (pen->dashcap != DashCapFlat)
--
1.7.9.5
More information about the wine-patches
mailing list