[Mplayer-cvslog] CVS: main/libvo vo_gl2.c,1.44,1.45

Reimar Döffinger CVS syncmail at mplayerhq.hu
Sun May 9 01:53:23 CEST 2004


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv16077

Modified Files:
	vo_gl2.c 
Log Message:
removing useless code, improving readability


Index: vo_gl2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl2.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- vo_gl2.c	8 May 2004 21:40:20 -0000	1.44
+++ vo_gl2.c	8 May 2004 23:53:20 -0000	1.45
@@ -81,7 +81,7 @@
 
 static uint32_t texture_width;
 static uint32_t texture_height;
-static int texnumx, texnumy, memory_x_len, memory_x_start_offset, raw_line_len;
+static int texnumx, texnumy, raw_line_len;
 static GLfloat texpercx, texpercy;
 static struct TexSquare * texgrid;
 static GLint    gl_internal_format;
@@ -114,6 +114,8 @@
   int dirtyXoff, dirtyYoff, dirtyWidth, dirtyHeight;
 };
 
+static void resetTexturePointers(unsigned char *imageSource);
+
 static void CalcFlatPoint(int x,int y,GLfloat *px,GLfloat *py)
 {
   *px=(float)x*texpercx;
@@ -124,7 +126,6 @@
 
 static int initTextures()
 {
-  unsigned char *line_1=0, *line_2=0, *mem_start=0;
   struct TexSquare *tsq=0;
   int e_x, e_y, s, i=0;
   int x=0, y=0;
@@ -209,14 +210,7 @@
   texgrid = (struct TexSquare *)
     calloc (texnumx * texnumy, sizeof (struct TexSquare));
 
-  line_1 = (unsigned char *) ImageData;
-  line_2 = (unsigned char *) ImageData+(image_width*image_bytes);
-
-  mem_start = (unsigned char *) ImageData;
-
-  raw_line_len = line_2 - line_1;
-
-  memory_x_len = raw_line_len / image_bytes;
+  raw_line_len = image_width * image_bytes;
 
   mp_msg (MSGT_VO, MSGL_DBG2, "[gl2] texture-usage %d*width=%d, %d*height=%d\n",
 		 (int) texnumx, (int) texture_width, (int) texnumy,
@@ -245,16 +239,6 @@
       CalcFlatPoint (x + 1, y + 1, &(tsq->fx3), &(tsq->fy3));
       CalcFlatPoint (x, y + 1, &(tsq->fx4), &(tsq->fy4));
 
-      /* calculate the pixel store data,
-         to use the machine-bitmap for our texture 
-      */
-      memory_x_start_offset = 0 * image_bytes + 
-                              x * texture_width * image_bytes;
-
-      tsq->texture = line_1 +                           
-		     y * texture_height * raw_line_len +  
-		     memory_x_start_offset;           
-
       tsq->isDirty=GL_TRUE;
       tsq->isTexture=GL_FALSE;
       tsq->texobj=0;
@@ -294,38 +278,29 @@
 
     }	/* for all texnumx */
   }  /* for all texnumy */
+  resetTexturePointers (ImageData);
   
   return 0;
 }
 
 static void resetTexturePointers(unsigned char *imageSource)
 {
-  unsigned char *line_1=0, *line_2=0, *mem_start=0;
-  struct TexSquare *tsq=0;
+  unsigned char *texdata_start, *line_start;
+  struct TexSquare *tsq = texgrid;
   int x=0, y=0;
 
-  line_1 = (unsigned char *) imageSource;
-  line_2 = (unsigned char *) imageSource+(image_width*image_bytes);
-
-  mem_start = (unsigned char *) imageSource;
+  line_start = (unsigned char *) imageSource;
 
   for (y = 0; y < texnumy; y++)
   {
+    texdata_start = line_start;
     for (x = 0; x < texnumx; x++)
     {
-      tsq = texgrid + y * texnumx + x;
-
-      /* calculate the pixel store data,
-         to use the machine-bitmap for our texture 
-      */
-      memory_x_start_offset = 0 * image_bytes + 
-                              x * texture_width * image_bytes;
-
-      tsq->texture = line_1 +                           
-		     y * texture_height * raw_line_len +  
-		     memory_x_start_offset;           
-
+      tsq->texture = texdata_start;
+      texdata_start += texture_width * image_bytes;
+      tsq++;
     }	/* for all texnumx */
+    line_start += texture_height * raw_line_len;
   }  /* for all texnumy */
 }
 
@@ -823,7 +798,7 @@
   glDepthMask(GL_FALSE);
   glDisable(GL_CULL_FACE);
 
-  glPixelStorei (GL_UNPACK_ROW_LENGTH, memory_x_len);
+  glPixelStorei (GL_UNPACK_ROW_LENGTH, image_width);
 
   /**
    * may give a little speed up for a kinda burst read ..




More information about the MPlayer-cvslog mailing list