From 99739106d16bd68764a06b99591f9eace85dde88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 1 Dec 2015 09:52:09 +0100 Subject: [PATCH] Use shader traits API to render cached texture in lanczos filter --- lanczosfilter.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lanczosfilter.cpp b/lanczosfilter.cpp index 71cdcfacf1..e6054b812f 100644 --- a/lanczosfilter.cpp +++ b/lanczosfilter.cpp @@ -213,9 +213,11 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, const qreal rgb = data.brightness() * data.opacity(); const qreal a = data.opacity(); - ShaderBinder binder(ShaderManager::SimpleShader); + ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::Modulate | ShaderTrait::AdjustSaturation); GLShader *shader = binder.shader(); - shader->setUniform(GLShader::Offset, QVector2D(0, 0)); + QMatrix4x4 mvp = data.screenProjectionMatrix(); + mvp.translate(textureRect.x(), textureRect.y()); + shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp); shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); shader->setUniform(GLShader::Saturation, data.saturation()); @@ -344,9 +346,11 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region, const qreal rgb = data.brightness() * data.opacity(); const qreal a = data.opacity(); - ShaderBinder binder(ShaderManager::SimpleShader); + ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::Modulate | ShaderTrait::AdjustSaturation); GLShader *shader = binder.shader(); - shader->setUniform(GLShader::Offset, QVector2D(0, 0)); + QMatrix4x4 mvp = data.screenProjectionMatrix(); + mvp.translate(textureRect.x(), textureRect.y()); + shader->setUniform(GLShader::ModelViewProjectionMatrix, mvp); shader->setUniform(GLShader::ModulationConstant, QVector4D(rgb, rgb, rgb, a)); shader->setUniform(GLShader::Saturation, data.saturation());