[gtk/wip/otte/transform: 24/37] scaler: Use new snapshot transforms



commit 5a09ba59f13c644c1ba338c1cba04eea0c0caf13
Author: Benjamin Otte <otte redhat com>
Date:   Thu Feb 21 05:34:12 2019 +0100

    scaler: Use new snapshot transforms

 gtk/gtkscaler.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkscaler.c b/gtk/gtkscaler.c
index 266e4dc74a..3824635bf2 100644
--- a/gtk/gtkscaler.c
+++ b/gtk/gtkscaler.c
@@ -44,22 +44,16 @@ gtk_scaler_paintable_snapshot (GdkPaintable *paintable,
 {
   GtkScaler *self = GTK_SCALER (paintable);
 
-  if (self->scale_factor == 1.0)
-    {
-      gdk_paintable_snapshot (self->paintable, snapshot, width, height);
-    }
-  else
-    {
-      graphene_matrix_t scale_matrix;
-
-      graphene_matrix_init_scale (&scale_matrix, 1.0 / self->scale_factor, 1.0 / self->scale_factor, 1.0);
-      gtk_snapshot_push_transform (snapshot, &scale_matrix);
-      gdk_paintable_snapshot (self->paintable,
-                              snapshot,
-                              width * self->scale_factor,
-                              height * self->scale_factor);
-      gtk_snapshot_pop (snapshot);
-    }
+  gtk_snapshot_save (snapshot);
+
+  gtk_snapshot_scale (snapshot, 1.0 / self->scale_factor, 1.0 / self->scale_factor);
+
+  gdk_paintable_snapshot (self->paintable,
+                          snapshot,
+                          width * self->scale_factor,
+                          height * self->scale_factor);
+
+  gtk_snapshot_restore (snapshot);
 }
 
 static GdkPaintable *


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