Mercurial > mplayer.hg
diff libvo/vo_gl2.c @ 12448:180c2fb327d3
removing useless code, improving readability
author | reimar |
---|---|
date | Sat, 08 May 2004 23:53:20 +0000 |
parents | 59cd81e2e1ef |
children | bd90b887fb13 |
line wrap: on
line diff
--- a/libvo/vo_gl2.c Sat May 08 23:41:13 2004 +0000 +++ b/libvo/vo_gl2.c Sat May 08 23:53:20 2004 +0000 @@ -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 ..