From 1e3a81249c53a7b5d4ea7ae288f825d47e49c19a Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 27 Jul 2022 13:10:02 +0200 Subject: [PATCH] SurfaceItem: Use `pixmap()` for quad generation This uses the previous pixmap if the current one is invalid, which ensures the generated quads have sane coordinates. The issue caused flickering while resizing Chrome after 2f4fa23e61d6e2894aa703bfa131a3b3e474a15d While at it, move `size` out of the loop as it doesn't change. Signed-off-by: Victoria Fischer --- src/surfaceitem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/surfaceitem.cpp b/src/surfaceitem.cpp index 60bbf4d905..faab5cd3af 100644 --- a/src/surfaceitem.cpp +++ b/src/surfaceitem.cpp @@ -128,6 +128,7 @@ void SurfaceItem::preprocess() WindowQuadList SurfaceItem::buildQuads() const { const QRegion region = shape(); + const auto size = pixmap()->size(); WindowQuadList quads; quads.reserve(region.rectCount()); @@ -140,8 +141,6 @@ WindowQuadList SurfaceItem::buildQuads() const const QPointF bufferBottomRight = m_surfaceToBufferMatrix.map(rect.bottomRight()); const QPointF bufferBottomLeft = m_surfaceToBufferMatrix.map(rect.bottomLeft()); - const auto size = m_pixmap->size(); - quad[0] = WindowVertex(rect.topLeft(), QPointF{bufferTopLeft.x() / size.width(), bufferTopLeft.y() / size.height()}); quad[1] = WindowVertex(rect.topRight(), QPointF{bufferTopRight.x() / size.width(), bufferTopRight.y() / size.height()}); quad[2] = WindowVertex(rect.bottomRight(), QPointF{bufferBottomRight.x() / size.width(), bufferBottomRight.y() / size.height()});