plugins/screencast: Fix window screencasts being vertically mirrored with memfd

WindowScreenCastSource::render(GLFramebuffer) renders windows with the y
axis flipped, but the offscreen has no FlipY flag set.

BUG: 478223
wilder/Plasma/6.2
Vlad Zahorodnii 2 years ago
parent 3a8ae60f87
commit 3388b7643c
  1. 13
      src/plugins/screencast/windowscreencastsource.cpp

@ -52,24 +52,21 @@ void WindowScreenCastSource::render(spa_data *spa, spa_video_format format)
if (!offscreenTexture) {
return;
}
GLFramebuffer offscreenTarget(offscreenTexture.get());
offscreenTexture->setContentTransform(OutputTransform::FlipY);
GLFramebuffer offscreenTarget(offscreenTexture.get());
render(&offscreenTarget);
grabTexture(offscreenTexture.get(), spa, format);
}
void WindowScreenCastSource::render(GLFramebuffer *target)
{
const QRectF geometry = m_window->clientGeometry();
QMatrix4x4 projectionMatrix;
projectionMatrix.scale(1, -1);
projectionMatrix.ortho(geometry);
RenderTarget renderTarget(target);
RenderViewport viewport(m_window->clientGeometry(), 1, renderTarget);
WindowPaintData data;
data.setProjectionMatrix(projectionMatrix);
data.setProjectionMatrix(viewport.projectionMatrix());
RenderTarget renderTarget(target);
RenderViewport viewport(geometry, 1, renderTarget);
GLFramebuffer::pushFramebuffer(target);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);

Loading…
Cancel
Save