summaryrefslogtreecommitdiff
path: root/gst-libs/gst/gl
diff options
context:
space:
mode:
authorHaihua Hu <jared.hu@nxp.com>2017-09-11 16:00:24 +0800
committerMatthew Waters <matthew@centricular.com>2017-09-19 12:53:53 +1000
commitb7387745669cfd294a5823dd7018f619d131cf5c (patch)
treebbb3d9bc8e4c58acbf4d607862b6673733742380 /gst-libs/gst/gl
parent039c983a9f18c5457f4f117128924da39abc8791 (diff)
gl/viv-fb: transform screen coordinate to viewport coordinate
In y direction, screen coordinate are opposite to viewport coordinate. https://bugzilla.gnome.org/show_bug.cgi?id=787394
Diffstat (limited to 'gst-libs/gst/gl')
-rw-r--r--gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
index f6b23912c..8515dc8ec 100644
--- a/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
+++ b/gst-libs/gst/gl/viv-fb/gstglwindow_viv_fb_egl.c
@@ -215,15 +215,28 @@ _free_set_render_rectangle (SetRenderRectangleData * render)
}
static void
+_calculate_viewport_coordinates(GstGLWindowVivFBEGL * window_egl,
+ GstVideoRectangle * req, GstVideoRectangle * result)
+{
+ result->x = req->x;
+ result->y = window_egl->window_height - (req->y + req->h);
+ result->w = req->w;
+ result->h = req->h;
+}
+
+static void
_set_render_rectangle (gpointer data)
{
SetRenderRectangleData *render = data;
- GstGLWindow *window = GST_GL_WINDOW (render->window_egl);
+ GstGLWindowVivFBEGL *window_egl = render->window_egl;
+ GstGLWindow *window = GST_GL_WINDOW (window_egl);
GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i",
render->rect.x, render->rect.y, render->rect.w, render->rect.h);
- render->window_egl->render_rectangle = render->rect;
+ _calculate_viewport_coordinates (window_egl, &render->rect,
+ &window_egl->render_rectangle);
+
gst_gl_window_resize (window, render->rect.w, render->rect.h);
window->queue_resize = TRUE;