From 83c2766e3f94fed1bbbc6966b0e4afe73db0ce47 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 9 Jul 2024 12:15:01 +0200 Subject: [PATCH] rendernode: Handle rotation transforms in opacity calculations Tests included. --- gsk/gskrendernodeimpl.c | 2 +- .../opaque/transform-flip-0-0-100-100.node | 32 +++++++++++++++++++ .../opaque/transform-rotate-0-0-200-50.node | 28 ++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 testsuite/gsk/opaque/transform-flip-0-0-100-100.node create mode 100644 testsuite/gsk/opaque/transform-rotate-0-0-200-50.node diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index a203e387f4..721657c527 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -3625,7 +3625,7 @@ gsk_transform_node_get_opaque_rect (GskRenderNode *node, GskTransformNode *self = (GskTransformNode *) node; graphene_rect_t child_opaque; - if (gsk_transform_get_category (self->transform) < GSK_TRANSFORM_CATEGORY_2D_AFFINE) + if (gsk_transform_get_fine_category (self->transform) < GSK_FINE_TRANSFORM_CATEGORY_2D_DIHEDRAL) return FALSE; if (!gsk_render_node_get_opaque_rect (self->child, &child_opaque)) diff --git a/testsuite/gsk/opaque/transform-flip-0-0-100-100.node b/testsuite/gsk/opaque/transform-flip-0-0-100-100.node new file mode 100644 index 0000000000..6f626c3eff --- /dev/null +++ b/testsuite/gsk/opaque/transform-flip-0-0-100-100.node @@ -0,0 +1,32 @@ +container { + transform { + transform: scale(1,1); + child: color { + bounds: 50 50 50 50; + color: lime; + } + } + transform { + transform: scale(1,-1); + child: color { + bounds: 50 -50 50 50; + color: red; + } + } +} +container { + transform { + transform: scale(-1,-1); + child: color { + bounds: -50 -50 50 50; + color: yellow; + } + } + transform { + transform: scale(-1,1); + child: color { + bounds: -50 50 50 50; + color: blue; + } + } +} diff --git a/testsuite/gsk/opaque/transform-rotate-0-0-200-50.node b/testsuite/gsk/opaque/transform-rotate-0-0-200-50.node new file mode 100644 index 0000000000..5ced377150 --- /dev/null +++ b/testsuite/gsk/opaque/transform-rotate-0-0-200-50.node @@ -0,0 +1,28 @@ +transform { + transform: rotate(0); + child: color { + bounds: 0 0 50 50; + color: lime; + } +} +transform { + transform: rotate(90); + child: color { + bounds: 0 -100 50 50; + color: red; + } +} +transform { + transform: rotate(180); + child: color { + bounds: -150 -50 50 50; + color: yellow; + } +} +transform { + transform: rotate(270); + child: color { + bounds: -50 150 50 50; + color: blue; + } +}