[PATCH] d2d: Suppress last empty segment also for D2D1_FIGURE_END_OPEN

Henri Verbeet hverbeet at gmail.com
Mon Jan 3 14:29:20 CST 2022


On Mon, 3 Jan 2022 at 17:59, Stefan Brüns <stefan.bruens at rwth-aachen.de> wrote:
> Seems my explanation was somewhat unclear ...
>
> I do not want to remove the last vertex (p3), but the last segment. In the
> current code, vertex_type[3] (using your example) for p3->p0 is always marked
> as TYPE_LINE (see EndFigure code). In case of p0 == p3, this causes troubles
> in the intersection code. In case p0 != p3, the p3->p0 segment must be a line
> (for intersection tests and filling), regardless if END_OPEN or END_CLOSED.
> The only difference between OPEN or CLOSED is the stroking of the p3->p0
> segment.
>
I think I see what you mean. You're right, we need the implicit
segment for e.g. filling, so the current d2d_geometry_intersect_self()
behaviour is correct in that regard.

> What seems to work quite fine is setting the TYPE for the last vertex
> (vertex_type[3]) to either TYPE_LINE for non-coincident p3/p0, or TYPE_END
> (newly added type) otherwise. (TYPE_NONE is already overloaded and can't be
> used.)
>
> For my current approach, see
> https://build.opensuse.org/package/view_file/
> home:StefanBruens:branches:Emulators/wine/0003-d2d1-Skip-last-empty-segment-
> in-intersection-tests.patch?expand=1&rev=19
>
I think that approach should work, yes. Alternatives would be
introducing a D2D_FIGURE_FLAG_ flag for this or just explicitly
checking for coinciding start and end vertices in
d2d_geometry_intersect_self(). Those alternatives have their
advantages and disadvantages, but ultimately are largely equivalent. I
don't have a clear favourite, so in that regard your (new) patch is
fine. I would however request to please include a small test for the
issue this fixes; both to demonstrate the issue and to prevent future
regressions.

Henri



More information about the wine-devel mailing list