[gtk/wip/otte/transform: 23/37] rendernodepaintable: Use new snapshot transforms
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/transform: 23/37] rendernodepaintable: Use new snapshot transforms
- Date: Thu, 21 Feb 2019 06:22:46 +0000 (UTC)
commit 6e9b0e4484221b2fdfe6a76babc960e463523148
Author: Benjamin Otte <otte redhat com>
Date: Thu Feb 21 05:34:12 2019 +0100
rendernodepaintable: Use new snapshot transforms
gtk/gtkrendernodepaintable.c | 26 ++++++--------------------
1 file 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]