Commit Graph

71047 Commits

Author SHA1 Message Date
Benjamin Otte
cf3830704b icontheme: Fix variable mixup leading to crashes
Note: Don't have 2 variables named "icon" and "gicon", you will screw
them up.

reftests included.

Fixes #4269
2021-09-17 17:41:13 +00:00
Matthias Clasen
76d31ff04b Merge branch 'menu_button_a11y_improvements' into 'master'
Set correct accessible relations for GtkMenuButton

Closes #4254

See merge request GNOME/gtk!3950
2021-09-17 16:51:52 +00:00
Emmanuele Bassi
15ffd49efb Apply 4 suggestion(s) to 1 file(s) 2021-09-17 16:26:00 +00:00
Matthias Clasen
37a54eb9fc Merge branch 'matthiasc/for-master' into 'master'
gsk: Add a test for transform_bounds

See merge request GNOME/gtk!3966
2021-09-17 16:22:04 +00:00
Matthias Clasen
63647cace0 testsuite: Run the clipboard test in isolation
We can't have other test pop up windows, and possibly
stealing focus and preventing us from getting data
offers. So, run the clipboard test in isolation.
2021-09-17 11:38:28 -04:00
Matthias Clasen
bef54a382d transform: Improve docs
Add an example for reconstructing transforms.
2021-09-17 10:28:49 -04:00
Matthias Clasen
6a60214e8c gsk: Handle 2D transforms better
For 2D transforms, we can read the scale
factors more directly off the matrix.

This should eventually be moved out into a
function to decompose a 2D transform into
scale + rotation + skew + translation.
2021-09-17 10:28:49 -04:00
Matthias Clasen
27d662f1aa node editor: Preserve aspect ratio
We don't want to distort our rendering.
Tell the paintable to keep the aspect
ratio.
2021-09-17 10:28:49 -04:00
Matthias Clasen
52a8492887 rendernodepaintable: Provide accurate aspect ratio
Since we report width and height as integers, the
default implementation of this introduces rounding
errors. This shows up in the node-editor, as having
uneven scale factors like sx=1.0 and sy=1.0035.
Text nodes don't handle uneven scales like that well
and overdraw.
2021-09-17 10:28:49 -04:00
Lukáš Tyrychtr
ba5d010e39 Delete unneccessary comment and make other more descriptive 2021-09-17 15:11:26 +02:00
Matthias Clasen
8c34dd58c0 gsk: Add a test for transform_bounds 2021-09-17 07:43:07 -04:00
Matthias Clasen
0cce92ab19 Merge branch 'fix-typo' into 'master'
gtkcolorbutton: Fix documentation

See merge request GNOME/gtk!3965
2021-09-17 10:52:59 +00:00
James Westman
f95c21b67c
gtkcolorbutton: Fix documentation 2021-09-16 23:53:42 -05:00
Benjamin Otte
1d41dc716e Merge branch 'image-loading' into 'master'
Image loaders

See merge request GNOME/gtk!3939
2021-09-17 03:13:38 +00:00
Benjamin Otte
3914ecbd0f gtk-demo: Use textures in listbox example 2021-09-17 04:31:46 +02:00
Benjamin Otte
0428d8ccd6 examples: Use textures over pixbufs 2021-09-17 04:31:46 +02:00
Benjamin Otte
37a7c6780a icontheme: Implement gtk_icon_theme_lookup_by_gicon() for textures
More feature parity.

Before this, it would have worked just as well - just going via a PNG
bytes step inbetween.
2021-09-17 04:31:46 +02:00
Benjamin Otte
1b85b5597b texture: Implement GIcon and GLoadableIcon
This is mainly for feature parity with GdkPixbuf. And it doesn't hurt
anyone (I hope).
2021-09-17 04:31:46 +02:00
Benjamin Otte
fae32846c7 texture: Refactor gdk_texture_new_from_bytes()
1. Split into a real loader and a fake one

2. Only try the fake one if the real one doesn't support the file.
2021-09-17 04:31:46 +02:00
Benjamin Otte
b271a94f92 texture: Rework error enum
1. Change INSUFFICIENT_MEMORY to TOO_LARGE
   GTK crashes on insufficient memory, we don't emit GErrors.

2. Split UNSUPPORTED into UNSUPPORTED_CONTENT and UNSUPPORTED_FORMAT
   So we know if you need to find an RPM with a loader or curse and
   the weird file.

3. Translate error messages, they are meant for end users.
2021-09-17 03:25:35 +02:00
Benjamin Otte
e58f70d7bb pixbufutils: Don't hardcode formats
Just let the loaders figure out the file format themselves.
2021-09-17 02:34:15 +02:00
Benjamin Otte
4fcf54757f icontheme: Insist that people provide proper values
Seriously...
2021-09-17 02:29:59 +02:00
Benjamin Otte
b5da07f0e1 icontheme: Use textures more
We were going via GLoadablieIcon/GInputStream for everything previously
and we have no API for that with GdkTexture.

