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:
Xaver Hugl 2023-06-29 12:20:18 +02:00
parent b31baaf0cd
commit 3cc238f85f

View file

@ -453,10 +453,7 @@ void ContrastEffect::doContrast(const RenderTarget &renderTarget, const RenderVi
GLTexture *contrastTexture = windowData.texture.get();
contrastTexture->bind();
const QRect logicalSourceRect = actualShape.boundingRect();
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
windowData.fbo->blitFromFramebuffer(r.toRect(), QRect(QPoint(), contrastTexture->size()));
m_shader->setColorMatrix(m_windowData[w].colorMatrix);
m_shader->bind();
@ -471,6 +468,8 @@ void ContrastEffect::doContrast(const RenderTarget &renderTarget, const RenderVi
textureMatrix *= renderTarget.transformation();
textureMatrix.translate(-0.5, -0.5);
// 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.translate(-boundingRect.x(), -boundingRect.y(), 0);
textureMatrix.scale(1.0 / viewport.scale(), 1.0 / viewport.scale());