[effects] Use shader traits in ShowPaint effect

This commit is contained in:
Martin Gräßlin 2015-11-26 16:25:00 +01:00
parent b757b7e17d
commit 2de0b527d0
2 changed files with 5 additions and 4 deletions

View file

@ -54,7 +54,7 @@ void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat
painted = QRegion();
effects->paintScreen(mask, region, data);
if (effects->isOpenGLCompositing())
paintGL();
paintGL(data.projectionMatrix());
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
if (effects->compositingType() == XRenderCompositing)
paintXrender();
@ -72,12 +72,13 @@ void ShowPaintEffect::paintWindow(EffectWindow* w, int mask, QRegion region, Win
effects->paintWindow(w, mask, region, data);
}
void ShowPaintEffect::paintGL()
void ShowPaintEffect::paintGL(const QMatrix4x4 &projection)
{
GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer();
vbo->reset();
vbo->setUseColor(true);
ShaderBinder binder(ShaderManager::ColorShader);
ShaderBinder binder(ShaderTrait::UniformColor);
binder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, projection);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
QColor color = colors[ color_index ];

View file

@ -35,7 +35,7 @@ public:
virtual void paintScreen(int mask, QRegion region, ScreenPaintData& data);
virtual void paintWindow(EffectWindow* w, int mask, QRegion region, WindowPaintData& data);
private:
void paintGL();
void paintGL(const QMatrix4x4 &projection);
void paintXrender();
void paintQPainter();
QRegion painted; // what's painted in one pass