diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-08-28 13:05:06 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-08-30 15:19:02 +0000 |
commit | 6ed139172d9ab82e1a22de71a665e023e87b3c58 (patch) | |
tree | cb0f4c5bba71d3d33c4f0ebd7f944487367f340b /src | |
parent | a6323d1ad8ad7af585ed76a5a3a97a48e955ff91 (diff) |
Fix pedantic warnings in QQuickImage
- semicolon after switch is not necessary
- a switch that covers all possible cases should not have a default
case: that way if someone adds another enum value, she needs to
think about what it means in that switch
- hopefully it was not intentional to ensure that targetRect has
integral size in the PreserveAspectCrop case; it's not an explicit
cast, so it looks like a mistake
Change-Id: Ie7525137e826ed3ea03ac1dc9d2563e791379b42
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickimage.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 87b848b21b..c7e7ccea55 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -687,7 +687,6 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) yOffset = qCeil(height() - pixHeight); switch (d->fillMode) { - default: case Stretch: targetRect = QRectF(0, 0, width(), height()); sourceRect = d->pix.rect(); @@ -699,7 +698,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) break; case PreserveAspectCrop: { - targetRect = QRect(0, 0, width(), height()); + targetRect = QRectF(0, 0, width(), height()); qreal wscale = width() / qreal(d->pix.width()); qreal hscale = height() / qreal(d->pix.height()); @@ -751,7 +750,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) targetRect = QRectF(x + xOffset, y + yOffset, w, h); sourceRect = QRectF(x, y, w, h); break; - }; + } qreal nsWidth = (hWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.width() / d->devicePixelRatio : d->pix.width(); qreal nsHeight = (vWrap == QSGTexture::Repeat || d->fillMode == Pad) ? d->pix.height() / d->devicePixelRatio : d->pix.height(); |