Commit Graph

77201 Commits

Author SHA1 Message Date
Matthias Clasen
3f6074f250 curve: Add gsk_curve_intersect
Add a way to find the intersections of two curves.
We can handle some curve-line intersections directly,
the general case is handled via bisecting.

This will be used in stroking and path ops.
2023-07-25 08:23:52 +03:00
Matthias Clasen
e350b1761a curve: Add utilities for cusps and inflections
Add functions to find cusps and inflection points of cubics.
These will be used for intersections and in the stroker.
2023-07-25 08:23:52 +03:00
Matthias Clasen
37d8677041 tools: Add gtk4-path-tool
This comes in handy for testing, among other things.

For now, this supports decomposing,
reversing, restricting, rendering and preview.
2023-07-25 08:23:52 +03:00
Benjamin Otte
1d4508a2a0 demos: Add cute maze demo 2023-07-25 08:23:52 +03:00
Benjamin Otte
5260ac6947 demos: Add a text-on-path demo 2023-07-25 08:23:52 +03:00
Benjamin Otte
ea5c4dd1df demos: Add a simple demo filling a path 2023-07-25 08:23:52 +03:00
Benjamin Otte
50ec9b849e WIP: css: Replace border rendering code with GskPath
The weight is wrong still, I need to compute the correct one to get real
45deg circle corners and not just roughly correct ones.
2023-07-25 08:23:52 +03:00
Matthias Clasen
e619ef4b81 gsk: Add tests for gsk_path_dash 2023-07-25 08:23:52 +03:00
Matthias Clasen
4e976cdd1d Add gsk_path_dash
This is a function like gsk_path_foreach, but
it provides a dashed version of the path instead
of the original.
2023-07-25 08:23:52 +03:00
Benjamin Otte
a8bd3fdb28 snapshot: Add gtk_snapshot_push_stroke()
This is the obvious GtkSnapshot API to go
along with the new stroke nodes.
2023-07-25 08:23:52 +03:00
Benjamin Otte
9f981adf67 gsk: Add GskStrokeNode
Take a rendernode as source and a GskPath and GskStroke,
and fill the area that is covered when stroking the path
with the given stroke parameters, like cairo_stroke() would.
2023-07-25 08:23:52 +03:00
Matthias Clasen
e337dd9448 Add gsk_path_get_stroke_bounds
This is a help to compute the bounds for
stroke nodes. We keep it private for now.
2023-07-25 08:23:52 +03:00
Matthias Clasen
351654bd27 Add GskStroke
A GskStroke struct collects the parameters that are
needed for stroking a path.
2023-07-25 08:23:52 +03:00
Matthias Clasen
dbf8566538 Add another curve decomposition test
This one uses GskPathMeasure to check that
our conic approximations look roughly right.
2023-07-25 08:23:52 +03:00
Matthias Clasen
98d77c04d3 Add tests for GskPathMeasure 2023-07-25 08:23:52 +03:00
Matthias Clasen
bfacbc72a0 Add GskPathMeasure
GskPathMeasure is an auxiliary object for
measuring path lengths.
2023-07-25 08:23:51 +03:00
Benjamin Otte
439f36be9f gtk: Add gtk_snapshot_push_fill()
This is the obvious GtkSnapshot API to go
along with the new fill nodes.
2023-07-25 08:23:51 +03:00
Benjamin Otte
ff2007424c gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill
the region in the path just like cairo_fill() would.
2023-07-25 08:23:51 +03:00
Matthias Clasen
fa47f63875 gsk: Add tests for GskPath 2023-07-25 08:23:51 +03:00
Matthias Clasen
3c7f4a141a gsk: Add tests for GskCurve 2023-07-25 08:23:51 +03:00
Matthias Clasen
90e50b35ee gsk: Add basic path infrastructure
This commit adds GskPath, GskPathPoint and GskPathBuilder.

GskPath is a data structure for paths that consists
of contours, which in turn might contain Bézier curves.

The data structure is inspired by Skia, with separate
arrays for points and operations. One advantage of this
arrangement is that start and end points are shared
between adjacent curves.

In addition to the usual contours comprised of Bézier
segments, GskPath supports certain special contours
directly, such as rectangles, rounded rectangles and
circles.
2023-07-25 08:23:51 +03:00
Matthias Clasen
14e3ab9672 Add a bounding box type
graphene_rect_t does not quite work for this purpose.
2023-07-23 17:34:51 -04:00
Matthias Clasen
79721d64ad filedialog: Don't assert too much
The GtkFileDialog code was asserting that
we get exactly one file back. But the function
is nullable anyway, so lets just return NULL
if we don't have a file.

Fixes: #5975
2023-07-23 12:33:47 -04:00
Benjamin Otte
0b1bcf8bee Merge branch 'wip/otte/vulkan-for-main' into 'main'
tools: No need for --force when specifying filename

See merge request GNOME/gtk!6205
2023-07-22 21:48:29 +00:00
Matthias Clasen
477fb8fdfb Merge branch 'drop-touchscreen-debug' into 'main'
Drop GTK_DEBUG_TOUCHSCREEN

Closes #5893

See merge request GNOME/gtk!6204
2023-07-22 21:48:14 +00:00
Benjamin Otte
1bd820fc60 vulkan: Clean up renderpass/offscreen creation
Instead of scale and whatnot, pass:
1. The image size
2. The viewport to map to that image size
and compute everything else from there.

In particular, we set the Vulkan viewport to the image dimensions
instead of the viewport size.

