aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/context2d/qsgcanvasitem.cpp
diff options
context:
space:
mode:
authorCharles Yin <yinyunqiao@gmail.com>2011-09-22 20:01:29 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-30 10:37:05 +0200
commit8f69461c480e10424401e95b16b507eec3e28e54 (patch)
tree58e13d4c7a470485ab5e14642a55bc35bd0ae2c3 /src/declarative/items/context2d/qsgcanvasitem.cpp
parent20fb62f6040ad8415828092a2b09bd374433505f (diff)
tests for canvas and a few bug fixes
Change-Id: Icbbc7f2a0fe3b908963ce18afef51e25ea0170a0 Reviewed-on: http://codereview.qt-project.org/5805 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.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/declarative/items/context2d/qsgcanvasitem.cpp b/src/declarative/items/context2d/qsgcanvasitem.cpp
index 2ecd322288..50cbc7e2f1 100644
--- a/src/declarative/items/context2d/qsgcanvasitem.cpp
+++ b/src/declarative/items/context2d/qsgcanvasitem.cpp
@@ -216,6 +216,7 @@ void QSGCanvasItem::setCanvasSize(const QSizeF & size)
d->canvasSize = size;
emit canvasSizeChanged();
polish();
+ update();
}
}
@@ -249,6 +250,7 @@ void QSGCanvasItem::setTileSize(const QSize & size)
emit tileSizeChanged();
polish();
+ update();
}
}
@@ -279,6 +281,7 @@ void QSGCanvasItem::setCanvasWindow(const QRectF& rect)
d->hasCanvasWindow = true;
emit canvasWindowChanged();
polish();
+ update();
}
}
@@ -378,6 +381,7 @@ void QSGCanvasItem::setRenderInThread(bool renderInThread)
disconnect(this, SIGNAL(painted()), this, SLOT(update()));
emit renderInThreadChanged();
polish();
+ update();
}
}
@@ -406,26 +410,29 @@ void QSGCanvasItem::geometryChanged(const QRectF &newGeometry,
}
polish();
+ update();
}
void QSGCanvasItem::componentComplete()
{
Q_D(QSGCanvasItem);
- createContext();
+ if (!d->context)
+ createContext();
createTexture();
- markDirty(d->canvasWindow);
+
+ _doPainting(canvasWindow());
QSGItem::componentComplete();
d->baseUrl = qmlEngine(this)->contextForObject(this)->baseUrl();
d->componentCompleted = true;
+ update();
}
void QSGCanvasItem::updatePolish()
{
Q_D(QSGCanvasItem);
-
QSGItem::updatePolish();
if (d->texture) {
if (!d->renderInThread && d->dirtyRect.isValid())
@@ -507,9 +514,9 @@ QDeclarativeV8Handle QSGCanvasItem::getContext(const QString &contextId)
Q_D(QSGCanvasItem);
Q_UNUSED(contextId);
- if (d->context)
- return QDeclarativeV8Handle::fromHandle(d->context->v8value());
- return QDeclarativeV8Handle::fromHandle(v8::Undefined());
+ if (!d->context)
+ createContext();
+ return QDeclarativeV8Handle::fromHandle(d->context->v8value());
}
/*!
@@ -527,6 +534,7 @@ void QSGCanvasItem::markDirty(const QRectF& region)
Q_D(QSGCanvasItem);
d->dirtyRect |= region;
polish();
+ update();
}
@@ -717,4 +725,4 @@ QString QSGCanvasItem::toDataURL(const QString& mimeType) const
the Canvas is actually rendered.
*/
-QT_END_NAMESPACE \ No newline at end of file
+QT_END_NAMESPACE