With this commit, gdk-pixbuf isn't used anymore when starting
widget-factory for anything but SVG.
2021-09-17 02:12:07 +02:00
Benjamin Otte
a85f4ec6c2 icontheme: Load textures directly when possible
This doesn't fix the codepaths for SVG (both for recoloring and
resizing) and doesn't handle streams yet.
2021-09-17 02:02:51 +02:00
Matthias Clasen
b226478e8b Support 16bit formats in the png loader
When loading, convert all >8-bit data to
GDK_MEMORY_R16G16B16A16_PREMULTIPLIED.

When saving, save all 8-bit formats as 8-bit RGBA,
and save all >8-bt formats as 16-bit RGBA.
2021-09-17 02:02:51 +02:00
Matthias Clasen
14280b5f5b contentdeserializer: Use our on jpeg loader 2021-09-17 02:02:51 +02:00
Matthias Clasen
e720f9d35d Add code to save jpegs 2021-09-17 02:02:51 +02:00
Matthias Clasen
fecb31b706 builder: Stop using pixbufutils
We can just use gdk_pixbuf_new_from_resource here.
2021-09-17 02:02:51 +02:00
Matthias Clasen
729ad8e64a cssimageurl: Just create a texture directly
We don't need to use the pixbufutils api here.
2021-09-17 02:02:51 +02:00
Matthias Clasen
dcd873a6d8 builder: create textures without pixbufs
Load textures using the GdkTexture apis, without
going through a pixbuf first.
2021-09-17 02:02:51 +02:00
Benjamin Otte
679c93e843 texture: Add private can_load() function
... and use it to load textures in gtk_picture_set_from_file().
2021-09-17 00:25:22 +02:00
Benjamin Otte
2d3de8608c texture: Split out type detection
This way, the code using it becomes clearer and we can use it in
multiple places without accidentally doing it wrong (hint: see next
commit).
2021-09-17 00:25:22 +02:00
Benjamin Otte
100b0bf7d9 texture: Remove declaration for nonexisting function 2021-09-17 00:25:22 +02:00
Matthias Clasen
f2ca9ebbd7 texture: Avoid pixbufs when loading resources
We can just use our own loaders here now.
2021-09-17 00:25:22 +02:00
Benjamin Otte
577bf104c0 testsuite: Add png and tiff methods
We encode the texture to a PNG or TIFF and then decode
it again, in various ways.
2021-09-17 00:25:22 +02:00
Benjamin Otte
b1bb7c3258 texture: Add gdk_texture_save_to_tiff_bytes() 2021-09-17 00:25:22 +02:00
Matthias Clasen
c77b5c46a3 rendernodeparser: Avoid gdk_texture_new_for_pixbuf
We can just use gdk_texture_new_from_bytes here now.

Update affected test output.
2021-09-17 00:25:22 +02:00
Matthias Clasen
5b82cf1145 rendernodeparser: Use gdk_texture_save_to_png_bytes
Avoid cairo, and use our own api for saving png data.

Update affected test output.
2021-09-17 00:25:22 +02:00
Matthias Clasen
95a0c93839 Add contentserializer tests for textures 2021-09-17 00:25:22 +02:00
Matthias Clasen
d27bc74481 Use our own loaders for content (de)serialization
Use our own loader to (de)serialiaze textures
to and from png and tiff.

We still fall back to gdk-pixbuf for handling all
the other image formats, and for pixbufs.
2021-09-17 00:25:22 +02:00
Matthias Clasen
e30b4c61cb Add tests for the jpeg loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
daf29e174f Load jpegs without gdk-pixbuf
Use our own loader for jpeg files.
2021-09-17 00:25:22 +02:00
Matthias Clasen
729ba8111a Add code to load jpegs
This lets us avoid gdk-pixbuf for loading
textures from the common image formats.

As a consequence, we are now linking against libjpeg.
2021-09-17 00:25:22 +02:00
Matthias Clasen
d30a029689 Add gdk_texture_save_to_tiff
This is a companion to gdk_texture_save_to_png, using
the tiff format, which will let us avoid lossy conversion
of HDR data, since we can store floating point data.
2021-09-17 00:25:22 +02:00
Matthias Clasen
945c2531ac Add tests for the tiff loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
f925e12e1d Load tiffs without gdk-pixbuf
This will let us load floating point data, in
the future.
2021-09-17 00:25:22 +02:00
Matthias Clasen
a03594df52 Add code to load and save tiff files
Add support for the tiff format, which is flexible
enough to handle all our memory texture formats
without loss.

As a consequence, we are now linking against libtiff.
2021-09-17 00:25:22 +02:00
Matthias Clasen
d7c8f92733 Add gdk_texture_save_to_png_bytes
Just expose what we already have available
internally, so e.g. tests can use it without
static linking.
2021-09-17 00:25:22 +02:00
Matthias Clasen
d6ce65f81c Add tests for the png loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
7949aaabb7 Save pngs without cairo
Use our own loader for pngs, which will allow
us to save e.g. 16-bit data in the future.
2021-09-17 00:25:22 +02:00