BorderImage: Fix white area when size changes after first paint
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Mon, 27 Oct 2014 11:55:54 +0000 (12:55 +0100)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Fri, 31 Oct 2014 08:50:57 +0000 (09:50 +0100)
When e.g. growing the size of the border image in an animation,
we would not get updates of the paint nodes when the size was
so small that the bounded target rect and source rect did not
change (when the size was smaller than the sum of the borders).
Since this can happen, we also need to detect when the size
changes and update the node for this case.

Task-number: QTBUG-42022
Change-Id: I0849d740f363e66a3a4fd6de23fc9d7399ab0779
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
src/quick/items/qquickborderimage.cpp
src/quick/items/qquickimagebase_p_p.h

index 8d8e4b6..07b8958 100644 (file)
@@ -582,10 +582,16 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
                                  qMax<qreal>(0, width() - border->right() - border->left()),
                                  qMax<qreal>(0, height() - border->bottom() - border->top()));
 
-        if (innerSourceRect != d->oldInnerSourceRect || innerTargetRect != d->oldInnerTargetRect)
+        QSizeF newSize(width(), height());
+        if (innerSourceRect != d->oldInnerSourceRect
+                || innerTargetRect != d->oldInnerTargetRect
+                || newSize != d->oldSize) {
             updateNode = true;
+        }
+
         d->oldInnerSourceRect = innerSourceRect;
         d->oldInnerTargetRect = innerTargetRect;
+        d->oldSize = newSize;
     }
 
     bool updatePixmap = d->pixmapChanged;
index ec2f0bb..21d11a7 100644 (file)
@@ -77,6 +77,7 @@ public:
     qreal devicePixelRatio;
     QRectF oldInnerSourceRect;
     QRectF oldInnerTargetRect;
+    QSizeF oldSize;
     bool async : 1;
     bool cache : 1;
     bool mirror: 1;