diff --git a/src/blur.cpp b/src/blur.cpp index fd99265ad..94da13455 100644 --- a/src/blur.cpp +++ b/src/blur.cpp @@ -116,7 +116,6 @@ BlurEffect::BlurEffect() m_texture.textureSizeLocation = m_texture.shader->uniformLocation("textureSize"); m_texture.texStartPosLocation = m_texture.shader->uniformLocation("texStartPos"); m_texture.blurSizeLocation = m_texture.shader->uniformLocation("blurSize"); - m_texture.scaleLocation = m_texture.shader->uniformLocation("scale"); m_texture.topCornerRadiusLocation = m_texture.shader->uniformLocation("topCornerRadius"); m_texture.bottomCornerRadiusLocation = m_texture.shader->uniformLocation("bottomCornerRadius"); m_texture.antialiasingLocation = m_texture.shader->uniformLocation("antialiasing"); @@ -985,14 +984,13 @@ void BlurEffect::blur(BlurRenderData &renderInfo, const RenderTarget &renderTarg QRectF screenGeometry; if (m_currentScreen) { - screenGeometry = m_currentScreen->geometryF(); + screenGeometry = scaledRect(m_currentScreen->geometryF(), viewport.scale()); } m_texture.shader->setUniform(m_texture.mvpMatrixLocation, projectionMatrix); m_texture.shader->setUniform(m_texture.textureSizeLocation, QVector2D(staticBlurTexture->size().width(), staticBlurTexture->size().height())); - m_texture.shader->setUniform(m_texture.texStartPosLocation, QVector2D(backgroundRect.x() - screenGeometry.x(), backgroundRect.y() - screenGeometry.y())); - m_texture.shader->setUniform(m_texture.blurSizeLocation, QVector2D(backgroundRect.width(), backgroundRect.height())); - m_texture.shader->setUniform(m_texture.scaleLocation, (float)viewport.scale()); + m_texture.shader->setUniform(m_texture.texStartPosLocation, QVector2D(deviceBackgroundRect.x() - screenGeometry.x(), deviceBackgroundRect.y() - screenGeometry.y())); + m_texture.shader->setUniform(m_texture.blurSizeLocation, QVector2D(deviceBackgroundRect.width(), deviceBackgroundRect.height())); m_texture.shader->setUniform(m_texture.topCornerRadiusLocation, topCornerRadius); m_texture.shader->setUniform(m_texture.bottomCornerRadiusLocation, bottomCornerRadius); m_texture.shader->setUniform(m_texture.antialiasingLocation, m_settings.roundedCorners.antialiasing); diff --git a/src/blur.h b/src/blur.h index bc3251179..6c35fd0e6 100644 --- a/src/blur.h +++ b/src/blur.h @@ -169,7 +169,6 @@ public Q_SLOTS: int mvpMatrixLocation; int textureSizeLocation; int texStartPosLocation; - int scaleLocation; int topCornerRadiusLocation; int bottomCornerRadiusLocation; diff --git a/src/shaders/texture.glsl b/src/shaders/texture.glsl index 706cc8480..d15c19a08 100644 --- a/src/shaders/texture.glsl +++ b/src/shaders/texture.glsl @@ -3,12 +3,11 @@ uniform sampler2D texUnit; uniform vec2 textureSize; uniform vec2 texStartPos; -uniform float scale; varying vec2 uv; void main(void) { - vec2 tex = (texStartPos.xy + vec2(uv.x, 1.0 - uv.y) * blurSize) / textureSize * scale; + vec2 tex = (texStartPos.xy + vec2(uv.x, 1.0 - uv.y) * blurSize) / textureSize; gl_FragColor = roundedRectangle(uv * blurSize, texture2D(texUnit, tex).rgb); } \ No newline at end of file diff --git a/src/shaders/texture_core.glsl b/src/shaders/texture_core.glsl index 9a126bae3..d2828d61e 100644 --- a/src/shaders/texture_core.glsl +++ b/src/shaders/texture_core.glsl @@ -5,7 +5,6 @@ uniform sampler2D texUnit; uniform vec2 textureSize; uniform vec2 texStartPos; -uniform float scale; in vec2 uv; @@ -13,6 +12,6 @@ out vec4 fragColor; void main(void) { - vec2 tex = (texStartPos.xy + vec2(uv.x, 1.0 - uv.y) * blurSize) / textureSize * scale; + vec2 tex = (texStartPos.xy + vec2(uv.x, 1.0 - uv.y) * blurSize) / textureSize; fragColor = roundedRectangle(uv * blurSize, texture(texUnit, tex).rgb); }