mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-14 14:20:21 +00:00
Merge branch 'another-attempt-to-fix-shadertoy' into 'master'
Flip GLArea textures See merge request GNOME/gtk!2634
This commit is contained in:
commit
27b3bb59eb
@ -1793,10 +1793,11 @@ gsk_transform_transform_bounds (GskTransform *self,
|
||||
float dx, dy;
|
||||
|
||||
gsk_transform_to_translate (self, &dx, &dy);
|
||||
out_rect->origin.x = rect->origin.x + dx;
|
||||
out_rect->origin.y = rect->origin.y + dy;
|
||||
out_rect->size.width = rect->size.width;
|
||||
out_rect->size.height = rect->size.height;
|
||||
graphene_rect_init (out_rect,
|
||||
rect->origin.x + dx,
|
||||
rect->origin.y + dy,
|
||||
rect->size.width,
|
||||
rect->size.height);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1806,10 +1807,11 @@ gsk_transform_transform_bounds (GskTransform *self,
|
||||
|
||||
gsk_transform_to_affine (self, &scale_x, &scale_y, &dx, &dy);
|
||||
|
||||
out_rect->origin.x = (rect->origin.x * scale_x) + dx;
|
||||
out_rect->origin.y = (rect->origin.y * scale_y) + dy;
|
||||
out_rect->size.width = rect->size.width * scale_x;
|
||||
out_rect->size.height = rect->size.height * scale_y;
|
||||
graphene_rect_init (out_rect,
|
||||
(rect->origin.x * scale_x) + dx,
|
||||
(rect->origin.y * scale_y) + dy,
|
||||
rect->size.width * scale_x,
|
||||
rect->size.height * scale_y);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -744,11 +744,18 @@ gtk_gl_area_snapshot (GtkWidget *widget,
|
||||
texture->height,
|
||||
release_texture, texture);
|
||||
|
||||
/* Our texture is rendered by OpenGL, so it is upside down,
|
||||
* compared to what GSK expects, so flip it back.
|
||||
*/
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, gtk_widget_get_height (widget)));
|
||||
gtk_snapshot_scale (snapshot, 1, -1);
|
||||
gtk_snapshot_append_texture (snapshot,
|
||||
texture->holder,
|
||||
&GRAPHENE_RECT_INIT (0, 0,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget)));
|
||||
gtk_snapshot_restore (snapshot);
|
||||
|
||||
g_object_unref (texture->holder);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user