Ignore Paint Clipper when rendering to FBO.

See Review Request http://svn.reviewboard.kde.org/r/4329/

svn path=/trunk/KDE/kdebase/workspace/; revision=1191903
icc-effect-5.14.5
Martin Gräßlin 2010-11-01 12:09:53 +00:00
parent 3e689ff201
commit 382d5b15d3
5 changed files with 29 additions and 7 deletions

View File

@ -784,6 +784,15 @@ GLRenderTarget* EffectsHandlerImpl::popRenderTarget()
#endif
}
bool EffectsHandlerImpl::isRenderTargetBound()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
return !render_targets.isEmpty();
#else
return false;
#endif
}
void EffectsHandlerImpl::addRepaintFull()
{
Workspace::self()->addRepaintFull();

View File

@ -110,6 +110,7 @@ class EffectsHandlerImpl : public EffectsHandler
virtual void pushRenderTarget(GLRenderTarget* target);
virtual GLRenderTarget* popRenderTarget();
virtual bool isRenderTargetBound();
virtual void addRepaintFull();
virtual void addRepaint( const QRect& r );

View File

@ -844,7 +844,8 @@ PaintClipper::Iterator::Iterator()
if( clip() && effects->compositingType() == OpenGLCompositing )
{
glPushAttrib( GL_SCISSOR_BIT );
glEnable( GL_SCISSOR_TEST );
if( !effects->isRenderTargetBound() )
glEnable( GL_SCISSOR_TEST );
data->rects = paintArea().rects();
data->index = -1;
next(); // move to the first one
@ -892,7 +893,7 @@ void PaintClipper::Iterator::next()
{
data->index++;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if( clip() && effects->compositingType() == OpenGLCompositing && data->index < data->rects.count())
if( clip() && effects->compositingType() == OpenGLCompositing && !effects->isRenderTargetBound() && data->index < data->rects.count())
{
const QRect& r = data->rects[ data->index ];
// Scissor rect has to be given in OpenGL coords

View File

@ -171,7 +171,7 @@ X-KDE-Library=kwin4_effect_cooleffect
#define KWIN_EFFECT_API_MAKE_VERSION( major, minor ) (( major ) << 8 | ( minor ))
#define KWIN_EFFECT_API_VERSION_MAJOR 0
#define KWIN_EFFECT_API_VERSION_MINOR 155
#define KWIN_EFFECT_API_VERSION_MINOR 156
#define KWIN_EFFECT_API_VERSION KWIN_EFFECT_API_MAKE_VERSION( \
KWIN_EFFECT_API_VERSION_MAJOR, KWIN_EFFECT_API_VERSION_MINOR )
@ -757,6 +757,7 @@ class KWIN_EXPORT EffectsHandler
virtual void pushRenderTarget(GLRenderTarget* target) = 0;
virtual GLRenderTarget* popRenderTarget() = 0;
virtual bool isRenderTargetBound() = 0;
/**
* Schedules the entire workspace to be repainted next time.

View File

@ -174,10 +174,20 @@ void renderGLGeometry( const QRegion& region, int count,
}
// Clip using scissoring
PaintClipper pc( region );
for( PaintClipper::Iterator iterator;
!iterator.isDone();
iterator.next())
if( !effects->isRenderTargetBound() )
{
PaintClipper pc( region );
for( PaintClipper::Iterator iterator;
!iterator.isDone();
iterator.next())
{
if( use_arrays )
glDrawArrays( GL_QUADS, 0, count );
else
renderGLGeometryImmediate( count, vertices, texture, color, dim, stride );
}
}
else
{
if( use_arrays )
glDrawArrays( GL_QUADS, 0, count );