From 27821e3c76e958a4a30251b20ebe7948a03560fb Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 20 Dec 2023 16:48:45 +0200 Subject: [PATCH] plugins/screenshot: Invert render transforms in the correct order The render transform is applied first, after that, the texture is flipped implicitly by opengl. So in order to undo these transforms, we need to flip the image vertically first, then undo the render target transform. --- src/plugins/screenshot/screenshot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/screenshot/screenshot.cpp b/src/plugins/screenshot/screenshot.cpp index 1a36a720b5..1174aeae9c 100644 --- a/src/plugins/screenshot/screenshot.cpp +++ b/src/plugins/screenshot/screenshot.cpp @@ -76,10 +76,10 @@ static void convertFromGLImage(QImage &img, int w, int h, const OutputTransform } QMatrix4x4 matrix; - // OpenGL textures are flipped vs QImage - matrix.scale(1, -1); // apply render target transformation matrix *= renderTargetTransformation.inverted().toMatrix(); + // OpenGL textures are flipped vs QImage + matrix.scale(1, -1); img = img.transformed(matrix.toTransform()); }