Commit Graph

71865 Commits

Author SHA1 Message Date
Christian Hergert
8a8e165560 gsk/gl: allow configuring atlas size 2022-04-06 23:59:47 -04:00
Christian Hergert
0ec623da09 gsk/gl: check for format as well
This could potentially happen if a uniform had never been set.
2022-04-06 23:59:47 -04:00
Christian Hergert
3b147ad630 gsk/gl: only clear glyph cache durign reclaimation
We don't need to clear the front cache on every frame as we can clear it
specifically when we do reclaimation to avoid unnecessary memset() calls.
2022-04-06 23:59:47 -04:00
Christian Hergert
615cf2a782 gsk/gl: ignore max_entry_size when zero
If the max_entry_size is zero, then assume we can add anything to the
atlas. This allows for situations where we might be uploading an arc list
to the atlas instead of pixel data for GPU font rendering.
2022-04-06 23:59:47 -04:00
Christian Hergert
f9725cc536 gsk/gl: make max-frame-age configurable
This is nice for some texture libraries that we might want to keep around
for longer than say 60 frames such as a glyph cache.
2022-04-06 23:59:47 -04:00
Matthias Clasen
468863a8b9 gtk-demo: Don't hardcode a title font
We want a large font size, but we don't have to
hardcode Sans.
2022-04-06 23:59:47 -04:00
Matthias Clasen
95a3d3c26f Add a demo for path ops 2022-04-06 23:59:17 -04:00
Matthias Clasen
df1bca3027 Add some tests for pathops 2022-04-06 23:59:17 -04:00
Matthias Clasen
acf81a0377 path: Implement path ops
Implement boolean operations on paths.
2022-04-06 23:59:17 -04:00
Matthias Clasen
bf8fca391a path: Add gsk_path_transform
This is an obvious operation to want for paths.
2022-04-06 23:57:28 -04:00
Matthias Clasen
aa722dcfac path: Add gsk_path_is_convex
Add a function to compute whether a path is convex.
2022-04-06 23:52:03 -04:00
Matthias Clasen
f5ccf63550 path: Add gsk_path_get_flags
The flags contain some useful information.
2022-04-06 23:52:03 -04:00
Matthias Clasen
61f9b1d9e0 path: Add gsk_path_reverse
This is a natural operation, and useful for debugging things.
2022-04-06 23:52:03 -04:00
Matthias Clasen
aa8ba37a0f curve: Cosmetics 2022-04-06 23:47:35 -04:00
Matthias Clasen
86c1493b4b contour: Fix winding for circle contour
Test included.
2022-04-06 23:47:35 -04:00
Matthias Clasen
f58513e4dd path: Fix gsk_path_measure_in_fill
This was getting some simple polygon cases wrong :(

The problem here is a misunderstanding in line_get_crossing.
It was returning 'on edge' when a point of the polygon is
on the ray, which is not what 'on edge' is about.

Add some test cases involving horizontal edges that coincide
with the test point.
2022-04-06 23:47:35 -04:00
Matthias Clasen
c816eee4d1 curve: Add more line-curve intersection tests 2022-04-06 23:47:35 -04:00
Matthias Clasen
436fe18084 curve: Add another intersection test 2022-04-06 23:47:35 -04:00
Matthias Clasen
3ba2659860 curve: Specify tolerance for intersections
We had 0.1 hardcoded in a bunch of places.
2022-04-06 23:47:35 -04:00
Matthias Clasen
ffc5fdb9de Add a debug key for paths
Not used yet.
2022-04-06 23:47:35 -04:00
Matthias Clasen
e88cf34642 curve: Add gsk_curve_print for debugging 2022-04-06 23:47:35 -04:00
Matthias Clasen
5eb79b3b01 curve: Move some curve apis to gskcurve.c
Some of this will be reused elsewhere, so move
it out of gskpathstroke.c.
2022-04-06 23:47:35 -04:00
Matthias Clasen
cf793f94ac curve: Use GskBoundingBox 2022-04-06 23:47:35 -04:00
Matthias Clasen
ba405bfbf1 Add a bounding box type
graphene_rect_t does not quite work for this purpose.
2022-04-06 23:47:35 -04:00
Matthias Clasen
4b6223e07d curve: Handle self-intersection 2022-04-06 23:47:35 -04:00
Matthias Clasen
8637ea8fb8 curve: Small improvement 2022-04-06 23:47:35 -04:00
Matthias Clasen
ab8a32bc76 curve: Refine line-line intersection
For collinear line segments, return up to 2 intersections
for the endpoints of the intersection (which is also a
line segment in this case).

Tests included.
2022-04-06 23:47:35 -04:00
Matthias Clasen
6aa38e6b39 curve: Fix line-curve intersections 2022-04-06 23:47:35 -04:00
Matthias Clasen
46bef9b667 curve test: Fix the split test
We were misinterpreting the return value of
gsk_path_measure_get_closest_point.
2022-04-06 23:47:35 -04:00
Matthias Clasen
86862d56bd curve: Skip a failing test
We don't have a good error bound for approximating
conics. Until that changes, skip this test.
2022-04-06 23:47:35 -04:00
Matthias Clasen
1e5c025a1e curve: Add another intersection test 2022-04-06 23:47:35 -04:00
Matthias Clasen
60f87f2a7d path: Fix a typo 2022-04-06 23:47:35 -04:00
Matthias Clasen
001903aeef contour: Add some docs 2022-04-06 23:47:35 -04:00
Matthias Clasen
3b04f5a963 Allow showing points in curve2 test
This is useful for debugging intersections.
2022-04-06 23:47:35 -04:00
Matthias Clasen
de29a01682 gsk: Use stroke bounds in the stroke node
We can use gsk_path_get_stroke_bounds to get a
better estimate for the bounds of the stroke node.
2022-04-06 23:47:35 -04:00
Matthias Clasen
bd3b88b276 gtk-demo: Use gsk_path_builder_add_layout
We have an api now to hide the cairo use.
2022-04-06 23:47:35 -04:00
Matthias Clasen
e7a9030fb5 gsk: Add gsk_path_builder_add_layout
This api makes it easy to turn text into a path that
can be further manipulated. The implementation currently
goes via cairo.
2022-04-06 23:47:35 -04:00
Matthias Clasen
98aca9e2cd curve2: Show osculating circles 2022-04-06 23:47:35 -04:00
Matthias Clasen
6e8b23d485 Add gsk_path_measure_get_curvature 2022-04-06 23:47:35 -04:00
Matthias Clasen
05678d44ca Add an interactive path test
This one is for interactive exploring of svg paths.

You can enter an SVG path in the entry and hit Enter
to see how GSK renders it. If you click the button
in the headerbar, you can see what GTK thinks the
closest point, tangent and distance are wrt. to the
mouse position, and the bounding box of the path.

There's also stroke parameters to play with.
2022-04-06 23:47:35 -04:00
Matthias Clasen
7b4bc08254 stroke: Make gsk_stroke_to_cairo public
It comes in handy, and does no harm.
2022-04-06 23:47:35 -04:00
Matthias Clasen
3b81a9e529 gtk-demo: Add a curve editor demo 2022-04-06 23:47:35 -04:00
Matthias Clasen
6a0901c40e Implement offsetting
Implement offsetting of paths by reusing the
infrastructure of the stroker.
2022-04-06 23:47:33 -04:00
Matthias Clasen
a7b3a0c472 Add gsk_path_offset
Add a function that takes a path, and offsets it
by some distance, applying line-join parameters
as needed.

This commit just adds the api, the implementation
will be in the following commit.
2022-04-06 23:47:08 -04:00
Matthias Clasen
645eddf838 stroker: Implement arcs
Implement arced joins as specified in SVG2.
2022-04-06 23:47:08 -04:00
Matthias Clasen
ada1cc7dc5 Add GSK_LINE_JOIN_ARCS
Implementation will follow.
2022-04-06 23:47:08 -04:00
Matthias Clasen
042a3a1344 Add another stroker test
Check that the outlines of random paths look as
expected. We currently have to exclude paths where
points get too close to each other.
2022-04-06 23:47:08 -04:00
Matthias Clasen
2542d913bc Add basic tests for strokes
Add tests to check that any point on a path is
always at most half the line-width away from the
stroke path with that line-width.
2022-04-06 23:47:08 -04:00
Matthias Clasen
fc619b9783 Implement stroking
Implement gsk_contour_default_add_stroke, which takes a contour
and stroke parameters, and adds contours to a path builder for
the outline that would be produced by stroking the path with these
parameters.

The current implementation does not try to handle short segments
in the vicinity of sharp joins in any special way, so there can
be some artifacts in that situation.
2022-04-06 23:47:06 -04:00
Matthias Clasen
3c56f326fc Special-case circles for strokes
The outline of a circle is just two circles.
2021-12-04 22:58:23 -05:00