Use shader traits API to render cached texture in lanczos filter

This commit is contained in:
Martin Gräßlin 2015-12-01 09:52:09 +01:00
parent 2f5de22ac8
commit 99739106d1

View file

@ -213,9 +213,11 @@ void LanczosFilter::performPaint(EffectWindowImpl* w, int mask, QRegion region,
const qreal rgb = data.brightness() * data.opacity(); const qreal rgb = data.brightness() * data.opacity();
const qreal a = data.opacity(); const qreal a = data.opacity();
ShaderBinder binder(ShaderManager::SimpleShader); ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::Modulate | ShaderTrait::AdjustSaturation);
GLShader *shader = binder.shader(); 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::ModulationConstant, QVector4D(rgb, rgb, rgb, a));
shader->setUniform(GLShader::Saturation, data.saturation()); 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 rgb = data.brightness() * data.opacity();
const qreal a = data.opacity(); const qreal a = data.opacity();
ShaderBinder binder(ShaderManager::SimpleShader); ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::Modulate | ShaderTrait::AdjustSaturation);
GLShader *shader = binder.shader(); 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::ModulationConstant, QVector4D(rgb, rgb, rgb, a));
shader->setUniform(GLShader::Saturation, data.saturation()); shader->setUniform(GLShader::Saturation, data.saturation());