Commit Graph

17 Commits

Author SHA1 Message Date
Matthias Clasen
69f12ed6a5 Avoid a crash without librsvg
gtk_css_image_recolor_load_texture may leave
recolor->text as NULL without setting error.
No need to crash for that.
2019-04-18 00:13:53 +00:00
Benjamin Otte
1cd9396154 css: Review error messages
... and move them from _gtk_css_parser_error() to the proper new error
message.
2019-04-12 19:34:28 +02:00
Benjamin Otte
607502ef43 cssparser: Add gtk_css_parser_consume_url()
Another slight renaming and semantics change.
2019-04-12 19:34:28 +02:00
Benjamin Otte
45bc4ed321 cssimagerecolor: Use gtk_css_parser_consume_function() 2019-04-12 19:34:28 +02:00
Benjamin Otte
a938c14d11 build: Add gtk-css static library
This library is meant to be the new CSS library that gets used from GDK,
GSK and GTK for string printing and parsing.

As a first step, move GtkCssProviderError into it.

While doing so, split it into GtkCssParserError (for critical problems)
and GtkCssParserWarning (for non-critical problems).
2019-04-12 19:34:28 +02:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Benjamin Otte
3faa7e04db cssimage: Add GtkCssImagePaintable
This type can hold any GdkPaintable.

Use it to replace GtkCssImageSurface, which used to hold a GdkTexture.
2018-03-16 06:04:44 +01:00
Matthias Clasen
2edd3741f6 Use the new texture utils here
One less place where we juggle pixbufs.
2017-11-30 07:54:52 -05:00
Matthias Clasen
7aa236fbb2 Fix a compiler warning 2017-11-08 22:09:34 -05:00
Matthias Clasen
c83665005a Use color matrices for -gtk-recolor
Use the same approach we take for recoloring in GtkIconHelper now.
As part of this change, GtkCsSImageRecolor is changed to not derive
from GtkCssImageUrl anymore.
2017-11-08 10:04:38 -05:00
Benjamin Otte
83fb7a649f css: Merge GtkStyleProviderPrivate into GtkStyleProvider
This is just lots of renaming.

The interface remains private, so the public API does not change, apart
from removing the definition of the Interface object to avoid
subclassing.
2017-10-31 04:33:54 +01:00
Benjamin Otte
ed6643cf69 cssimage: Use textures in GtkCssImageSurface
We now use textures instead of surfaces and implement the snapshot()
vfunc instead of draw().
2016-12-20 18:01:10 +01:00
Matthias Clasen
0fe468c789 Emit an error if image loading fails
Instead of spamming stderr with g_warning, use the new
emit_error method of the GtkStyleProviderPrivate interface
to emit an error if loading an image fails.
2016-01-30 00:29:04 -05:00
Matthias Clasen
b281c9d740 css image recolor: Load images at the proper scale
We should not hardcode a scale of 1, this leads to
pixellated upscaled images at scale=2, even if the source
is an svg. By passing the proper scale, we can load the
svg at the correct size.
2016-01-29 17:30:10 -05:00
Matthias Clasen
77a6d976b2 css: Fix refcounting thinko in -gtk-recolor
gtk_css_style_get_value does not return a reference.
So don't unref the return value without taking one.
2016-01-21 08:42:55 -05:00
Matthias Clasen
419f2c670d css: Handle image loading errors graciously
If we fail to load the image for a -gtk-recolor() expression,
fall back to using the image-missing icon instead of crashing,
and include more details in the warning message.
2016-01-21 08:19:37 -05:00
Matthias Clasen
beec55a22b Add a way to load recolored icons in CSS
This can come in handy to load images that are not in an icon theme,
but still benefit from symbolic recoloring.

https://bugzilla.gnome.org/show_bug.cgi?id=760536
2016-01-14 13:51:15 -05:00