[gtk/wip/chergert/glproto: 93/493] bring over transform check




commit 51c158b13af465a4091ec466cbf8833a6ef09059
Author: Christian Hergert <chergert redhat com>
Date:   Wed Dec 30 11:32:49 2020 -0800

    bring over transform check

 gsk/next/gskglrenderjob.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
---
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index c3bda3ae39..b9bbc9eab2 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -411,6 +411,36 @@ node_is_invisible (const GskRenderNode *node)
          isnan (node->bounds.size.height);
 }
 
+static inline gboolean G_GNUC_PURE
+node_supports_transform (GskRenderNode *node)
+{
+  /* Some nodes can't handle non-trivial transforms without being
+   * rendered to a texture (e.g. rotated clips, etc.). Some however work
+   * just fine, mostly because they already draw their child to a
+   * texture and just render the texture manipulated in some way, think
+   * opacity or color matrix.
+   */
+
+  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_TRANSFORM_NODE:
+        return node_supports_transform (gsk_transform_node_get_child (node));
+
+      default:
+        return FALSE;
+    }
+}
+
 static inline gboolean G_GNUC_PURE
 rect_intersects (const graphene_rect_t *r1,
                  const graphene_rect_t *r2)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]