From 9cb666f469ce41747ae5b433ad998ad0c57c7687 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 6 Mar 2017 00:39:41 +0000 Subject: [PATCH] Restore the backend set viewport when popping the final render target Summary: The backend is responsible for setting the viewport, the GLRenderTarget should save and restore the viewport actually set by the backend. Test Plan: Ran Blur effect which uses this method, under scaling the viewport "restored" differed from the one set by the backend. Reviewers: #plasma Subscribers: plasma-devel, kwin, #kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D4952 --- libkwineffects/kwinglutils.cpp | 8 +++++--- libkwineffects/kwinglutils.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index b7514e1490..cbf2a74842 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -1038,6 +1038,7 @@ QStack GLRenderTarget::s_renderTargets = QStackenable(); s_renderTargets.push(target); } @@ -1086,10 +1090,8 @@ GLRenderTarget* GLRenderTarget::popRenderTarget() if (!s_renderTargets.isEmpty()) { s_renderTargets.top()->enable(); } else { - glViewport (-s_virtualScreenGeometry.x(), s_virtualScreenGeometry.height() - s_virtualScreenSize.height() - s_virtualScreenGeometry.y(), - s_virtualScreenSize.width(), s_virtualScreenSize.height()); + glViewport (s_virtualScreenViewport[0], s_virtualScreenViewport[1], s_virtualScreenViewport[2], s_virtualScreenViewport[3]); } - return ret; } diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h index 9d1935544e..da2bedfc7f 100644 --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -534,6 +534,7 @@ private: static QSize s_virtualScreenSize; static QRect s_virtualScreenGeometry; static qreal s_virtualScreenScale; + static GLint s_virtualScreenViewport[4]; GLTexture mTexture; bool mValid;