summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-06-26 15:51:49 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-06-26 15:51:49 +0000
commitd3bc927fc488b08402ae8fe9ea4e662f13704882 (patch)
tree43689e4dc54e7f0f27881de076fe1fac9856f931 /libvo
parent92542f710b754d56957b267ba5839846a6126190 (diff)
downloadmpv-d3bc927fc488b08402ae8fe9ea4e662f13704882.tar.bz2
mpv-d3bc927fc488b08402ae8fe9ea4e662f13704882.tar.xz
Remove overly complex and unused per-subtexture "dirty" handling
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23669 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/vo_gl2.c89
1 files changed, 12 insertions, 77 deletions
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index 4e5db299c9..fe0f9b83e9 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -68,6 +68,7 @@ static int int_pause;
static uint32_t texture_width;
static uint32_t texture_height;
static int texnumx, texnumy, raw_line_len;
+static int texdirty;
static struct TexSquare * texgrid = NULL;
static GLuint fragprog;
static GLuint lookupTex;
@@ -94,8 +95,6 @@ struct TexSquare
GLuint texobj;
GLuint uvtexobjs[2];
GLfloat fx, fy, fw, fh;
- int isDirty;
- int dirtyXoff, dirtyYoff, dirtyWidth, dirtyHeight;
};
static GLint getInternalFormat(void)
@@ -246,10 +245,8 @@ static int initTextures(void)
tsq->fw = texpercx;
tsq->fh = texpercy;
- tsq->isDirty=GL_FALSE;
tsq->texobj=0;
tsq->uvtexobjs[0] = tsq->uvtexobjs[1] = 0;
- tsq->dirtyXoff=0; tsq->dirtyYoff=0; tsq->dirtyWidth=-1; tsq->dirtyHeight=-1;
glGenTextures (1, &(tsq->texobj));
@@ -305,68 +302,6 @@ static void resetTexturePointers(unsigned char *imageSource)
} /* for all texnumy */
}
-static void setupTextureDirtyArea(int x, int y, int w,int h)
-{
- struct TexSquare *square;
- int xi, yi, wd, ht, wh, hh;
- int wdecr, hdecr, xh, yh;
-
- wdecr=w; hdecr=h; xh=x; yh=y;
-
- for (yi = 0; hdecr>0 && yi < texnumy; yi++)
- {
- if (yi < texnumy - 1)
- ht = texture_height;
- else
- ht = image_height - texture_height * yi;
-
- xh =x;
- wdecr =w;
-
- for (xi = 0; wdecr>0 && xi < texnumx; xi++)
- {
- square = texgrid + yi * texnumx + xi;
-
- if (xi < texnumx - 1)
- wd = texture_width;
- else
- wd = image_width - texture_width * xi;
-
- if( 0 <= xh && xh < wd &&
- 0 <= yh && yh < ht
- )
- {
- square->isDirty=GL_TRUE;
-
- wh=(wdecr<wd)?wdecr:wd-xh;
- if(wh<0) wh=0;
-
- hh=(hdecr<ht)?hdecr:ht-yh;
- if(hh<0) hh=0;
-
- if(xh<square->dirtyXoff)
- square->dirtyXoff=xh;
-
- if(yh<square->dirtyYoff)
- square->dirtyYoff=yh;
-
- square->dirtyWidth = wd-square->dirtyXoff;
- square->dirtyHeight = ht-square->dirtyYoff;
-
- wdecr-=wh;
-
- if ( xi == texnumx - 1 )
- hdecr-=hh;
- }
-
- xh-=wd;
- if(xh<0) xh=0;
- }
- yh-=ht;
- if(yh<0) yh=0;
- }
-}
-
static void gl_set_bilinear (int val)
{
int x, y;
@@ -455,8 +390,14 @@ static void drawTextureDisplay (void)
glEnableYUVConversion(GL_TEXTURE_2D, use_yuv);
for (y = 0; y < texnumy; y++)
{
+ int thish = texture_height;
+ if (y == texnumy - 1 && image_height % texture_height)
+ thish = image_height % texture_height;
for (x = 0; x < texnumx; x++)
{
+ int thisw = texture_width;
+ if (x == texnumx - 1 && image_width % texture_width)
+ thisw = image_width % texture_width;
glBindTexture (GL_TEXTURE_2D, square->texobj);
if (image_format == IMGFMT_YV12) {
ActiveTexture(GL_TEXTURE1);
@@ -466,21 +407,14 @@ static void drawTextureDisplay (void)
ActiveTexture(GL_TEXTURE0);
}
- if(square->isDirty)
- {
+ if (texdirty) {
glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type,
square->texture, image_width * image_bytes,
- square->dirtyXoff, square->dirtyYoff,
- square->dirtyWidth, square->dirtyHeight,
+ 0, 0,
+ thisw, thish,
0);
-
- square->isDirty=GL_FALSE;
- square->dirtyXoff=0; square->dirtyYoff=0; square->dirtyWidth=-1; square->dirtyHeight=-1;
}
- mp_msg (MSGT_VO, MSGL_DBG2, "[gl2] glTexSubImage2D texnum x=%d, y=%d, %d/%d - %d/%d\n",
- x, y, square->dirtyXoff, square->dirtyYoff, square->dirtyWidth, square->dirtyHeight);
-
glDrawTex(square->fx, square->fy, square->fw, square->fh,
0, 0, texture_width, texture_height,
texture_width, texture_height,
@@ -490,6 +424,7 @@ static void drawTextureDisplay (void)
} /* for all texnumy */
if (image_format == IMGFMT_YV12)
glDisableYUVConversion(GL_TEXTURE_2D, use_yuv);
+ texdirty = 0;
}
@@ -947,7 +882,7 @@ draw_frame(uint8_t *src[])
}
ImageData=(unsigned char *)src[0];
resetTexturePointers(ImageData);
- setupTextureDirtyArea(0, 0, image_width, image_height);
+ texdirty = 1;
return 0;
}