snapshot: Remove the old APIs

It's all using transforms now.
This commit is contained in:
Benjamin Otte 2019-02-21 05:24:11 +01:00
parent d8482edaf5
commit 4052bb2535
4 changed files with 3 additions and 83 deletions

View File

@ -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

View File

@ -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,
@ -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

View File

@ -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

View File

@ -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,