Nikolay Sivov : d2d1: Use better bezier segment bounds approximation when updating figure bounds.
Alexandre Julliard
julliard at winehq.org
Fri Sep 15 13:12:05 CDT 2017
Module: wine
Branch: master
Commit: dcccaaf7f3517e12e34a81925be59a54a2c9906c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=dcccaaf7f3517e12e34a81925be59a54a2c9906c
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Thu Sep 14 15:10:56 2017 +0300
d2d1: Use better bezier segment bounds approximation when updating figure bounds.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d2d1/geometry.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dlls/d2d1/geometry.c b/dlls/d2d1/geometry.c
index 8c66881..e38ac34 100644
--- a/dlls/d2d1/geometry.c
+++ b/dlls/d2d1/geometry.c
@@ -503,6 +503,14 @@ static float d2d_point_ccw(const D2D1_POINT_2F *a, const D2D1_POINT_2F *b, const
return det_d[det_d_len - 1];
}
+static void d2d_rect_union(D2D1_RECT_F *l, const D2D1_RECT_F *r)
+{
+ l->left = min(l->left, r->left);
+ l->top = min(l->top, r->top);
+ l->right = max(l->right, r->right);
+ l->bottom = max(l->bottom, r->bottom);
+}
+
static BOOL d2d_rect_check_overlap(const D2D_RECT_F *p, const D2D_RECT_F *q)
{
return p->left < q->right && p->top < q->bottom && p->right > q->left && p->bottom > q->top;
@@ -2527,6 +2535,8 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddBeziers(ID2D1GeometrySink *if
for (i = 0; i < count; ++i)
{
+ D2D1_RECT_F bezier_bounds;
+
/* FIXME: This tries to approximate a cubic bezier with a quadratic one. */
p.x = (beziers[i].point1.x + beziers[i].point2.x) * 0.75f;
p.y = (beziers[i].point1.y + beziers[i].point2.y) * 0.75f;
@@ -2534,6 +2544,9 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddBeziers(ID2D1GeometrySink *if
p.y -= (figure->vertices[figure->vertex_count - 1].y + beziers[i].point3.y) * 0.25f;
figure->vertex_types[figure->vertex_count - 1] = D2D_VERTEX_TYPE_BEZIER;
+ d2d_rect_get_bezier_bounds(&bezier_bounds, &figure->vertices[figure->vertex_count - 1],
+ &p, &beziers[i].point3);
+
if (!d2d_figure_add_bezier_control(figure, &p))
{
ERR("Failed to add bezier control.\n");
@@ -2547,6 +2560,8 @@ static void STDMETHODCALLTYPE d2d_geometry_sink_AddBeziers(ID2D1GeometrySink *if
geometry->u.path.state = D2D_GEOMETRY_STATE_ERROR;
return;
}
+
+ d2d_rect_union(&figure->bounds, &bezier_bounds);
}
geometry->u.path.segment_count += count;
More information about the wine-cvs
mailing list