From 0c8b77edc00a4590de7febd43a3d8fbd206cceae Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 10 Jun 2020 10:53:36 +0300 Subject: [PATCH] Drop unnecessary emptiness check If a buffer is attached to the surface, its width or height cannot be 0. --- src/wayland/surface_interface.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index e0aeed7967..27ec710bfb 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -451,18 +451,16 @@ void SurfaceInterface::Private::swapStates(State *source, State *target, bool em if (bufferChanged) { if (target->buffer && (!target->damage.isEmpty() || !target->bufferDamage.isEmpty())) { const QRegion windowRegion = QRegion(0, 0, q->size().width(), q->size().height()); - if (!windowRegion.isEmpty()) { - const QRegion bufferDamage = mapFromBuffer(target, target->bufferDamage); - target->damage = windowRegion.intersected(target->damage.united(bufferDamage)); - trackedDamage = trackedDamage.united(target->damage); - emit q->damaged(target->damage); - // workaround for https://bugreports.qt.io/browse/QTBUG-52092 - // if the surface is a sub-surface, but the main surface is not yet mapped, fake frame rendered - if (subSurface) { - const auto mainSurface = subSurface->mainSurface(); - if (!mainSurface || !mainSurface->buffer()) { - q->frameRendered(0); - } + const QRegion bufferDamage = mapFromBuffer(target, target->bufferDamage); + target->damage = windowRegion.intersected(target->damage.united(bufferDamage)); + trackedDamage = trackedDamage.united(target->damage); + emit q->damaged(target->damage); + // workaround for https://bugreports.qt.io/browse/QTBUG-52092 + // if the surface is a sub-surface, but the main surface is not yet mapped, fake frame rendered + if (subSurface) { + const auto mainSurface = subSurface->mainSurface(); + if (!mainSurface || !mainSurface->buffer()) { + q->frameRendered(0); } } }