Commit Graph

98 Commits

Author SHA1 Message Date
Eric Pouech 0201606bac d2d1: Build without -DWINE_NO_LONG_TYPES.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-01 20:36:16 +01:00
Stefan Brüns ee59534f9c d2d1: Remove extraneous checks for last vertex.
The very last vertex of a figure can only be a of type LINE
(non-coincident last/first vertices) or type END (otherwise).
In case the current vertex starts a Bézier path, there is always
at least one more vertex, i.e. (vertex_idx + 1) < vertex_count
is always true.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-11 21:59:51 +01:00
Stefan Brüns b92b6c2929 d2d1: Use the TYPE_END vertex type when last/first vertices coincide.
When the last vertex is coincident with the first vertex, the last
segment should be suppressed for both END_OPEN and END_CLOSED.
Only when last and first vertex are not coincident the additional
line segment may be added - always for intersection tests and
similar, and for stroking operations when the figure is CLOSED.

Trying to use an zero-length segment in d2d_geometry_intersect_self()
will create invalid segments, causing infinite loops later.

Instead of reducing the vertex_count for coincident first/last
vertices add a dedicated type. This is required as some operations
need the last segment, others do not.

This also allows to remove some replicated code in
StrokeContains()/GetBounds()/Simplify(), as a last Bézier segment
is always processed in the regular loop.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51139
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-11 21:59:51 +01:00
Stefan Brüns 065917d101 d2d1: Refactor outline generation as preparation for the new TYPE_END vertex type.
This is a preparative patch for the next change, behaviour is
essentially unchanged, though it may be slightly faster.

Rearrange code for outline segment and join generation so it
will work for END_OPEN/END_CLOSED path, with coincident and disparate
last/first vertex.

Each vertex is now fetched once, and pivoted on the next iteration.
Also move invariants in front of the loop,

Path segments are drawn starting with the first segment, up
to vertex_count - 2 (index of start vertex). Only in case of
a END_CLOSED figure with non-coincident last/first vertex,
also the last line segment is drawn.

Joins are added between all drawn segments, and only for
END_CLOSED also the join at the first vertex is added.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-11 21:59:51 +01:00
Stefan Brüns da3fec94c1 d2d1: Silence SetSegmentFlags() FIXME when setting default value.
Some software (Buhl Tax and variants) repeatedly calls SetSegmentFlags()
with D2D1_PATH_SEGMENT_NONE, which is just the default value and has no
effect (unless the flags where already changed, which still reports
a FIXME).

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-11 21:59:51 +01:00
David White b495ff5cc8 d2d1: Implement path_geometry_StrokeContainsPoint() for Bézier segments.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 22:14:45 +01:00
David White f467f6385e d2d1: Implement path_geometry_StrokeContainsPoint() for line segments.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 22:14:45 +01:00
Nikolay Sivov 1fceac2382 d2d1: Implement d2d_rectangle_geometry_StrokeContainsPoint().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 22:14:45 +01:00
Henri Verbeet bdd49f86f5 d2d1: Store original Bézier curves as cubics.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 22:14:44 +01:00
Henri Verbeet 8718a23b2e d2d1: Check the vertex count again after duplicate removal in d2d_path_geometry_triangulate().
As the test shows, we can create geometries that have less than two vertices
after eliminating duplicates. Calling d2d_cdt_triangulate() on those would
lead to infinite recursion. In principle we could now get rid of the original
vertex count check, but it seems cheap enough that it's worth keeping in order
to avoid some unnecessary work in the somewhat more common case that we have
less than three vertices before duplicate removal.

Based on a patch by Changsheng Chen.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Nikolay Sivov 1cd678d6a0 d2d1: Implement d2d_geometry_group_GetBounds().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50411
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-03-15 20:35:26 +01:00
Biswapriyo Nath 48020f4846 include: Add missing structures in dcommon.idl.
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-06-02 22:17:37 +02:00
Connor McAdams fe4e6934a9 d2d1: Allow appending multiple Bézier control points to a figure at once.
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-20 21:32:15 +02:00
Connor McAdams e3bbeb5a93 d2d1: Allow inserting multiple Bézier control points into a figure at once.
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-20 21:32:13 +02:00
Connor McAdams a512a03100 d2d1: Introduce a helper to check for split Bézier segments.
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-20 21:32:11 +02:00
Connor McAdams 0ff58fe1ac d2d1: Introduce a helper to check for Bézier segments.
Signed-off-by: Connor McAdams <conmanx360@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-05-20 21:32:09 +02:00
Giovanni Mascellani 873e3d0691 d2d1: Implement ellipse and rounded rectangle stroking with arcs.
Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-04 18:53:40 +01:00
Giovanni Mascellani a6bf2c429e d2d1: Implement ellipse and rounded rectangle filling with arcs.
Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-03-04 18:53:37 +01:00
Giovanni Mascellani 722469254d d2d1: Ensure that hollow figures do not impact geometry bounds.
Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-30 15:58:30 +01:00
Giovanni Mascellani b728b2ff5f d2d1: Do not fill hollow figures.
Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-30 15:58:26 +01:00
Henri Verbeet 763da3f7cc d2d1: Rename d2d_ellipse_geometry_GetRoundedRect() to d2d_ellipse_geometry_GetEllipse().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-29 22:44:54 +01:00
Henri Verbeet 1fe3f60f68 d2d1: Pass previous and next vectors to d2d_geometry_outline_add_join().
Instead of the points.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-28 19:34:03 +01:00
Giovanni Mascellani aec8701399 d2d1: Implement ellipse drawing.
Currently the ellipse is approximated with quadratic Bézier curves.

Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-28 14:24:12 +01:00
Giovanni Mascellani f04bcb2d1b d2d1: Implement rounded rectangle drawing.
Currently rounded parts are approximated with quadratic Bézier curves.

Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-28 14:24:09 +01:00
Giovanni Mascellani 502c9c7603 d2d1: Fix miter drawing for degenerated rectangles.
When a rectangle side has zero length, the miter join generator is
confused because it cannot recover the join angle. This patch avoids
that by using artificially non-degenerate previous and next vertices.

