From ea4741cbcc452b2dc72a653e91aea9fe002c606d Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 2 Nov 2022 19:50:14 +0100 Subject: [PATCH] screencasting: Polish region case - By scaling: make sure we are scaling by the feed size rather than the output size, which is irrelevant in this case. - By positioning: properly position the outputs on the feed if the feed scale is != 1 --- src/plugins/screencast/regionscreencastsource.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/plugins/screencast/regionscreencastsource.cpp b/src/plugins/screencast/regionscreencastsource.cpp index cd4bd92a6a..4310904830 100644 --- a/src/plugins/screencast/regionscreencastsource.cpp +++ b/src/plugins/screencast/regionscreencastsource.cpp @@ -45,25 +45,21 @@ void RegionScreenCastSource::updateOutput(Output *output) if (m_renderedTexture) { const std::shared_ptr outputTexture = Compositor::self()->scene()->textureForOutput(output); const auto outputGeometry = output->geometry(); - const auto outputScale = output->scale(); if (!outputTexture || !m_region.intersects(output->geometry())) { return; } GLFramebuffer::pushFramebuffer(m_target.get()); - const QRect geometry({0, 0}, m_target->size()); ShaderBinder shaderBinder(ShaderTrait::MapTexture); QMatrix4x4 projectionMatrix; projectionMatrix.ortho(m_region); - - const QPoint pos = outputGeometry.topLeft(); - projectionMatrix.translate(pos.x() * outputScale, pos.y() * outputScale); + projectionMatrix.translate(outputGeometry.left() / m_scale, (m_region.bottom() - outputGeometry.bottom()) / m_scale); shaderBinder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, projectionMatrix); outputTexture->bind(); - outputTexture->render(output->geometry(), outputScale); + outputTexture->render(output->geometry(), 1 / m_scale); outputTexture->unbind(); GLFramebuffer::popFramebuffer(); }