From 78d2c1f7e05c06347805c101fd45e84c10325f63 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 4 Aug 2022 11:44:24 +0200 Subject: [PATCH] showpaint: Account for render target scale when creating geometry --- src/effects/showpaint/showpaint.cpp | 17 +++++++++-------- src/effects/showpaint/showpaint.h | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/effects/showpaint/showpaint.cpp b/src/effects/showpaint/showpaint.cpp index 12700caeec..ec3a122167 100644 --- a/src/effects/showpaint/showpaint.cpp +++ b/src/effects/showpaint/showpaint.cpp @@ -48,7 +48,7 @@ void ShowPaintEffect::paintScreen(int mask, const QRegion ®ion, ScreenPaintDa m_painted = QRegion(); effects->paintScreen(mask, region, data); if (effects->isOpenGLCompositing()) { - paintGL(data.projectionMatrix()); + paintGL(data.projectionMatrix(), effects->renderTargetScale()); } else if (effects->compositingType() == QPainterCompositing) { paintQPainter(); } @@ -63,7 +63,7 @@ void ShowPaintEffect::paintWindow(EffectWindow *w, int mask, QRegion region, Win effects->paintWindow(w, mask, region, data); } -void ShowPaintEffect::paintGL(const QMatrix4x4 &projection) +void ShowPaintEffect::paintGL(const QMatrix4x4 &projection, qreal scale) { GLVertexBuffer *vbo = GLVertexBuffer::streamingBuffer(); vbo->reset(); @@ -78,12 +78,13 @@ void ShowPaintEffect::paintGL(const QMatrix4x4 &projection) QVector verts; verts.reserve(m_painted.rectCount() * 12); for (const QRect &r : m_painted) { - verts << r.x() + r.width() << r.y(); - verts << r.x() << r.y(); - verts << r.x() << r.y() + r.height(); - verts << r.x() << r.y() + r.height(); - verts << r.x() + r.width() << r.y() + r.height(); - verts << r.x() + r.width() << r.y(); + const auto deviceRect = scaledRect(r, scale); + verts << deviceRect.x() + deviceRect.width() << deviceRect.y(); + verts << deviceRect.x() << deviceRect.y(); + verts << deviceRect.x() << deviceRect.y() + deviceRect.height(); + verts << deviceRect.x() << deviceRect.y() + deviceRect.height(); + verts << deviceRect.x() + deviceRect.width() << deviceRect.y() + deviceRect.height(); + verts << deviceRect.x() + deviceRect.width() << deviceRect.y(); } vbo->setData(verts.count() / 2, 2, verts.data(), nullptr); vbo->render(GL_TRIANGLES); diff --git a/src/effects/showpaint/showpaint.h b/src/effects/showpaint/showpaint.h index 7e88204120..389ab62531 100644 --- a/src/effects/showpaint/showpaint.h +++ b/src/effects/showpaint/showpaint.h @@ -31,7 +31,7 @@ private Q_SLOTS: void toggle(); private: - void paintGL(const QMatrix4x4 &projection); + void paintGL(const QMatrix4x4 &projection, qreal scale); void paintQPainter(); bool m_active = false;