[gtk/wip/baedert/for-master] gl: Imply that node_supports_transforms() means 2D transforms




commit b29a33c23beaae62af22f9924788d629eab8f3a4
Author: Timm Bäder <mail baedert org>
Date:   Fri Dec 10 20:07:39 2021 +0100

    gl: Imply that node_supports_transforms() means 2D transforms
    
    Fixes #4501

 gsk/gl/gskglrenderjob.c                       |   9 +++++----
 testsuite/gsk/compare/linear-gradient-3d.node |  13 +++++++++++++
 testsuite/gsk/compare/linear-gradient-3d.png  | Bin 0 -> 151 bytes
 testsuite/gsk/meson.build                     |   8 ++++----
 4 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c
index 1862191118..bc88dc5fb7 100644
--- a/gsk/gl/gskglrenderjob.c
+++ b/gsk/gl/gskglrenderjob.c
@@ -2017,16 +2017,17 @@ gsk_gl_render_job_visit_transform_node (GskGLRenderJob      *job,
     break;
 
     case GSK_TRANSFORM_CATEGORY_2D:
-    case GSK_TRANSFORM_CATEGORY_3D:
-    case GSK_TRANSFORM_CATEGORY_ANY:
-    case GSK_TRANSFORM_CATEGORY_UNKNOWN:
       if (node_supports_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;
         }
-      else
+      G_GNUC_FALLTHROUGH;
+    case GSK_TRANSFORM_CATEGORY_3D:
+    case GSK_TRANSFORM_CATEGORY_ANY:
+    case GSK_TRANSFORM_CATEGORY_UNKNOWN:
         {
           GskGLRenderOffscreen offscreen = {0};
           float sx = 1, sy  = 1;
diff --git a/testsuite/gsk/compare/linear-gradient-3d.node b/testsuite/gsk/compare/linear-gradient-3d.node
new file mode 100644
index 0000000000..b3ba197779
--- /dev/null
+++ b/testsuite/gsk/compare/linear-gradient-3d.node
@@ -0,0 +1,13 @@
+clip {
+  clip: 0 -25 50 50;
+  child: transform {
+    transform: perspective(100) rotateY(45);
+    child: linear-gradient {
+        bounds: 0 -100 200 200;
+        start: 0 -100;
+        end: 0 100;
+        stops: 0.5 red,
+         0.5 lime;
+   }
+ }
+}
diff --git a/testsuite/gsk/compare/linear-gradient-3d.png b/testsuite/gsk/compare/linear-gradient-3d.png
new file mode 100644
index 0000000000..2ac3fd1e44
Binary files /dev/null and b/testsuite/gsk/compare/linear-gradient-3d.png differ
diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build
index 23821da279..71e18f824d 100644
--- a/testsuite/gsk/meson.build
+++ b/testsuite/gsk/meson.build
@@ -93,10 +93,10 @@ informative_render_tests = [
 ]
 
 renderers = [
-  # name      exclude term
-  [ 'gl', ''    ],
-  [ 'broadway',  '-3d' ],
-  [ 'cairo',  '-3d' ],
+  # name          exclude term
+  [ 'gl', ''           ],
+  [ 'broadway',   '-3d' ],
+  [ 'cairo',      '-3d' ],
 ]
 
 foreach renderer : renderers


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