plugins/backgroundcontrast: fix transformations
While the GLFramebuffer::blitFromRenderTarget helper un-applies the transformations the rendertarget has, the effect is not written with that in mind. In order to keep it working properly, blit without any transformations and only adjust the coordinate system difference between texture and fbo
This commit is contained in:
parent
b31baaf0cd
commit
3cc238f85f
1 changed files with 3 additions and 4 deletions
|
@ -453,10 +453,7 @@ void ContrastEffect::doContrast(const RenderTarget &renderTarget, const RenderVi
|
||||||
GLTexture *contrastTexture = windowData.texture.get();
|
GLTexture *contrastTexture = windowData.texture.get();
|
||||||
contrastTexture->bind();
|
contrastTexture->bind();
|
||||||
|
|
||||||
const QRect logicalSourceRect = actualShape.boundingRect();
|
windowData.fbo->blitFromFramebuffer(r.toRect(), QRect(QPoint(), contrastTexture->size()));
|
||||||
windowData.fbo->blitFromRenderTarget(renderTarget, viewport, logicalSourceRect, QRect(0, 0, contrastTexture->width(), contrastTexture->height()));
|
|
||||||
|
|
||||||
// Draw the texture on the offscreen framebuffer object, while blurring it horizontally
|
|
||||||
|
|
||||||
m_shader->setColorMatrix(m_windowData[w].colorMatrix);
|
m_shader->setColorMatrix(m_windowData[w].colorMatrix);
|
||||||
m_shader->bind();
|
m_shader->bind();
|
||||||
|
@ -471,6 +468,8 @@ void ContrastEffect::doContrast(const RenderTarget &renderTarget, const RenderVi
|
||||||
textureMatrix *= renderTarget.transformation();
|
textureMatrix *= renderTarget.transformation();
|
||||||
textureMatrix.translate(-0.5, -0.5);
|
textureMatrix.translate(-0.5, -0.5);
|
||||||
// scaled logical to texture coordinates
|
// scaled logical to texture coordinates
|
||||||
|
textureMatrix.scale(1, -1);
|
||||||
|
textureMatrix.translate(0, -1);
|
||||||
textureMatrix.scale(1.0 / boundingRect.width(), 1.0 / boundingRect.height(), 1);
|
textureMatrix.scale(1.0 / boundingRect.width(), 1.0 / boundingRect.height(), 1);
|
||||||
textureMatrix.translate(-boundingRect.x(), -boundingRect.y(), 0);
|
textureMatrix.translate(-boundingRect.x(), -boundingRect.y(), 0);
|
||||||
textureMatrix.scale(1.0 / viewport.scale(), 1.0 / viewport.scale());
|
textureMatrix.scale(1.0 / viewport.scale(), 1.0 / viewport.scale());
|
||||||
|
|
Loading…
Reference in a new issue