mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
3dvideo example: Correct video overlay for HiDPI
Use the GTK scaling factor to scale the video allocation so video displays correctly on hi-dpi screens
This commit is contained in:
parent
4e2ede5e6d
commit
bbe084de9d
1 changed files with 8 additions and 1 deletions
|
@ -117,9 +117,16 @@ static gboolean
|
||||||
resize_cb (GtkWidget * widget, GdkEvent * event, gpointer sink)
|
resize_cb (GtkWidget * widget, GdkEvent * event, gpointer sink)
|
||||||
{
|
{
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
gint scale = 1;
|
||||||
|
|
||||||
|
#if GTK_CHECK_VERSION(3, 10, 0)
|
||||||
|
scale = gtk_widget_get_scale_factor (widget);
|
||||||
|
#endif
|
||||||
|
|
||||||
gtk_widget_get_allocation (widget, &allocation);
|
gtk_widget_get_allocation (widget, &allocation);
|
||||||
gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (sink), allocation.x, allocation.y, allocation.width, allocation.height);
|
gst_video_overlay_set_render_rectangle (GST_VIDEO_OVERLAY (sink),
|
||||||
|
allocation.x * scale, allocation.y * scale, allocation.width * scale,
|
||||||
|
allocation.height * scale);
|
||||||
|
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue