scenes/opengl: Check whether pixmap is valid before generating quads

Quad generation needs a valid surface pixmap. This did not surface
before as the pixmap was only accessed when looping the region which
typically was empty without a pixmap.

Signed-off-by: Victoria Fischer <victoria.fischer@mbition.io>
This commit is contained in:
Kai Uwe Broulik 2022-07-28 09:23:56 +02:00 committed by Kai Uwe Broulik
parent 1e3a81249c
commit 4c6010b078

View file

@ -363,10 +363,10 @@ void SceneOpenGL::createRenderNode(Item *item, RenderContext *context)
}); });
} }
} else if (auto surfaceItem = qobject_cast<SurfaceItem *>(item)) { } else if (auto surfaceItem = qobject_cast<SurfaceItem *>(item)) {
WindowQuadList quads = clipQuads(item, context); SurfacePixmap *pixmap = surfaceItem->pixmap();
if (!quads.isEmpty()) { if (pixmap) {
SurfacePixmap *pixmap = surfaceItem->pixmap(); WindowQuadList quads = clipQuads(item, context);
if (pixmap) { if (!quads.isEmpty()) {
// Don't bother with blending if the entire surface is opaque // Don't bother with blending if the entire surface is opaque
bool hasAlpha = pixmap->hasAlphaChannel() && !surfaceItem->shape().subtracted(surfaceItem->opaque()).isEmpty(); bool hasAlpha = pixmap->hasAlphaChannel() && !surfaceItem->shape().subtracted(surfaceItem->opaque()).isEmpty();
context->renderNodes.append(RenderNode{ context->renderNodes.append(RenderNode{