[gtk/wip/otte/for-master] snapshot: Don't flip textures




commit 651c92c0ed8ff732b8e1d20c963c7e7abca5edd2
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 28 16:09:06 2020 +0200

    snapshot: Don't flip textures
    
    ... or gradients or borders or shadows. Instead, ensure that affines
    have non-negative scale factors. Otherwise add a transform node.
    
    The only place where this check is not necessary is color nodes, but
    special casing them seems not worth it.

 gtk/gtksnapshot.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 7de6594167..a1d7c9340c 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -697,9 +697,22 @@ gtk_snapshot_ensure_affine (GtkSnapshot *snapshot,
     {
       gtk_snapshot_autopush_transform (snapshot);
       state = gtk_snapshot_get_current_state (snapshot);
+      gsk_transform_to_affine (state->transform, scale_x, scale_y, dx, dy);
+    }
+  else if (gsk_transform_get_category (state->transform) == GSK_TRANSFORM_CATEGORY_2D_AFFINE)
+    {
+      gsk_transform_to_affine (state->transform, scale_x, scale_y, dx, dy);
+      if (*scale_x < 0.0 || *scale_y < 0.0)
+        {
+          gtk_snapshot_autopush_transform (snapshot);
+          state = gtk_snapshot_get_current_state (snapshot);
+          gsk_transform_to_affine (state->transform, scale_x, scale_y, dx, dy);
+        }
+    }
+  else
+    {
+      gsk_transform_to_affine (state->transform, scale_x, scale_y, dx, dy);
     }
-  
-  gsk_transform_to_affine (state->transform, scale_x, scale_y, dx, dy);
 }
 
 static void


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