diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-12-18 12:04:08 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-12-18 12:04:08 +0000 |
commit | 2a15e8beb88ad6d39447308eec9ed802b83788de (patch) | |
tree | e37474436aa10df08dd8ea5dc7ac0dea4ca9b577 /libvo/gl_common.c | |
parent | 06ed3c2b57c5088d3b35af67f047d5ed3192d72c (diff) | |
download | mpv-2a15e8beb88ad6d39447308eec9ed802b83788de.tar.bz2 mpv-2a15e8beb88ad6d39447308eec9ed802b83788de.tar.xz |
support negative stride (flipping) in vo_gl.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17221 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo/gl_common.c')
-rw-r--r-- | libvo/gl_common.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libvo/gl_common.c b/libvo/gl_common.c index a885159abd..7f8f719a00 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -493,6 +493,10 @@ void glUploadTex(GLenum target, GLenum format, GLenum type, if (w <= 0 || h <= 0) return; if (slice <= 0) slice = h; + if (stride < 0) { + data += h * stride; + stride = -stride; + } // this is not always correct, but should work for MPlayer glAdjustAlignment(stride); glPixelStorei(GL_UNPACK_ROW_LENGTH, stride / glFmt2bpp(format, type)); @@ -910,16 +914,21 @@ void inline glDisableYUVConversion(GLenum target, int type) { * \param sy height of texture in pixels * \param rect_tex whether this texture uses texture_rectangle extension * \param is_yv12 if set, also draw the textures from units 1 and 2 + * \param flip flip the texture upside down * \ingroup gltexture */ void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h, GLfloat tx, GLfloat ty, GLfloat tw, GLfloat th, - int sx, int sy, int rect_tex, int is_yv12) { + int sx, int sy, int rect_tex, int is_yv12, int flip) { GLfloat tx2 = tx / 2, ty2 = ty / 2, tw2 = tw / 2, th2 = th / 2; if (!rect_tex) { tx /= sx; ty /= sy; tw /= sx; th /= sy; tx2 = tx, ty2 = ty, tw2 = tw, th2 = th; } + if (flip) { + y += h; + h = -h; + } glBegin(GL_QUADS); glTexCoord2f(tx, ty); if (is_yv12) { |