changeset 13575:d3ef52aafb54

fixed UNPACK_ALIGNMENT setting.
author reimar
date Wed, 06 Oct 2004 16:48:19 +0000
parents ae638e3c2808
children 5a6e222fec86
files libvo/vo_gl.c libvo/vo_gl2.c
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Wed Oct 06 16:46:35 2004 +0000
+++ b/libvo/vo_gl.c	Wed Oct 06 16:48:19 2004 +0000
@@ -248,6 +248,17 @@
 
   glEnable(GL_TEXTURE_2D);
 
+  // set alignment as default is 4 which will break some files
+  if ((image_width * image_bytes) % 8 == 0)
+    gl_alignment=8;
+  else if ((image_width * image_bytes) % 4 == 0)
+    gl_alignment=4;
+  else if ((image_width * image_bytes) % 2 == 0)
+    gl_alignment=2;
+  else
+    gl_alignment=1;
+  glPixelStorei (GL_UNPACK_ALIGNMENT, gl_alignment);
+
   mp_msg(MSGT_VO, MSGL_V, "[gl] Creating %dx%d texture...\n",texture_width,texture_height);
 
 #if 1
--- a/libvo/vo_gl2.c	Wed Oct 06 16:46:35 2004 +0000
+++ b/libvo/vo_gl2.c	Wed Oct 06 16:48:19 2004 +0000
@@ -819,12 +819,13 @@
 
   /**
    * may give a little speed up for a kinda burst read ..
+   * Also, the default of 4 will break some files.
    */
-  if( (image_width*image_bpp)%8 == 0 )
+  if( (image_width*image_bytes)%8 == 0 )
   	gl_alignment=8;
-  else if( (image_width*image_bpp)%4 == 0 )
+  else if( (image_width*image_bytes)%4 == 0 )
   	gl_alignment=4;
-  else if( (image_width*image_bpp)%2 == 0 )
+  else if( (image_width*image_bytes)%2 == 0 )
   	gl_alignment=2;
   else
   	gl_alignment=1;