[gtk/wip/otte/transform: 19/37] magnifier: Use new snapshot transforms



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

    magnifier: Use new snapshot transforms

 gtk/gtkmagnifier.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/gtk/gtkmagnifier.c b/gtk/gtkmagnifier.c
index 0ddbdd882c..9d99898b3a 100644
--- a/gtk/gtkmagnifier.c
+++ b/gtk/gtkmagnifier.c
@@ -103,7 +103,6 @@ gtk_magnifier_snapshot (GtkWidget   *widget,
 {
   GtkMagnifier *magnifier = GTK_MAGNIFIER (widget);
   GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (magnifier);
-  graphene_matrix_t transform;
   double width, height, paintable_width, paintable_height;
 
   if (gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (priv->paintable)) == NULL)
@@ -116,19 +115,16 @@ gtk_magnifier_snapshot (GtkWidget   *widget,
   if (paintable_width <= 0.0 || paintable_height <= 0.0)
     return;
 
-  graphene_matrix_init_translate (&transform, &GRAPHENE_POINT3D_INIT (
-                                 - CLAMP (priv->x, 0, paintable_width),
-                                 - CLAMP (priv->y, 0, paintable_height),
-                                 0
-                             ));
-
-  graphene_matrix_scale (&transform, priv->magnification, priv->magnification, 1);
+  gtk_snapshot_save (snapshot);
   if (!priv->resize)
-    graphene_matrix_translate (&transform, &GRAPHENE_POINT3D_INIT (width / 2, height / 2, 0));
+    gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2, height / 2));
+  gtk_snapshot_scale (snapshot, priv->magnification, priv->magnification);
+  gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (
+                          - CLAMP (priv->x, 0, paintable_width),
+                          - CLAMP (priv->y, 0, paintable_height)));
 
-  gtk_snapshot_push_transform (snapshot, &transform);
   gdk_paintable_snapshot (priv->paintable, snapshot, paintable_width, paintable_height);
-  gtk_snapshot_pop (snapshot);
+  gtk_snapshot_restore (snapshot);
 }
 
 static void


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