[gtk] gl renderer: Fix scale computation



commit db548ee2a05ab1d2bc9bb44de9d20111e485dbe6
Author: Timm Bäder <mail baedert org>
Date:   Sun Jun 2 10:25:39 2019 +0200

    gl renderer: Fix scale computation
    
    We don't need to just look at the scale of the new modelview matrix, but
    at the one we get when multiplying the new one with the current one.
    
    Test case attached.

 gsk/gl/gskglrenderops.c                  |   2 +-
 testsuite/gsk/compare/scale-up-down.node |  39 +++++++++++++++++++++++++++++++
 testsuite/gsk/compare/scale-up-down.png  | Bin 0 -> 708 bytes
 testsuite/gsk/meson.build                |   1 +
 4 files changed, 41 insertions(+), 1 deletion(-)
---
diff --git a/gsk/gl/gskglrenderops.c b/gsk/gl/gskglrenderops.c
index 52529e4f60..9c99fba915 100644
--- a/gsk/gl/gskglrenderops.c
+++ b/gsk/gl/gskglrenderops.c
@@ -450,7 +450,7 @@ ops_push_modelview (RenderOpBuilder *builder,
   entry->metadata.dx_before = builder->dx;
   entry->metadata.dy_before = builder->dy;
 
-  extract_matrix_metadata (transform, &entry->metadata);
+  extract_matrix_metadata (entry->transform, &entry->metadata);
 
   builder->dx = 0;
   builder->dy = 0;
diff --git a/testsuite/gsk/compare/scale-up-down.node b/testsuite/gsk/compare/scale-up-down.node
new file mode 100644
index 0000000000..caa021e34f
--- /dev/null
+++ b/testsuite/gsk/compare/scale-up-down.node
@@ -0,0 +1,39 @@
+transform{
+  transform: scale(0.5);
+  child: transform {
+    transform: scale(8);
+    child: clip {
+      clip: 0 0 50 50 / 20 0 0 0;
+      child: color {
+        color: teal;
+      }
+    }
+  }
+}
+
+debug {
+  message: "clipped-out area";
+  child: container {
+    color { color: black;
+            bounds: 0 50 10 30; }
+    color { color: black;
+            bounds: 5 40 10 10; }
+    color { color: black;
+            bounds: 10 35 10 10; }
+    color { color: black;
+            bounds: 12 30 10 10; }
+    color { color: black;
+            bounds: 17 23 10 10; }
+    color { color: black;
+            bounds: 23 16 10 10; }
+    color { color: black;
+            bounds: 30 11 10 10; }
+    color { color: black;
+            bounds: 38 4 10 10; }
+    color { color: black;
+            bounds: 47 2 10 10; }
+    color { color: black;
+            bounds: 54 0 50 10; }
+  }
+
+}
\ No newline at end of file
diff --git a/testsuite/gsk/compare/scale-up-down.png b/testsuite/gsk/compare/scale-up-down.png
new file mode 100644
index 0000000000..83ee845f5f
Binary files /dev/null and b/testsuite/gsk/compare/scale-up-down.png differ
diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build
index a8aac553d8..5981f131d2 100644
--- a/testsuite/gsk/meson.build
+++ b/testsuite/gsk/meson.build
@@ -56,6 +56,7 @@ compare_render_tests = [
   'texture-url',
   'color-matrix-identity',
   'clip-nested1',
+  'scale-up-down'
 ]
 
 renderers = [


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