[gtk/wip/otte/transform: 41/41] snapshot: Remove the old APIs



commit cc6fcc3a692da1a2d0e518b85507e2b6949fc9fe
Author: Benjamin Otte <otte redhat com>
Date:   Thu Feb 21 05:24:11 2019 +0100

    snapshot: Remove the old APIs
    
    It's all using transforms now.

 docs/reference/gtk/gtk4-sections.txt |  2 -
 gtk/gtksnapshot.c                    | 74 ++----------------------------------
 gtk/gtksnapshot.h                    |  7 ----
 gtk/gtksnapshotprivate.h             |  3 --
 4 files changed, 3 insertions(+), 83 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index a618a5a828..640fbd3473 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4389,7 +4389,6 @@ gtk_snapshot_to_node
 gtk_snapshot_to_paintable
 gtk_snapshot_free_to_node
 gtk_snapshot_free_to_paintable
-gtk_snapshot_push_transform
 gtk_snapshot_push_opacity
 gtk_snapshot_push_color_matrix
 gtk_snapshot_push_repeat
@@ -4407,7 +4406,6 @@ gtk_snapshot_rotate
 gtk_snapshot_rotate_3d
 gtk_snapshot_scale
 gtk_snapshot_scale_3d
-gtk_snapshot_offset
 gtk_snapshot_append_node
 gtk_snapshot_append_cairo
 gtk_snapshot_append_texture
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index aab92fe6f2..10a4459ab9 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -326,57 +326,6 @@ gtk_snapshot_push_debug (GtkSnapshot *snapshot,
     }
 }
 
-static GskRenderNode *
-gtk_snapshot_collect_transform (GtkSnapshot      *snapshot,
-                                GtkSnapshotState *state,
-                                GskRenderNode   **nodes,
-                                guint             n_nodes)
-{
-  GskRenderNode *node, *transform_node;
-
-  node = gtk_snapshot_collect_default (snapshot, state, nodes, n_nodes);
-  if (node == NULL)
-    return NULL;
-
-  transform_node = gsk_transform_node_new_with_category (node,
-                                                         &state->data.transform.transform,
-                                                         state->data.transform.category);
-
-  gsk_render_node_unref (node);
-
-  return transform_node;
-}
-
-void
-gtk_snapshot_push_transform (GtkSnapshot             *snapshot,
-                             const graphene_matrix_t *transform)
-{
-  gtk_snapshot_push_transform_with_category (snapshot,
-                                             transform,
-                                             GSK_MATRIX_CATEGORY_UNKNOWN);
-}
-
-void
-gtk_snapshot_push_transform_with_category (GtkSnapshot             *snapshot,
-                                           const graphene_matrix_t *transform,
-                                           GskMatrixCategory        category)
-{
-  GtkSnapshotState *previous_state;
-  GtkSnapshotState *state;
-  graphene_matrix_t offset;
-
-  state = gtk_snapshot_push_state (snapshot,
-                                   NULL,
-                                   gtk_snapshot_collect_transform);
-
-  previous_state = gtk_snapshot_get_previous_state (snapshot);
-
-  gtk_transform_to_matrix (previous_state->transform, &offset);
-
-  graphene_matrix_multiply (transform, &offset, &state->data.transform.transform);
-  state->data.transform.category = MIN (gtk_transform_categorize (previous_state->transform), category);
-}
-
 static GskRenderNode *
 gtk_snapshot_collect_opacity (GtkSnapshot      *snapshot,
                               GtkSnapshotState *state,
@@ -1384,24 +1333,6 @@ gtk_snapshot_scale_3d (GtkSnapshot *snapshot,
   state->transform = gtk_transform_scale_3d (state->transform, factor_x, factor_y, factor_z);
 }
 
-/**
- * gtk_snapshot_offset:
- * @snapshot: a #GtkSnapshot
- * @x: horizontal translation
- * @y: vertical translation
- *
- * Appends a translation by (@x, @y) to the current transformation.
- */
-void
-gtk_snapshot_offset (GtkSnapshot *snapshot,
-                     int          x,
-                     int          y)
-{
-  GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot);
-
-  current_state->transform = gtk_transform_translate (current_state->transform, &GRAPHENE_POINT_INIT (x, y));
-}
-
 void
 gtk_snapshot_append_node_internal (GtkSnapshot   *snapshot,
                                    GskRenderNode *node)
@@ -1668,7 +1599,8 @@ gtk_snapshot_render_layout (GtkSnapshot     *snapshot,
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
   g_return_if_fail (PANGO_IS_LAYOUT (layout));
 
-  gtk_snapshot_offset (snapshot, x, y);
+  gtk_snapshot_save (snapshot);
+  gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
 
   fg_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_COLOR));
 
@@ -1680,7 +1612,7 @@ gtk_snapshot_render_layout (GtkSnapshot     *snapshot,
   if (has_shadow)
     gtk_snapshot_pop (snapshot);
 
-  gtk_snapshot_offset (snapshot, -x, -y);
+  gtk_snapshot_restore (snapshot);
 }
 
 void
diff --git a/gtk/gtksnapshot.h b/gtk/gtksnapshot.h
index 42a805e485..8ff2262fdf 100644
--- a/gtk/gtksnapshot.h
+++ b/gtk/gtksnapshot.h
@@ -69,9 +69,6 @@ void            gtk_snapshot_push_debug                 (GtkSnapshot
                                                          const char             *message,
                                                          ...) G_GNUC_PRINTF (2, 3);
 GDK_AVAILABLE_IN_ALL
-void            gtk_snapshot_push_transform             (GtkSnapshot            *snapshot,
-                                                         const graphene_matrix_t*transform);
-GDK_AVAILABLE_IN_ALL
 void            gtk_snapshot_push_opacity               (GtkSnapshot            *snapshot,
                                                          double                  opacity);
 GDK_AVAILABLE_IN_ALL
@@ -134,10 +131,6 @@ void            gtk_snapshot_scale_3d                   (GtkSnapshot
                                                          float                   factor_y,
                                                          float                   factor_z);
 GDK_AVAILABLE_IN_ALL
-void            gtk_snapshot_offset                     (GtkSnapshot            *snapshot,
-                                                         int                     x,
-                                                         int                     y);
-GDK_AVAILABLE_IN_ALL
 void            gtk_snapshot_append_node                (GtkSnapshot            *snapshot,
                                                          GskRenderNode          *node);
 GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtksnapshotprivate.h b/gtk/gtksnapshotprivate.h
index 6954392bf4..f43f6a3c5d 100644
--- a/gtk/gtksnapshotprivate.h
+++ b/gtk/gtksnapshotprivate.h
@@ -105,9 +105,6 @@ void                    gtk_snapshot_append_node_internal       (GtkSnapshot
 
 GtkSnapshot *           gtk_snapshot_new_with_parent            (GtkSnapshot            *parent_snapshot);
 
-void                    gtk_snapshot_push_transform_with_category (GtkSnapshot          *snapshot,
-                                                                 const graphene_matrix_t*transform,
-                                                                 GskMatrixCategory       category);
 void                    gtk_snapshot_transform_matrix_with_category
                                                                 (GtkSnapshot            *snapshot,
                                                                  const graphene_matrix_t*matrix,


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