diff options
author | Benjamin Otte <otte@redhat.com> | 2019-02-21 05:34:12 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2019-02-21 19:47:28 +0100 |
commit | a881cbff3a77eedda6b2bd37cc04636e7130416e (patch) | |
tree | 6aae43ddecac0bdb39f03df53864e378a468cb6f /gtk/gtkrendernodepaintable.c | |
parent | 5b10a2929e2b7149a68fbe07635ad01b48189f0d (diff) | |
download | gtk+-a881cbff3a77eedda6b2bd37cc04636e7130416e.tar.gz |
rendernodepaintable: Use new snapshot transforms
Diffstat (limited to 'gtk/gtkrendernodepaintable.c')
-rw-r--r-- | gtk/gtkrendernodepaintable.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/gtk/gtkrendernodepaintable.c b/gtk/gtkrendernodepaintable.c index 8e67150a37..2a85de2aad 100644 --- a/gtk/gtkrendernodepaintable.c +++ b/gtk/gtkrendernodepaintable.c @@ -43,28 +43,17 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable, double height) { GtkRenderNodePaintable *self = GTK_RENDER_NODE_PAINTABLE (paintable); - gboolean needs_transform; if (self->bounds.size.width <= 0 || self->bounds.size.height <= 0) return; - needs_transform = self->bounds.size.width != width || - self->bounds.size.height != height; + gtk_snapshot_save (snapshot); - if (needs_transform) - { - graphene_matrix_t transform; - - graphene_matrix_init_scale (&transform, - width / (self->bounds.size.width), - height / (self->bounds.size.height), - 1.0); - gtk_snapshot_push_transform (snapshot, - &transform); - } - - gtk_snapshot_offset (snapshot, -self->bounds.origin.x, -self->bounds.origin.y); + gtk_snapshot_scale (snapshot, + width / (self->bounds.size.width), + height / (self->bounds.size.height)); + gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (-self->bounds.origin.x, -self->bounds.origin.y)); gtk_snapshot_push_clip (snapshot, &self->bounds); @@ -73,10 +62,7 @@ gtk_render_node_paintable_paintable_snapshot (GdkPaintable *paintable, gtk_snapshot_pop (snapshot); - gtk_snapshot_offset (snapshot, self->bounds.origin.x, self->bounds.origin.y); - - if (needs_transform) - gtk_snapshot_pop (snapshot); + gtk_snapshot_restore (snapshot); } static GdkPaintableFlags |