Commit 1e3a8124 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik Committed by Kai Uwe Broulik
Browse files

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
2f4fa23e



While at it, move `size` out of the loop as it doesn't change.

Signed-off-by: default avatarVictoria Fischer <victoria.fischer@mbition.io>
parent 259f4d78
......@@ -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()});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment