From 7cfc531382bfa90135dccfdb06d237c46a481dee Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 7 Nov 2022 13:24:31 +0100 Subject: [PATCH] QPdf: code tidies Refactor an if/else chain over an enumerator into a switch. This unveils that the last else is actually dead code, as there is no Qt::UniteClip any more (removed 11 years ago in 01b72952c38b9193138eabdab6bdab632cd75ebd). Change-Id: Ib702e3f5bfdc39e580a4d872e54a5239d62204f7 Reviewed-by: Lars Knoll --- src/gui/painting/qpdf.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 848769d5b2..1a6770c29a 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1216,20 +1216,18 @@ void QPdfEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op) QPainterPath path = d->stroker.matrix.map(p); //qDebug() << "updateClipPath: " << d->stroker.matrix << p.boundingRect() << path.boundingRect() << op; - if (op == Qt::NoClip) { + switch (op) { + case Qt::NoClip: d->clipEnabled = false; d->clips.clear(); - } else if (op == Qt::ReplaceClip) { + break; + case Qt::ReplaceClip: d->clips.clear(); d->clips.append(path); - } else if (op == Qt::IntersectClip) { - d->clips.append(path); - } else { // UniteClip - // ask the painter for the current clipping path. that's the easiest solution - path = painter()->clipPath(); - path = d->stroker.matrix.map(path); - d->clips.clear(); + break; + case Qt::IntersectClip: d->clips.append(path); + break; } }