diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-04-20 15:07:40 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-05 10:07:54 +0000 |
commit | f92e22ef299879bf02f1708953e7712729270f8f (patch) | |
tree | 547c97775d42f70dda364063b27bb648a6ee4772 /src/quick/items/context2d | |
parent | a775e43ae8872e344924581736c0ab933e12510d (diff) |
Some cleanups to QQmlRefCount
Rename QQmlRefPointer::take to adopt, as it's a better fit with
the semantics. Get rid of the assignment operator from a raw pointer
and add a Adopt argument to the constructor.
Change-Id: Ia1ebe42b24570f32543e783f91eb3206602772a2
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/quick/items/context2d')
-rw-r--r-- | src/quick/items/context2d/qquickcanvasitem.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 2068809b4e..8fa290b953 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -990,7 +990,7 @@ void QQuickCanvasItem::loadImage(const QUrl& url) if (!d->pixmaps.contains(fullPathUrl)) { QQuickPixmap* pix = new QQuickPixmap(); QQmlRefPointer<QQuickCanvasPixmap> canvasPix; - canvasPix.take(new QQuickCanvasPixmap(pix)); + canvasPix.adopt(new QQuickCanvasPixmap(pix)); d->pixmaps.insert(fullPathUrl, canvasPix); pix->load(qmlEngine(this) diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 85c45609b5..7d8b454fa7 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -2912,7 +2912,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext } else if (QQuickCanvasItem *canvas = qobject_cast<QQuickCanvasItem*>(qobjectWrapper->object())) { QImage img = canvas->toImage(); if (!img.isNull()) - pixmap.take(new QQuickCanvasPixmap(img)); + pixmap.adopt(new QQuickCanvasPixmap(img)); } else { V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch"); } @@ -2921,7 +2921,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext if (!!imageData) { QV4::Scoped<QQuickJSContext2DPixelData> pix(scope, imageData->d()->pixelData.as<QQuickJSContext2DPixelData>()); if (pix && !pix->d()->image.isNull()) { - pixmap.take(new QQuickCanvasPixmap(pix->d()->image)); + pixmap.adopt(new QQuickCanvasPixmap(pix->d()->image)); } else { V4THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch"); } |