[vlc-devel] [PATCH 10/16] opengl: setup coords once for all

Romain Vimont rom1v at videolabs.io
Tue Mar 17 17:26:43 CET 2020


Now that the coordinates are independant of paddings (which are
transmitted via a separate transform matrix), there is no need to
recompute them when the paddings change.
---
 modules/video_output/opengl/renderer.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index bfe1d77c65..53f6d4c342 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -311,6 +311,8 @@ vlc_gl_renderer_Delete(struct vlc_gl_renderer *renderer)
     free(renderer);
 }
 
+static int SetupCoords(struct vlc_gl_renderer *renderer);
+
 struct vlc_gl_renderer *
 vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
                     vlc_video_context *context, const video_format_t *fmt,
@@ -413,6 +415,13 @@ vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
     vt->GenBuffers(1, &renderer->index_buffer_object);
     vt->GenBuffers(1, &renderer->texture_buffer_object);
 
+    ret = SetupCoords(renderer);
+    if (ret != VLC_SUCCESS)
+    {
+        vlc_gl_renderer_Delete(renderer);
+        return NULL;
+    }
+
     return renderer;
 }
 
@@ -978,10 +987,6 @@ vlc_gl_renderer_Draw(struct vlc_gl_renderer *renderer,
 #undef ROW
         }
 
-        int ret = SetupCoords(renderer);
-        if (ret != VLC_SUCCESS)
-            return ret;
-
         renderer->last_source.i_x_offset = source->i_x_offset;
         renderer->last_source.i_y_offset = source->i_y_offset;
         renderer->last_source.i_visible_width = source->i_visible_width;
-- 
2.25.1



More information about the vlc-devel mailing list