diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-10 18:35:29 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-07-10 18:35:29 +0000 |
commit | e473bae3df0b994de8d48bc44a05537c12d75d70 (patch) | |
tree | 37e5b5c7a1ada10c2aacc772820f1cd158dac10b /libvo | |
parent | a677c0b41fa837b957f871ed2f3dc83ee3fa82ee (diff) | |
download | mpv-e473bae3df0b994de8d48bc44a05537c12d75d70.tar.bz2 mpv-e473bae3df0b994de8d48bc44a05537c12d75d70.tar.xz |
Fix negative stride handling in -dr case
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19000 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_gl.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index ef618801d5..56e1273b1b 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -625,27 +625,31 @@ static uint32_t get_image(mp_image_t *mpi) { } static uint32_t draw_image(mp_image_t *mpi) { - unsigned char *data = mpi->planes[0]; int slice = slice_height; + int stride[3] = {mpi->stride[0], mpi->stride[1], mpi->stride[2]}; + unsigned char *planes[3] = {mpi->planes[0], mpi->planes[1], mpi->planes[2]}; if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) return VO_TRUE; + mpi_flipped = (stride[0] < 0); if (mpi->flags & MP_IMGFLAG_DIRECT) { - data = NULL; + intptr_t base = (intptr_t)planes[0]; + if (mpi_flipped) + base += (mpi->h - 1) * stride[0]; + planes[0] -= base; + planes[1] -= base; + planes[2] -= base; BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer); UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); slice = 0; // always "upload" full texture } - mpi_flipped = (mpi->stride[0] < 0); - glUploadTex(gl_target, gl_format, gl_type, data, mpi->stride[0], + glUploadTex(gl_target, gl_format, gl_type, planes[0], stride[0], mpi->x, mpi->y, mpi->w, mpi->h, slice); if (mpi->imgfmt == IMGFMT_YV12) { - data += mpi->planes[1] - mpi->planes[0]; ActiveTexture(GL_TEXTURE1); - glUploadTex(gl_target, gl_format, gl_type, data, mpi->stride[1], + glUploadTex(gl_target, gl_format, gl_type, planes[1], stride[1], mpi->x / 2, mpi->y / 2, mpi->w / 2, mpi->h / 2, slice); - data += mpi->planes[2] - mpi->planes[1]; ActiveTexture(GL_TEXTURE2); - glUploadTex(gl_target, gl_format, gl_type, data, mpi->stride[2], + glUploadTex(gl_target, gl_format, gl_type, planes[2], stride[2], mpi->x / 2, mpi->y / 2, mpi->w / 2, mpi->h / 2, slice); ActiveTexture(GL_TEXTURE0); } |