Signed-off-by: Giovanni Mascellani <gio@debian.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-01-21 21:54:59 +01:00
Alexandre Julliard 3feed5a23f d2d1: Make qsort() callback functions cdecl.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-22 09:56:00 +02:00
Alexandre Julliard 239499a56d d2d1: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-30 15:04:06 +02:00
Nikolay Sivov a777fd85cb d2d1: Add ID2D1GeometryGroup stub.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-02-12 23:02:28 +01:00
Henri Verbeet ced1590255 d2d1: Introduce a debug helper for D2D1_POINT_2F.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-25 12:29:00 +02:00
Giovanni Mascellani abbffd2ee2 d2d1: Fix outline join drawing.
Calling d2d_outline_vertex_set(x, y, 0, 0, 0, 0) causes a normalize() to
be invoked with a zero vector in the vertex shader
vs_code_bezier_outline. This gives rise to an undefinite result, that in
some cases causes the join triangles to be dropped.

Tested on Debian unstable.

Signed-off-by: Giovanni Mascellani <g.mascellani@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-09 09:52:36 +02:00
Henri Verbeet fa4d5b6151 d2d1: Replace d2d_calloc() with a global heap_calloc() helper.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-02-01 22:24:49 +01:00
Henri Verbeet d9f4390488 d2d1: Use d2d_array_reserve() in d2d_clip_stack_push().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-31 17:54:55 +01:00
Henri Verbeet fdaa6d8e2a d2d1: Introduce a helper function to allocate arrays.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-31 17:54:55 +01:00
Henri Verbeet 6d8ebf1d1a d2d1: Use the global memory allocation helpers.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-01-30 20:42:06 +01:00
Henri Verbeet 24dc5c7409 d2d1: Implement radial gradient brushes.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-28 17:53:51 +02:00
Nikolay Sivov e6c18792f1 d2d1: Improve figure bounds updating for quadratic beziers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-18 14:15:58 +02:00
Nikolay Sivov 00fea0298b d2d1: Implement GetBounds() for path geometries.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-15 17:00:53 +02:00
Nikolay Sivov dcccaaf7f3 d2d1: Use better bezier segment bounds approximation when updating figure bounds.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-09-15 17:00:53 +02:00
Henri Verbeet 2187a1edb3 d2d1: Split overlapping bezier control triangles.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-18 08:07:04 +09:00
Henri Verbeet 3895f07c4b d2d1: Use segment indices in d2d_geometry_resolve_beziers().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-18 08:07:02 +09:00
Henri Verbeet 00fafb27e3 d2d1: Implement bezier/bezier intersections.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-18 08:06:59 +09:00
Henri Verbeet a4f23ea148 d2d1: Implement bezier/line intersections.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-18 08:06:57 +09:00
Henri Verbeet a5f02132d3 d2d1: Introduce a separate function for calculating line/line intersections.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-18 08:06:55 +09:00
Henri Verbeet 0ede13e1df d2d1: Return S_OK on success in d2d_geometry_resolve_beziers().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-08-18 08:06:50 +09:00
Henri Verbeet 4dcdc80ad5 d2d1: Fix the segment count for open figures.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-07 22:55:05 +02:00
Henri Verbeet 09ff685aa0 d2d1: Implement d2d_path_geometry_Simplify().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-07 22:55:02 +02:00
Henri Verbeet 208eb09e3c d2d1: Implement d2d_transformed_geometry_Simplify().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-07 22:54:59 +02:00
Henri Verbeet e5733e7cd4 d2d1: Implement d2d_rectangle_geometry_Simplify().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-02 18:41:20 +02:00
Henri Verbeet 828e62c8e2 d2d1: Implement d2d_transformed_geometry_GetBounds().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-02 18:41:19 +02:00
Henri Verbeet 2485305b55 d2d1: Implement d2d_rectangle_geometry_GetBounds().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-02 18:41:17 +02:00