From 3cc238f85f54f803bd0aa32ed060b0ba7cff6efc Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Thu, 29 Jun 2023 12:20:18 +0200 Subject: [PATCH] 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 --- src/plugins/backgroundcontrast/contrast.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/backgroundcontrast/contrast.cpp b/src/plugins/backgroundcontrast/contrast.cpp index 4897d72ca1..21adfe6163 100644 --- a/src/plugins/backgroundcontrast/contrast.cpp +++ b/src/plugins/backgroundcontrast/contrast.cpp @@ -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());