[gtk+] css: An opaque background does not allow omitting push_group
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: An opaque background does not allow omitting push_group
- Date: Tue, 20 Dec 2016 17:12:16 +0000 (UTC)
commit dd1cf1ac0f1f35f1d5810cbfbd445d8241f76414
Author: Benjamin Otte <otte redhat com>
Date: Tue Dec 13 23:00:26 2016 +0100
css: An opaque background does not allow omitting push_group
When the background-clip of the background is smaller than the
background-clip of blended images, not pushing a group is wrong.
Test testing exactly that included.
gtk/gtkrenderbackground.c | 9 -------
testsuite/reftests/Makefile.am | 3 ++
.../background-blend-mode-clip-interaction.css | 24 ++++++++++++++++++++
.../background-blend-mode-clip-interaction.ref.ui | 17 ++++++++++++++
.../background-blend-mode-clip-interaction.ui | 16 +++++++++++++
5 files changed, 60 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index 658bfd1..5450460 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -77,18 +77,9 @@ _gtk_theming_background_paint_color (GtkThemingBackground *bg,
static gboolean
_gtk_theming_background_needs_push_group (GtkCssStyle *style)
{
- const GdkRGBA *bg_color;
- GtkCssValue *background_color;
GtkCssValue *blend_modes;
gint i;
- background_color = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR);
- bg_color = _gtk_css_rgba_value_get_rgba (background_color);
-
- /* An opaque background-color means we don't need to push the group */
- if (bg_color->alpha == 1)
- return FALSE;
-
blend_modes = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_BLEND_MODE);
/*
diff --git a/testsuite/reftests/Makefile.am b/testsuite/reftests/Makefile.am
index f5d0a5b..c0c1bea 100644
--- a/testsuite/reftests/Makefile.am
+++ b/testsuite/reftests/Makefile.am
@@ -84,6 +84,9 @@ testdata = \
background-area.css \
background-area.ref.ui \
background-area.ui \
+ background-blend-mode-clip-interaction.css \
+ background-blend-mode-clip-interaction.ref.ui \
+ background-blend-mode-clip-interaction.ui \
background-color-transparent.css \
background-color-transparent.ref.ui \
background-color-transparent.ui \
diff --git a/testsuite/reftests/background-blend-mode-clip-interaction.css
b/testsuite/reftests/background-blend-mode-clip-interaction.css
new file mode 100644
index 0000000..227f14e
--- /dev/null
+++ b/testsuite/reftests/background-blend-mode-clip-interaction.css
@@ -0,0 +1,24 @@
+* {all: unset; }
+
+window {
+ background: lime;
+}
+
+box {
+ background-color: red;
+ background-image: linear-gradient(yellow, yellow), linear-gradient(white, white);
+ background-clip: border-box, content-box;
+ background-size: 50% 100%, 100% 50%;
+ background-repeat: no-repeat;
+ background-blend-mode: multiply;
+ padding: 10px;
+ border: 1px solid blue;
+}
+
+window#reference box {
+ background-image: linear-gradient(red,red), linear-gradient(yellow, yellow);
+ background-clip: content-box, border-box;
+ background-size: 100% 100%, 50% 100%;
+ background-color: transparent;
+ background-blend-mode: normal;
+}
diff --git a/testsuite/reftests/background-blend-mode-clip-interaction.ref.ui
b/testsuite/reftests/background-blend-mode-clip-interaction.ref.ui
new file mode 100644
index 0000000..fdedb42
--- /dev/null
+++ b/testsuite/reftests/background-blend-mode-clip-interaction.ref.ui
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="window1">
+ <property name="width_request">50</property>
+ <property name="height_request">50</property>
+ <property name="can_focus">False</property>
+ <property name="type">popup</property>
+ <property name="name">reference</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/testsuite/reftests/background-blend-mode-clip-interaction.ui
b/testsuite/reftests/background-blend-mode-clip-interaction.ui
new file mode 100644
index 0000000..82d787a
--- /dev/null
+++ b/testsuite/reftests/background-blend-mode-clip-interaction.ui
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <object class="GtkWindow" id="window1">
+ <property name="width_request">50</property>
+ <property name="height_request">50</property>
+ <property name="can_focus">False</property>
+ <property name="type">popup</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ </object>
+</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]