summaryrefslogtreecommitdiff
path: root/gsk
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2021-12-10 20:07:39 +0100
committerTimm Bäder <mail@baedert.org>2021-12-12 12:57:44 +0100
commitfd6b3ef5a0ea9e240f5cc5b5714ee11f1c24baf7 (patch)
tree44a4f24de690f223c32c50c27b93a7cbc7ef7142 /gsk
parentd6181b23359410971b4c28c612fdc705ebd99616 (diff)
downloadgtk+-fd6b3ef5a0ea9e240f5cc5b5714ee11f1c24baf7.tar.gz
gl: Linear gradients don't support 3d transforms
Add another helper similar to the one for transforms, but that only works on 2d transforms. Fixes #4501
Diffstat (limited to 'gsk')
-rw-r--r--gsk/gl/gskglrenderjob.c87
1 files changed, 69 insertions, 18 deletions
diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c
index 1862191118..a0df3e2990 100644
--- a/gsk/gl/gskglrenderjob.c
+++ b/gsk/gl/gskglrenderjob.c
@@ -246,6 +246,47 @@ gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self)
}
static inline gboolean G_GNUC_PURE
+node_supports_2d_transform (const GskRenderNode *node)
+{
+ switch ((int)gsk_render_node_get_node_type (node))
+ {
+ case GSK_COLOR_NODE:
+ case GSK_OPACITY_NODE:
+ case GSK_COLOR_MATRIX_NODE:
+ case GSK_TEXTURE_NODE:
+ case GSK_CROSS_FADE_NODE:
+ case GSK_LINEAR_GRADIENT_NODE:
+ case GSK_REPEATING_LINEAR_GRADIENT_NODE:
+ case GSK_CONIC_GRADIENT_NODE:
+ case GSK_RADIAL_GRADIENT_NODE:
+ case GSK_REPEATING_RADIAL_GRADIENT_NODE:
+ case GSK_DEBUG_NODE:
+ case GSK_TEXT_NODE:
+ case GSK_CAIRO_NODE:
+ case GSK_BLEND_NODE:
+ case GSK_BLUR_NODE:
+ return TRUE;
+
+ case GSK_SHADOW_NODE:
+ return node_supports_2d_transform (gsk_shadow_node_get_child (node));
+
+ case GSK_TRANSFORM_NODE:
+ return node_supports_2d_transform (gsk_transform_node_get_child (node));
+
+ case GSK_CONTAINER_NODE:
+ for (guint i = 0, p = gsk_container_node_get_n_children (node); i < p; i++)
+ {
+ if (!node_supports_2d_transform (gsk_container_node_get_child (node, i)))
+ return FALSE;
+ }
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
+
+static inline gboolean G_GNUC_PURE
node_supports_transform (const GskRenderNode *node)
{
/* Some nodes can't handle non-trivial transforms without being
@@ -257,24 +298,26 @@ node_supports_transform (const GskRenderNode *node)
switch ((int)gsk_render_node_get_node_type (node))
{
- case GSK_COLOR_NODE:
- case GSK_OPACITY_NODE:
- case GSK_COLOR_MATRIX_NODE:
- case GSK_TEXTURE_NODE:
- case GSK_CROSS_FADE_NODE:
- case GSK_LINEAR_GRADIENT_NODE:
- case GSK_DEBUG_NODE:
- case GSK_TEXT_NODE:
- return TRUE;
-
- case GSK_SHADOW_NODE:
- return node_supports_transform (gsk_shadow_node_get_child (node));
-
- case GSK_TRANSFORM_NODE:
- return node_supports_transform (gsk_transform_node_get_child (node));
-
- default:
- return FALSE;
+ case GSK_COLOR_NODE:
+ case GSK_OPACITY_NODE:
+ case GSK_COLOR_MATRIX_NODE:
+ case GSK_TEXTURE_NODE:
+ case GSK_CROSS_FADE_NODE:
+ case GSK_DEBUG_NODE:
+ case GSK_TEXT_NODE:
+ case GSK_CAIRO_NODE:
+ case GSK_BLEND_NODE:
+ case GSK_BLUR_NODE:
+ return TRUE;
+
+ case GSK_SHADOW_NODE:
+ return node_supports_transform (gsk_shadow_node_get_child (node));
+
+ case GSK_TRANSFORM_NODE:
+ return node_supports_transform (gsk_transform_node_get_child (node));
+
+ default:
+ return FALSE;
}
}
@@ -2017,6 +2060,14 @@ gsk_gl_render_job_visit_transform_node (GskGLRenderJob *job,
break;
case GSK_TRANSFORM_CATEGORY_2D:
+ if (node_supports_2d_transform (child))
+ {
+ gsk_gl_render_job_push_modelview (job, transform);
+ gsk_gl_render_job_visit_node (job, child);
+ gsk_gl_render_job_pop_modelview (job);
+ return;
+ }
+ G_GNUC_FALLTHROUGH;
case GSK_TRANSFORM_CATEGORY_3D:
case GSK_TRANSFORM_CATEGORY_ANY:
case GSK_TRANSFORM_CATEGORY_UNKNOWN: