1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 19:55:53 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2018-11-10 10:44:37 +01:00
parent c1a217847f
commit b6e9400392

View File

@ -284,23 +284,24 @@ void MBTilesMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
for (int i = 0; i < tiles.size(); i++) { for (int i = 0; i < tiles.size(); i++) {
const MBTile &mt = tiles.at(i); const MBTile &mt = tiles.at(i);
QPixmap pm(mt.pixmap()); QPixmap pm(mt.pixmap());
if (!pm.isNull()) if (pm.isNull())
QPixmapCache::insert(mt.key(), pm); continue;
QPointF tp(qMax(tl.x(), b.left()) + (mt.xy().x() - tile.x()) * tileSize(), QPixmapCache::insert(mt.key(), pm);
qMax(tl.y(), b.top()) + (mt.xy().y() - tile.y()) * tileSize());
QPointF tp(qMax(tl.x(), b.left()) + (mt.xy().x() - tile.x())
* tileSize(), qMax(tl.y(), b.top()) + (mt.xy().y() - tile.y())
* tileSize());
drawTile(painter, pm, tp); drawTile(painter, pm, tp);
} }
} }
void MBTilesMap::drawTile(QPainter *painter, QPixmap &pixmap, QPointF &tp) void MBTilesMap::drawTile(QPainter *painter, QPixmap &pixmap, QPointF &tp)
{ {
if (!pixmap.isNull()) {
#ifdef ENABLE_HIDPI #ifdef ENABLE_HIDPI
pixmap.setDevicePixelRatio(imageRatio()); pixmap.setDevicePixelRatio(imageRatio());
#endif // ENABLE_HIDPI #endif // ENABLE_HIDPI
painter->drawPixmap(tp, pixmap); painter->drawPixmap(tp, pixmap);
}
} }
QPointF MBTilesMap::ll2xy(const Coordinates &c) QPointF MBTilesMap::ll2xy(const Coordinates &c)