scenes/opengl: Avoid blending for entirely opaque SurfaceItems
Blending is quite expensive especially with software rendering. In the case of Firefox on Wayland, it uses a ARGB8888 buffer but marks the entire surface as opaque, so the alpha channel can be ignored. CCBUG: 440386
This commit is contained in:
parent
1041ef8275
commit
11c7e7a64d
1 changed files with 3 additions and 1 deletions
|
@ -983,12 +983,14 @@ void OpenGLWindow::createRenderNode(Item *item, RenderContext *context)
|
|||
if (!quads.isEmpty()) {
|
||||
SurfacePixmap *pixmap = surfaceItem->pixmap();
|
||||
if (pixmap) {
|
||||
// Don't bother with blending if the entire surface is opaque
|
||||
bool hasAlpha = pixmap->hasAlphaChannel() && !surfaceItem->shape().subtracted(surfaceItem->opaque()).isEmpty();
|
||||
context->renderNodes.append(RenderNode{
|
||||
.texture = bindSurfaceTexture(surfaceItem),
|
||||
.quads = quads,
|
||||
.transformMatrix = transformation(item, context),
|
||||
.opacity = context->paintData.opacity(),
|
||||
.hasAlpha = pixmap->hasAlphaChannel(),
|
||||
.hasAlpha = hasAlpha,
|
||||
.coordinateType = UnnormalizedCoordinates,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue