mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
glimagesink: Allow resetting render rectangle
As documented, passing -1 to x and/or y should reset the render rectangle to the window/display size. https://bugzilla.gnome.org/show_bug.cgi?id=792798
This commit is contained in:
parent
3b317ea6c2
commit
17b118c120
2 changed files with 9 additions and 5 deletions
|
@ -993,11 +993,8 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
|
||||||
g_signal_connect (window, "mouse-event",
|
g_signal_connect (window, "mouse-event",
|
||||||
G_CALLBACK (gst_glimage_sink_mouse_event_cb), gl_sink);
|
G_CALLBACK (gst_glimage_sink_mouse_event_cb), gl_sink);
|
||||||
|
|
||||||
if (gl_sink->x >= 0 && gl_sink->y >= 0 && gl_sink->width > 0 &&
|
|
||||||
gl_sink->height > 0) {
|
|
||||||
gst_gl_window_set_render_rectangle (window, gl_sink->x, gl_sink->y,
|
gst_gl_window_set_render_rectangle (window, gl_sink->x, gl_sink->y,
|
||||||
gl_sink->width, gl_sink->height);
|
gl_sink->width, gl_sink->height);
|
||||||
}
|
|
||||||
|
|
||||||
if (other_context)
|
if (other_context)
|
||||||
gst_object_unref (other_context);
|
gst_object_unref (other_context);
|
||||||
|
|
|
@ -907,6 +907,13 @@ gst_gl_window_set_render_rectangle (GstGLWindow * window, gint x, gint y,
|
||||||
g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
|
g_return_val_if_fail (GST_IS_GL_WINDOW (window), FALSE);
|
||||||
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
window_class = GST_GL_WINDOW_GET_CLASS (window);
|
||||||
|
|
||||||
|
/* When x/y is smaller then reset the render rectangle */
|
||||||
|
if (x < 0 || y < 0) {
|
||||||
|
x = y = 0;
|
||||||
|
width = window->priv->surface_width;
|
||||||
|
height = window->priv->surface_height;
|
||||||
|
}
|
||||||
|
|
||||||
if (x < 0 || y < 0 || width <= 0 || height <= 0)
|
if (x < 0 || y < 0 || width <= 0 || height <= 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue