rendernode: Shadow nodes need offscreen for opacity
authorBenjamin Otte <otte@redhat.com>
Thu, 7 Sep 2023 20:57:57 +0000 (22:57 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 19 Sep 2023 20:32:27 +0000 (16:32 -0400)
Otherwise the shadow will not be properly computed as opaque regions
become translucent after applying opacity.

Testcase included.

gsk/gskrendernodeimpl.c
testsuite/gsk/compare/shadow-opacity.node [new file with mode: 0644]
testsuite/gsk/compare/shadow-opacity.png [new file with mode: 0644]
testsuite/gsk/meson.build

index 08bdc58e4711832bd7a513483bd528bc28816c93..80bf406ae32ca0bf46e8e1adef27cad4c5618616 100644 (file)
@@ -4593,7 +4593,7 @@ gsk_shadow_node_new (GskRenderNode   *child,
 
   self = gsk_render_node_alloc (GSK_SHADOW_NODE);
   node = (GskRenderNode *) self;
-  node->offscreen_for_opacity = child->offscreen_for_opacity;
+  node->offscreen_for_opacity = TRUE;
 
   self->child = gsk_render_node_ref (child);
   self->n_shadows = n_shadows;
diff --git a/testsuite/gsk/compare/shadow-opacity.node b/testsuite/gsk/compare/shadow-opacity.node
new file mode 100644 (file)
index 0000000..d9bded6
--- /dev/null
@@ -0,0 +1,10 @@
+opacity {
+  opacity: 0.6;
+  child: shadow {
+    shadows: rgb(255,0,0) 10 10;
+    child: color {
+      bounds: 0 0 50 50;
+      color: rgb(0,0,255);
+    }
+  }
+}
diff --git a/testsuite/gsk/compare/shadow-opacity.png b/testsuite/gsk/compare/shadow-opacity.png
new file mode 100644 (file)
index 0000000..ab25ef4
Binary files /dev/null and b/testsuite/gsk/compare/shadow-opacity.png differ
index eb76c4a8890e0aa454ef151cfe7f30626d2bd8d2..944d4f8f99a5ae2a41bb3fe5d5d745a42fb8eb33 100644 (file)
@@ -90,6 +90,7 @@ compare_render_tests = [
   'scaled-cairo',
   'scaled-texture',
   'shadow-in-opacity',
+  'shadow-opacity',
   'texture-scale-magnify-10000x',
   'texture-scale-magnify-rotate',
   'texture-scale-stripes',