diff options
author | Charles Yin <charles.yin@nokia.com> | 2011-10-11 14:28:28 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-11 06:42:53 +0200 |
commit | 60d07fc96b60a709396bf983dc79e84f786c1ad0 (patch) | |
tree | 4bf08f3cddf90d3ac6693f2496140261558d8271 /src/declarative/items/context2d/qsgcanvasitem.cpp | |
parent | f8aab7293ef223a388b28c7805076c932fecded1 (diff) |
fix canvas bug
do painting only after component loaded and paint after geometry size initialized
Task-number:QTBUG-21920
Task-number:QTBUG-21918
Change-Id: Ibbc12d416dc694eff35f16c03cbc3c16e333645b
Reviewed-on: http://codereview.qt-project.org/6387
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Charles Yin <charles.yin@nokia.com>
Diffstat (limited to 'src/declarative/items/context2d/qsgcanvasitem.cpp')
-rw-r--r-- | src/declarative/items/context2d/qsgcanvasitem.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/declarative/items/context2d/qsgcanvasitem.cpp b/src/declarative/items/context2d/qsgcanvasitem.cpp index 49a0eb7f72..deb3493ac1 100644 --- a/src/declarative/items/context2d/qsgcanvasitem.cpp +++ b/src/declarative/items/context2d/qsgcanvasitem.cpp @@ -416,18 +416,16 @@ void QSGCanvasItem::geometryChanged(const QRectF &newGeometry, void QSGCanvasItem::componentComplete() { Q_D(QSGCanvasItem); + QSGItem::componentComplete(); if (!d->context) createContext(); createTexture(); - - _doPainting(canvasWindow()); - QSGItem::componentComplete(); - d->baseUrl = qmlEngine(this)->contextForObject(this)->baseUrl(); + requestPaint(); + updatePolish(); //force update the canvas sizes to texture for the first time d->componentCompleted = true; - update(); } void QSGCanvasItem::updatePolish() @@ -535,7 +533,8 @@ void QSGCanvasItem::markDirty(const QRectF& region) { Q_D(QSGCanvasItem); d->dirtyRect |= region; - polish(); + if (d->componentCompleted) + polish(); update(); } @@ -699,8 +698,6 @@ QString QSGCanvasItem::toDataURL(const QString& mimeType) const type = QLatin1Literal("PPM"); else if (mime == QLatin1Literal("image/tiff")) type = QLatin1Literal("TIFF"); - else if (mime == QLatin1Literal("image/xbm")) - type = QLatin1Literal("XBM"); else if (mime == QLatin1Literal("image/xpm")) type = QLatin1Literal("XPM"); else |