screencast: Account for output scale when rendering

This commit is contained in:
Arjen Hiemstra 2022-08-09 14:22:32 +02:00
parent dea0383719
commit 8d93ef0221
3 changed files with 5 additions and 3 deletions

View file

@ -53,7 +53,7 @@ void OutputScreenCastSource::render(GLFramebuffer *target)
ShaderBinder shaderBinder(ShaderTrait::MapTexture);
QMatrix4x4 projectionMatrix;
projectionMatrix.ortho(geometry);
projectionMatrix.ortho(scaledRect(geometry, m_output->scale()));
shaderBinder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, projectionMatrix);
GLFramebuffer::pushFramebuffer(target);

View file

@ -58,7 +58,7 @@ void RegionScreenCastSource::updateOutput(Output *output)
projectionMatrix.ortho(m_region);
const QPoint pos = outputGeometry.topLeft();
projectionMatrix.translate(pos.x(), pos.y());
projectionMatrix.translate(pos.x() * outputScale, pos.y() * outputScale);
shaderBinder.shader()->setUniform(GLShader::ModelViewProjectionMatrix, projectionMatrix);

View file

@ -50,7 +50,9 @@ void WindowScreenCastSource::render(QImage *image)
void WindowScreenCastSource::render(GLFramebuffer *target)
{
const QRectF geometry = m_window->clientGeometry();
auto targetScale = Compositor::self()->scene()->renderTargetScale();
const QRectF geometry = scaledRect(m_window->clientGeometry(), targetScale);
QMatrix4x4 projectionMatrix;
projectionMatrix.ortho(geometry.x(), geometry.x() + geometry.width(),
geometry.y(), geometry.y() + geometry.height(), -1, 1);