All of this makes things a lot simpler while keeping the required
functionality.
2023-07-22 23:30:15 +02:00
Benjamin Otte
a4247f1358 vulkan: Plug a memleak
This one was introduced in 4d9e7d30b0.
2023-07-22 23:30:15 +02:00
Benjamin Otte
00b5df6b06 vulkan: Plug a memleak
This one was introduced in cd84f5a56e.
2023-07-22 23:30:15 +02:00
Benjamin Otte
1e75fc35c8 tools: No need for --force when specifying filename
If people specify the filename, they should know what they're doing.

If they don't, abort if the guessed filename already exists and insist
on the user explicitly giving it.
2023-07-22 23:30:15 +02:00
Matthias Clasen
0751f59ee8 Drop GTK_DEBUG_TOUCHSCREEN
This flag was never doing much, and is only raising
the wrong expectations. Remove it.

Fixes: #5893
2023-07-22 16:43:20 -04:00
Matthias Clasen
b5b797b0aa Merge branch 'textview-keynav-backspace' into 'main'
textview: Match entry behavior for backspace

Closes #3417

See merge request GNOME/gtk!6203
2023-07-22 15:45:42 +00:00
Matthias Clasen
ddfe9f15af Merge branch 'fix-issue-5965' into 'main'
gtktextview: return early when resetting gesture / event controller

Closes #5965

See merge request GNOME/gtk!6200
2023-07-22 13:51:32 +00:00
Matthias Clasen
9929726eb2 textview: Match entry behavior for backspace
As pointed out in #3417, there is a long-standing
difference in how GtkEntry and GtkTextView treat
Ctrl-Shift-Backspace (and other variations): GtkEntry
always operates on the selection first, if it exists.
GtkTextView only handled plain Backspace that way, and
ignores the selection for other variations.

There is no good reason for this difference, so just
remove it and make GtkTextView behave the same as
GtkEntry.

Fixes: #3417
2023-07-22 09:40:17 -04:00
Ekaterine Papava
1aa6e721ae Update Georgian translation 2023-07-22 13:24:50 +00:00
Ngọc Quân Trần
87d2ce1332 Update Vietnamese translation 2023-07-22 08:54:03 +00:00
Daniel Boles
6260a33e8e Merge branch 'dboles/PopoverMenu-png' into 'main'
Fix broken image menu.png in Gtk.PopoverMenu intro

See merge request GNOME/gtk!6187
2023-07-22 08:43:25 +00:00
Daniel Boles
2024913cc2 Merge branch 'dboles/for-main' into 'main'
tools: Replace references to GTK+ with GTK no plus

See merge request GNOME/gtk!6199
2023-07-22 08:43:06 +00:00
Ngọc Quân Trần
0978a794ac Update Vietnamese translation
(cherry picked from commit e944cd8916)
2023-07-22 08:16:29 +00:00
Benjamin Otte
da51c90d5c Merge branch 'wip/otte/vulkan-for-main' into 'main'
gsk: Add gskrectprivate.h

See merge request GNOME/gtk!6201
2023-07-22 02:43:11 +00:00
Benjamin Otte
b1b8a98568 gdk: Add function to query alpha format for depth
It's meant to be used in renderers.
2023-07-22 01:33:44 +02:00
Benjamin Otte
4a8122f685 gdk: Make A8 and A16 formats premultiplied
The relevant question here is about details, because we have to choose
if we declare alpha-only formats as having their (nonexistant) color
channels premultiplied or not, so that the code paths using them can do
the right thing.

Because we are premultiplied by default, it makes sense to treat alpha
like that, because then the alpha-only code doesn't need to do
workarounds for straight alpha.

Where this is relevant of course is when expanding the alpha channel
into color channels, where we want to end up with white.
So make sure we do color = alpha there instead of color = 1 like we did
before.
2023-07-22 01:33:44 +02:00
Benjamin Otte
7a58439977 memoryformat: Copy idea from tiff code
The static assertion makes sure that newer formats get added.
2023-07-22 01:33:44 +02:00
Benjamin Otte
27fbdcbecb gdk: Add A16_FLOAT and A32_FLOAT formats
We need them for mask-only textures.

For tiffs, we convert the formats to RGBA (the idea that tiff can save
everything needs to be buried I guess) as tiffs can't do alpha-only.
2023-07-22 01:33:44 +02:00
Benjamin Otte
5bd13ccf15 vulkan: Remove unused struct 2023-07-22 01:33:44 +02:00
Benjamin Otte
d30a9e7fa9 gsk: Add gskrectprivate.h
Add a bunch of inline functions for graphene_rectangle_t.

We use those quite extensively in tight loops so making them as fast as
possible via inlining has massive benefits.

The current render-heavy benchmark I am playing (th paris-30k in node-editor)
went from 49fps to 85fps on my AMD.
2023-07-22 01:33:44 +02:00
Benjamin Otte
6e75e26a0c vulkan: Add new error code 2023-07-22 01:33:44 +02:00
Efstathios Iosifidis
6562338502 Update Greek translation
(cherry picked from commit 9d633773b0)
2023-07-21 22:29:53 +00:00
Luca Bacci
5da01ec4af gtktextview: return early when resetting gesture / event controller
Fixes #5965
2023-07-21 15:33:45 +02:00
Daniel Boles
8da96b9353 tools: Replace references to GTK+ with GTK no plus 2023-07-21 12:05:25 +01:00
Matthias Clasen
e042db9348 Merge branch 'render-tool' into 'main'
Add gtk4-render-tool

See merge request GNOME/gtk!6197
2023-07-21 10:56:14 +00:00