[vlc-commits] Fixed rendering of subpictures with non 0 offset in opengl.

Laurent Aimar git at videolan.org
Thu Jan 5 23:19:07 CET 2012


vlc/vlc-1.2 | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Jan  5 22:54:34 2012 +0100| [2b7431287fc2feb637a5a5176065237707f0ee9d] | committer: Jean-Baptiste Kempf

Fixed rendering of subpictures with non 0 offset in opengl.

It is needed for DVD menu support.
(cherry picked from commit 446263eab3452e84c2c0f7b8725c97585b6f5720)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=2b7431287fc2feb637a5a5176065237707f0ee9d
---

 modules/video_output/opengl.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index dc6c8db..cce95bc 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -569,13 +569,15 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
                 }
             }
 
+            const int pixels_offset = r->fmt.i_y_offset * r->p_picture->p->i_pitch +
+                                      r->fmt.i_x_offset * r->p_picture->p->i_pixel_pitch;
             if (glr->texture) {
                 glBindTexture(GL_TEXTURE_2D, glr->texture);
                 /* TODO set GL_UNPACK_ALIGNMENT */
                 glPixelStorei(GL_UNPACK_ROW_LENGTH, r->p_picture->p->i_pitch / r->p_picture->p->i_pixel_pitch);
                 glTexSubImage2D(GL_TEXTURE_2D, 0,
                                 0, 0, glr->width, glr->height,
-                                glr->format, glr->type, r->p_picture->p->p_pixels);
+                                glr->format, glr->type, &r->p_picture->p->p_pixels[pixels_offset]);
             } else {
                 glGenTextures(1, &glr->texture);
                 glBindTexture(GL_TEXTURE_2D, glr->texture);
@@ -589,7 +591,7 @@ int vout_display_opengl_Prepare(vout_display_opengl_t *vgl,
                 glPixelStorei(GL_UNPACK_ROW_LENGTH, r->p_picture->p->i_pitch / r->p_picture->p->i_pixel_pitch);
                 glTexImage2D(GL_TEXTURE_2D, 0, glr->format,
                              glr->width, glr->height, 0, glr->format, glr->type,
-                             r->p_picture->p->p_pixels);
+                             &r->p_picture->p->p_pixels[pixels_offset]);
             }
         }
     }



More information about the vlc-commits mailing list