Don't create the scale grid in the rendering thread.
authorGunnar Sletta <gunnar.sletta@nokia.com>
Thu, 18 Aug 2011 12:52:10 +0000 (14:52 +0200)
committerKim M. Kalland <kim.kalland@nokia.com>
Mon, 22 Aug 2011 10:53:31 +0000 (12:53 +0200)
Change-Id: Iee65fe64fa659a6371a05c7ab1c964331fd5605a
Reviewed-on: http://codereview.qt.nokia.com/3183
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/declarative/items/qsgborderimage.cpp

index e4cb535..684ea00 100644 (file)
@@ -336,11 +336,16 @@ QSGNode *QSGBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
 
     node->setTexture(texture);
 
-    const QSGScaleGrid *border = d->getScaleGrid();
-    node->setInnerRect(QRectF(border->left(),
-                              border->top(),
-                              qMax(1, d->pix.width() - border->right() - border->left()),
-                              qMax(1, d->pix.height() - border->bottom() - border->top())));
+    // Don't implicitly create the scalegrid in the rendering thread...
+    if (d->border) {
+        const QSGScaleGrid *border = d->getScaleGrid();
+        node->setInnerRect(QRectF(border->left(),
+                                  border->top(),
+                                  qMax(1, d->pix.width() - border->right() - border->left()),
+                                  qMax(1, d->pix.height() - border->bottom() - border->top())));
+    } else {
+        node->setInnerRect(QRectF(0, 0, width(), height()));
+    }
     node->setRect(QRectF(0, 0, width(), height()));
     node->setFiltering(d->smooth ? QSGTexture::Linear : QSGTexture::Nearest);
     node->setHorzontalTileMode(d->horizontalTileMode);