diff options
author | Benjamin Otte <otte@redhat.com> | 2019-02-21 05:24:11 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2019-02-21 19:47:28 +0100 |
commit | 4052bb2535d71a0259af2f4c2edaa18a0cd16799 (patch) | |
tree | 915caa94a661261bb35a21829ab4bf4f49508b8d | |
parent | d8482edaf5f68b6d5ee6f937ea55e80e39e05c91 (diff) | |
download | gtk+-4052bb2535d71a0259af2f4c2edaa18a0cd16799.tar.gz |
snapshot: Remove the old APIs
It's all using transforms now.
-rw-r--r-- | docs/reference/gtk/gtk4-sections.txt | 2 | ||||
-rw-r--r-- | gtk/gtksnapshot.c | 74 | ||||
-rw-r--r-- | gtk/gtksnapshot.h | 7 | ||||
-rw-r--r-- | 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 ddb3c3c2bc..bb7a952305 100644 --- a/docs/reference/gtk/gtk4-sections.txt +++ b/docs/reference/gtk/gtk4-sections.txt @@ -4393,7 +4393,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 @@ -4412,7 +4411,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 fed71a8f5b..318024f59f 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -327,57 +327,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, GskRenderNode **nodes, @@ -1403,24 +1352,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) @@ -1687,7 +1618,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)); @@ -1699,7 +1631,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 abaf20f057..162addf28e 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 @@ -137,10 +134,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, |