[gtk/wip/baedert/css-values: 11/11] cssimagefallback: Don't snapshot invisible colors
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/css-values: 11/11] cssimagefallback: Don't snapshot invisible colors
- Date: Fri, 17 Jan 2020 15:35:34 +0000 (UTC)
commit 038f46474b8073ad585fb8361858cf825170e62f
Author: Timm Bäder <mail baedert org>
Date: Thu Jan 16 13:41:55 2020 +0100
cssimagefallback: Don't snapshot invisible colors
This avoids a few render nodes later.
gtk/gtkcssimagefallback.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcssimagefallback.c b/gtk/gtkcssimagefallback.c
index d922da942b..c6549c6bd4 100644
--- a/gtk/gtkcssimagefallback.c
+++ b/gtk/gtkcssimagefallback.c
@@ -70,15 +70,18 @@ gtk_css_image_fallback_snapshot (GtkCssImage *image,
if (fallback->used < 0)
{
- GdkRGBA red = { 1, 0, 0, 1 };
- const GdkRGBA *color;
-
if (fallback->color)
- color = gtk_css_color_value_get_rgba (fallback->color);
+ {
+ const GdkRGBA *color = gtk_css_color_value_get_rgba (fallback->color);
+ if (!gdk_rgba_is_clear (color))
+ gtk_snapshot_append_color (snapshot, color,
+ &GRAPHENE_RECT_INIT (0, 0, width, height));
+ }
else
- color = &red;
-
- gtk_snapshot_append_color (snapshot, color, &GRAPHENE_RECT_INIT (0, 0, width, height));
+ {
+ gtk_snapshot_append_color (snapshot, &(GdkRGBA) {1, 0, 0, 1},
+ &GRAPHENE_RECT_INIT (0, 0, width, height));
+ }
}
else
gtk_css_image_snapshot (fallback->images[fallback->used], snapshot, width, height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]