diff --git a/src/map/IMG/rastertile.cpp b/src/map/IMG/rastertile.cpp index 1378dd5c..d1b808f2 100644 --- a/src/map/IMG/rastertile.cpp +++ b/src/map/IMG/rastertile.cpp @@ -177,9 +177,9 @@ void RasterTile::render() processPolygons(textItems); processLines(textItems); - _img.fill(Qt::transparent); + _pixmap.fill(Qt::transparent); - QPainter painter(&_img); + QPainter painter(&_pixmap); painter.setRenderHint(QPainter::SmoothPixmapTransform); painter.setRenderHint(QPainter::Antialiasing); painter.translate(-_xy.x(), -_xy.y()); @@ -300,7 +300,7 @@ static void removeDuplicitLabel(QList &labels, const QString &text, void RasterTile::processPolygons(QList &textItems) { - QRectF tileRect(_xy, _img.size()); + QRectF tileRect(_xy, _pixmap.size()); QSet set; QList labels; @@ -337,7 +337,7 @@ void RasterTile::processPolygons(QList &textItems) void RasterTile::processLines(QList &textItems) { - QRect tileRect(_xy, _img.size()); + QRect tileRect(_xy, _pixmap.size()); std::stable_sort(_lines.begin(), _lines.end()); @@ -403,7 +403,7 @@ void RasterTile::processShields(const QRect &tileRect, it != shields.constEnd(); ++it) { const QPolygonF &p = it.value(); QRectF rect(p.boundingRect() & tileRect); - if (AREA(rect) < AREA(QRect(0, 0, _img.width()/4, _img.width()/4))) + if (AREA(rect) < AREA(QRect(0, 0, _pixmap.width()/4, _pixmap.width()/4))) continue; QMap map; diff --git a/src/map/IMG/rastertile.h b/src/map/IMG/rastertile.h index ea1b1ebe..7e0b0c6b 100644 --- a/src/map/IMG/rastertile.h +++ b/src/map/IMG/rastertile.h @@ -1,7 +1,7 @@ #ifndef IMG_RASTERTILE_H #define IMG_RASTERTILE_H -#include +#include #include "mapdata.h" class QPainter; @@ -19,12 +19,12 @@ public: const QString &key, const QList &polygons, const QList &lines, QList &points) : _map(map), _style(style), _zoom(zoom), _xy(rect.topLeft()), - _key(key), _img(rect.size(), QImage::Format_ARGB32_Premultiplied), - _polygons(polygons), _lines(lines), _points(points) {} + _key(key), _pixmap(rect.size()), _polygons(polygons), _lines(lines), + _points(points) {} const QString &key() const {return _key;} const QPoint &xy() const {return _xy;} - const QImage &img() const {return _img;} + const QPixmap &pixmap() const {return _pixmap;} void render(); @@ -47,7 +47,7 @@ private: int _zoom; QPoint _xy; QString _key; - QImage _img; + QPixmap _pixmap; QList _polygons; QList _lines; QList _points; diff --git a/src/map/imgmap.cpp b/src/map/imgmap.cpp index 45acc288..ba370226 100644 --- a/src/map/imgmap.cpp +++ b/src/map/imgmap.cpp @@ -193,13 +193,12 @@ void IMGMap::draw(QPainter *painter, const QRectF &rect, Flags flags) for (int i = 0; i < tiles.size(); i++) { RasterTile &mt = tiles[i]; - QPixmap pm(QPixmap::fromImage(mt.img())); + const QPixmap &pm = mt.pixmap(); if (pm.isNull()) continue; - QPixmapCache::insert(mt.key(), pm); - painter->drawPixmap(mt.xy(), pm); + QPixmapCache::insert(mt.key(), pm); } } diff --git a/src/map/mapsforge/rastertile.cpp b/src/map/mapsforge/rastertile.cpp index e1825b0f..c2dd7915 100644 --- a/src/map/mapsforge/rastertile.cpp +++ b/src/map/mapsforge/rastertile.cpp @@ -228,11 +228,11 @@ void RasterTile::render() std::sort(_points.begin(), _points.end()); QList textItems; - QRect tileRect(_xy, _img.size()); + QRect tileRect(_xy, _pixmap.size()); - _img.fill(Qt::transparent); + _pixmap.fill(Qt::transparent); - QPainter painter(&_img); + QPainter painter(&_pixmap); painter.setRenderHint(QPainter::Antialiasing); painter.translate(-_xy.x(), -_xy.y()); diff --git a/src/map/mapsforge/rastertile.h b/src/map/mapsforge/rastertile.h index 61ebf036..9e7d9da9 100644 --- a/src/map/mapsforge/rastertile.h +++ b/src/map/mapsforge/rastertile.h @@ -1,7 +1,7 @@ #ifndef MAPSFORGE_RASTERTILE_H #define MAPSFORGE_RASTERTILE_H -#include +#include #include "map/projection.h" #include "map/transform.h" #include "style.h" @@ -19,12 +19,11 @@ public: const QRect &rect, const QString &key, const QList &paths, const QList &points) : _proj(proj), _transform(transform), _zoom(zoom), _xy(rect.topLeft()), - _key(key), _img(rect.size(), QImage::Format_ARGB32_Premultiplied), - _paths(paths), _points(points) {} + _key(key), _pixmap(rect.size()), _paths(paths), _points(points) {} const QString &key() const {return _key;} const QPoint &xy() const {return _xy;} - const QImage &img() const {return _img;} + const QPixmap &pixmap() const {return _pixmap;} void render(); @@ -83,7 +82,7 @@ private: int _zoom; QPoint _xy; QString _key; - QImage _img; + QPixmap _pixmap; QList _paths; QList _points; }; diff --git a/src/map/mapsforgemap.h b/src/map/mapsforgemap.h index 540eb5c7..8b77587e 100644 --- a/src/map/mapsforgemap.h +++ b/src/map/mapsforgemap.h @@ -35,7 +35,7 @@ private slots: { for (int i = 0; i < _tiles.size(); i++) { Mapsforge::RasterTile &mt = _tiles[i]; - QPixmap pm(QPixmap::fromImage(mt.img())); + const QPixmap &pm = mt.pixmap(); if (pm.isNull()) continue;