From ca4e501dc06accd4a44c69a5e289ca25d65999cd Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 8 May 2004 21:38:41 +0000 Subject: [PATCH] changes to get manyfmts nearer to working and fixed memory leak git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12446 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 55b32b5dc8..e8a9b5525d 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -32,9 +32,6 @@ static vo_info_t info = LIBVO_EXTERN(gl) -/* local data */ -static unsigned char *ImageData=NULL; - static GLXContext wsGLXContext; static int wsGLXAttrib[] = { GLX_RGBA, GLX_RED_SIZE,1, @@ -48,6 +45,7 @@ static uint32_t image_width; static uint32_t image_height; static uint32_t image_bytes; static int many_fmts; +static GLenum gl_texfmt; static GLenum gl_format; static GLenum gl_type; @@ -72,17 +70,22 @@ static void resize(int x,int y){ static int find_gl_format (uint32_t format) { + image_bytes = (IMGFMT_RGB_DEPTH(format)+7)/8; + gl_texfmt = 3; switch (format) { case IMGFMT_RGB24: gl_format = GL_RGB; gl_type = GL_UNSIGNED_BYTE; break; case IMGFMT_RGB32: + gl_texfmt = 4; gl_format = GL_RGBA; gl_type = GL_UNSIGNED_BYTE; break; case IMGFMT_Y800: case IMGFMT_Y8: + gl_texfmt = 1; + image_bytes = 1; gl_format = GL_LUMINANCE; gl_type = GL_UNSIGNED_BYTE; break; @@ -120,15 +123,20 @@ static int find_gl_format (uint32_t format) gl_type = GL_UNSIGNED_BYTE; break; case IMGFMT_BGR32: + gl_texfmt = 4; gl_format = GL_BGRA; gl_type = GL_UNSIGNED_BYTE; break; #endif default: + gl_texfmt = 4; gl_format = GL_RGBA; gl_type = GL_UNSIGNED_BYTE; return 0; } +#ifdef TEXTUREFORMAT_32BPP + gl_texfmt = GL_RGB8; +#endif return 1; } @@ -138,6 +146,7 @@ static int find_gl_format (uint32_t format) static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format) { + unsigned char *ImageData=NULL; // int screen; unsigned int fg, bg; XSizeHints hint; @@ -230,9 +239,6 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin while(texture_width