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

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:55:42 2012 +0100| [1cf70d1df4a3f785f8b3a737b92b186a06a54d00] | committer: Jean-Baptiste Kempf

Fixed rendering of subpictures with non 0 offset in direct3d.

It is needed for DVD menu support.
(cherry picked from commit 1772a146c2a2b9a76af44e1226765aa8368f3b0e)

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

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

 modules/video_output/msw/direct3d.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index e55de0c..a16ab22 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -1254,10 +1254,12 @@ static void Direct3DImportSubpicture(vout_display_t *vd,
         D3DLOCKED_RECT lock;
         hr = IDirect3DTexture9_LockRect(d3dr->texture, 0, &lock, NULL, 0);
         if (SUCCEEDED(hr)) {
-            uint8_t *dst_data  = lock.pBits;
-            int      dst_pitch = lock.Pitch;
-            uint8_t *src_data  = r->p_picture->p->p_pixels;
-            int      src_pitch = r->p_picture->p->i_pitch;
+            uint8_t  *dst_data   = lock.pBits;
+            int       dst_pitch  = lock.Pitch;
+            const int src_offset = r->fmt.i_y_offset * r->p_picture->p->i_pitch +
+                                   r->fmt.i_x_offset * r->p_picture->p->i_pixel_pitch;
+            uint8_t  *src_data   = &r->p_picture->p->p_pixels[src_offset];
+            int       src_pitch  = r->p_picture->p->i_pitch;
             for (unsigned y = 0; y < r->fmt.i_visible_height; y++) {
                 int copy_pitch = __MIN(dst_pitch, r->p_picture->p->i_visible_pitch);
                 if (d3dr->format == D3DFMT_A8B8G8R8) {



More information about the vlc-commits mailing list