GLTexture::render(), to render to a given QRect
svn path=/branches/work/kwin_composite/; revision=656521
This commit is contained in:
parent
cd98bc12d5
commit
ffc75a2214
5 changed files with 30 additions and 53 deletions
|
@ -44,25 +44,7 @@ void ShowPictureEffect::paintScreen( int mask, QRegion region, ScreenPaintData&
|
||||||
picture->bind();
|
picture->bind();
|
||||||
glEnable( GL_BLEND );
|
glEnable( GL_BLEND );
|
||||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
int x = pictureRect.x();
|
picture->render( mask, region, pictureRect );
|
||||||
int y = pictureRect.y();
|
|
||||||
int width = pictureRect.width();
|
|
||||||
int height = pictureRect.height();
|
|
||||||
const float verts[ 4 * 2 ] =
|
|
||||||
{
|
|
||||||
x, y,
|
|
||||||
x, y + height,
|
|
||||||
x + width, y + height,
|
|
||||||
x + width, y
|
|
||||||
};
|
|
||||||
const float texcoords[ 4 * 2 ] =
|
|
||||||
{
|
|
||||||
0, 1,
|
|
||||||
0, 0,
|
|
||||||
1, 0,
|
|
||||||
1, 1
|
|
||||||
};
|
|
||||||
renderGLGeometry( mask, region, verts, texcoords, 4 );
|
|
||||||
picture->unbind();
|
picture->unbind();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,25 +127,7 @@ void PresentWindowsEffect::paintScreen( int mask, QRegion region, ScreenPaintDat
|
||||||
filterTexture->bind();
|
filterTexture->bind();
|
||||||
glEnable( GL_BLEND );
|
glEnable( GL_BLEND );
|
||||||
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||||
int x = filterTextureRect.x();
|
filterTexture->render( mask, region, filterTextureRect );
|
||||||
int y = filterTextureRect.y();
|
|
||||||
int width = filterTextureRect.width();
|
|
||||||
int height = filterTextureRect.height();
|
|
||||||
const float verts[ 4 * 2 ] =
|
|
||||||
{
|
|
||||||
x, y,
|
|
||||||
x, y + height,
|
|
||||||
x + width, y + height,
|
|
||||||
x + width, y
|
|
||||||
};
|
|
||||||
const float texcoords[ 4 * 2 ] =
|
|
||||||
{
|
|
||||||
0, 1,
|
|
||||||
0, 0,
|
|
||||||
1, 0,
|
|
||||||
1, 1
|
|
||||||
};
|
|
||||||
renderGLGeometry( mask, region, verts, texcoords, 4 );
|
|
||||||
filterTexture->unbind();
|
filterTexture->unbind();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,21 +67,7 @@ void TrackMouseEffect::paintScreen( int mask, QRegion region, ScreenPaintData& d
|
||||||
++i )
|
++i )
|
||||||
{
|
{
|
||||||
QRect r = starRect( i );
|
QRect r = starRect( i );
|
||||||
const float verts[ 4 * 2 ] =
|
texture->render( mask, region, r );
|
||||||
{
|
|
||||||
r.x(), r.y(),
|
|
||||||
r.x(), r.y() + r.height(),
|
|
||||||
r.x() + r.width(), r.y() + r.height(),
|
|
||||||
r.x() + r.width(), r.y()
|
|
||||||
};
|
|
||||||
const float texcoords[ 4 * 2 ] =
|
|
||||||
{
|
|
||||||
0, 1,
|
|
||||||
0, 0,
|
|
||||||
1, 0,
|
|
||||||
1, 1
|
|
||||||
};
|
|
||||||
renderGLGeometry( mask, region, verts, texcoords, 4 );
|
|
||||||
}
|
}
|
||||||
texture->unbind();
|
texture->unbind();
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
|
|
|
@ -315,6 +315,31 @@ void GLTexture::unbind()
|
||||||
glDisable( mTarget );
|
glDisable( mTarget );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GLTexture::render( int mask, QRegion region, const QRect& rect )
|
||||||
|
{
|
||||||
|
return render( !( mask & ( Effect::PAINT_WINDOW_TRANSFORMED | Effect::PAINT_SCREEN_TRANSFORMED )),
|
||||||
|
region, rect );
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLTexture::render( bool clip, QRegion region, const QRect& rect )
|
||||||
|
{
|
||||||
|
const float verts[ 4 * 2 ] =
|
||||||
|
{
|
||||||
|
rect.x(), rect.y(),
|
||||||
|
rect.x(), rect.y() + rect.height(),
|
||||||
|
rect.x() + rect.width(), rect.y() + rect.height(),
|
||||||
|
rect.x() + rect.width(), rect.y()
|
||||||
|
};
|
||||||
|
const float texcoords[ 4 * 2 ] =
|
||||||
|
{
|
||||||
|
0, 1,
|
||||||
|
0, 0,
|
||||||
|
1, 0,
|
||||||
|
1, 1
|
||||||
|
};
|
||||||
|
renderGLGeometry( clip, region, verts, texcoords, 4 );
|
||||||
|
}
|
||||||
|
|
||||||
void GLTexture::enableUnnormalizedTexCoords()
|
void GLTexture::enableUnnormalizedTexCoords()
|
||||||
{
|
{
|
||||||
// update texture matrix to handle GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE
|
// update texture matrix to handle GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE
|
||||||
|
|
|
@ -87,6 +87,8 @@ class KWIN_EXPORT GLTexture
|
||||||
virtual void discard();
|
virtual void discard();
|
||||||
virtual void bind();
|
virtual void bind();
|
||||||
virtual void unbind();
|
virtual void unbind();
|
||||||
|
void render( bool clip, QRegion region, const QRect& rect );
|
||||||
|
void render( int mask, QRegion region, const QRect& rect );
|
||||||
void enableUnnormalizedTexCoords();
|
void enableUnnormalizedTexCoords();
|
||||||
void disableUnnormalizedTexCoords();
|
void disableUnnormalizedTexCoords();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue