forked from AuroraMiddleware/gtk
magnifier: Use new snapshot transforms
This commit is contained in:
parent
65174c7989
commit
b96e835d9e
@ -103,7 +103,6 @@ gtk_magnifier_snapshot (GtkWidget *widget,
|
||||
{
|
||||
GtkMagnifier *magnifier = GTK_MAGNIFIER (widget);
|
||||
GtkMagnifierPrivate *priv = gtk_magnifier_get_instance_private (magnifier);
|
||||
graphene_matrix_t transform;
|
||||
double width, height, paintable_width, paintable_height;
|
||||
|
||||
if (gtk_widget_paintable_get_widget (GTK_WIDGET_PAINTABLE (priv->paintable)) == NULL)
|
||||
@ -116,19 +115,16 @@ gtk_magnifier_snapshot (GtkWidget *widget,
|
||||
if (paintable_width <= 0.0 || paintable_height <= 0.0)
|
||||
return;
|
||||
|
||||
graphene_matrix_init_translate (&transform, &GRAPHENE_POINT3D_INIT (
|
||||
- CLAMP (priv->x, 0, paintable_width),
|
||||
- CLAMP (priv->y, 0, paintable_height),
|
||||
0
|
||||
));
|
||||
|
||||
graphene_matrix_scale (&transform, priv->magnification, priv->magnification, 1);
|
||||
gtk_snapshot_save (snapshot);
|
||||
if (!priv->resize)
|
||||
graphene_matrix_translate (&transform, &GRAPHENE_POINT3D_INIT (width / 2, height / 2, 0));
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2, height / 2));
|
||||
gtk_snapshot_scale (snapshot, priv->magnification, priv->magnification);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (
|
||||
- CLAMP (priv->x, 0, paintable_width),
|
||||
- CLAMP (priv->y, 0, paintable_height)));
|
||||
|
||||
gtk_snapshot_push_transform (snapshot, &transform);
|
||||
gdk_paintable_snapshot (priv->paintable, snapshot, paintable_width, paintable_height);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
gtk_snapshot_restore (snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user