diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-11-16 20:18:03 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2015-11-27 11:30:25 +0000 |
commit | eea315187d1add70aaf69745c031b8d6342b2303 (patch) | |
tree | 403a0fe2548dfb57466a84ff91beb94a2aafcf63 /src/imports/location/qdeclarativepolygonmapitem.cpp | |
parent | 3fadff6e01232f70492a05b1fb779968d9662462 (diff) |
Improve map item rendering performance
A flood of input events, such as when pinch, triggers
multiple map item geometry updates to occur per frame. These
geometry updates are potentially expensive and only the
last generated geometry is used. Mark items to be polished to
make geometry updates once per frame when updatePolish() is called.
Done-with: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
Change-Id: I0af40e2d0b09c8364382d4b4c018988f3986f7f0
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/imports/location/qdeclarativepolygonmapitem.cpp')
-rw-r--r-- | src/imports/location/qdeclarativepolygonmapitem.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index 9a71614f..6fdef816 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -332,7 +332,7 @@ QDeclarativePolygonMapItem::QDeclarativePolygonMapItem(QQuickItem *parent) void QDeclarativePolygonMapItem::handleBorderUpdated() { borderGeometry_.markSourceDirty(); - updateMapItem(); + polishAndUpdate(); } QDeclarativePolygonMapItem::~QDeclarativePolygonMapItem() @@ -367,7 +367,7 @@ void QDeclarativePolygonMapItem::setMap(QDeclarativeGeoMap *quickMap, QGeoMap *m if (map) { geometry_.markSourceDirty(); borderGeometry_.markSourceDirty(); - updateMapItem(); + polishAndUpdate(); } } @@ -423,7 +423,7 @@ void QDeclarativePolygonMapItem::setPath(const QJSValue &value) geometry_.markSourceDirty(); borderGeometry_.markSourceDirty(); - updateMapItem(); + polishAndUpdate(); emit pathChanged(); } @@ -441,7 +441,7 @@ void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate) geometry_.markSourceDirty(); borderGeometry_.markSourceDirty(); - updateMapItem(); + polishAndUpdate(); emit pathChanged(); } @@ -465,7 +465,7 @@ void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordina geometry_.markSourceDirty(); borderGeometry_.markSourceDirty(); - updateMapItem(); + polishAndUpdate(); emit pathChanged(); } @@ -489,7 +489,7 @@ void QDeclarativePolygonMapItem::setColor(const QColor &color) color_ = color; dirtyMaterial_ = true; - updateMapItem(); + update(); emit colorChanged(color_); } @@ -519,7 +519,7 @@ QSGNode *QDeclarativePolygonMapItem::updateMapItemPaintNode(QSGNode *oldNode, Up /*! \internal */ -void QDeclarativePolygonMapItem::updateMapItem() +void QDeclarativePolygonMapItem::updatePolish() { if (!map() || path_.count() == 0) return; @@ -546,7 +546,6 @@ void QDeclarativePolygonMapItem::updateMapItem() setHeight(combined.height()); setPositionOnMap(path_.at(0), -1 * geometry_.sourceBoundingBox().topLeft()); - update(); } /*! @@ -582,7 +581,7 @@ void QDeclarativePolygonMapItem::afterViewportChanged(const QGeoMapViewportChang borderGeometry_.setPreserveGeometry(true, borderGeometry_.geoLeftBound()); geometry_.markScreenDirty(); borderGeometry_.markScreenDirty(); - updateMapItem(); + polishAndUpdate(); } /*! @@ -639,7 +638,7 @@ void QDeclarativePolygonMapItem::geometryChanged(const QRectF &newGeometry, cons borderGeometry_.setPreserveGeometry(true, leftBoundCoord); geometry_.markSourceDirty(); borderGeometry_.markSourceDirty(); - updateMapItem(); + polishAndUpdate(); emit pathChanged(); } |