Commit 17b118c1 authored by Nicolas Dufresne's avatar Nicolas Dufresne

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
parent 3b317ea6
......@@ -993,11 +993,8 @@ _ensure_gl_setup (GstGLImageSink * gl_sink)
g_signal_connect (window, "mouse-event",
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,
gl_sink->width, gl_sink->height);
}
gst_gl_window_set_render_rectangle (window, gl_sink->x, gl_sink->y,
gl_sink->width, gl_sink->height);
if (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);
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)
return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment