summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2017-11-24 01:37:48 +1100
committerJan Schmidt <jan@centricular.com>2017-11-24 01:37:48 +1100
commit9a10dbe35025ca119dd44ba44509a9af727df370 (patch)
tree307fa2e2b37a18ada1d53d353855b8ba83932389 /tests
parent73cd56bddb07311552a83d14fad6574f6bfa3671 (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/examples/gl/gtk/3dvideo/main.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/examples/gl/gtk/3dvideo/main.cpp b/tests/examples/gl/gtk/3dvideo/main.cpp
index ec5951b1c..4f12b11cc 100644
--- a/tests/examples/gl/gtk/3dvideo/main.cpp
+++ b/tests/examples/gl/gtk/3dvideo/main.cpp
@@ -117,9 +117,16 @@ static gboolean
resize_cb (GtkWidget * widget, GdkEvent * event, gpointer sink)
{
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);
- 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;
}