ShowPaint uses the shared buffer

This commit is contained in:
Martin Gräßlin 2010-12-11 15:53:15 +01:00
parent 45f42cdea9
commit ecc4f83c09
2 changed files with 4 additions and 19 deletions

View file

@ -45,26 +45,11 @@ static QColor colors[] = { Qt::red, Qt::green, Qt::blue, Qt::cyan, Qt::magenta,
ShowPaintEffect::ShowPaintEffect()
: color_index( 0 )
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
, vbo( 0 )
#endif
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
if (effects->compositingType() == OpenGLCompositing) {
vbo = new GLVertexBuffer(GLVertexBuffer::Stream);
vbo->setUseColor(true);
if (ShaderManager::instance()->isValid()) {
vbo->setUseShader(true);
}
}
#endif
}
ShowPaintEffect::~ShowPaintEffect()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
delete vbo;
#endif
}
void ShowPaintEffect::paintScreen( int mask, QRegion region, ScreenPaintData& data )
@ -95,8 +80,12 @@ void ShowPaintEffect::paintGL()
#ifndef KWIN_HAVE_OPENGLES
glPushAttrib( GL_CURRENT_BIT | GL_ENABLE_BIT );
#endif
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->reset();
vbo->setUseColor(true);
if (ShaderManager::instance()->isValid()) {
ShaderManager::instance()->pushShader(ShaderManager::ColorShader);
vbo->setUseShader(true);
}
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

View file

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace KWin
{
class GLVertexBuffer;
class ShowPaintEffect
: public Effect
@ -40,9 +39,6 @@ class ShowPaintEffect
void paintXrender();
QRegion painted; // what's painted in one pass
int color_index;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
GLVertexBuffer *vbo;
#endif
};
} // namespace