mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Added missing pixmap caching
This commit is contained in:
parent
2c816a509b
commit
ca7016176f
@ -1,6 +1,7 @@
|
||||
#include <QtEndian>
|
||||
#include <QPainter>
|
||||
#include <QFileInfo>
|
||||
#include <QPixmapCache>
|
||||
#include "transform.h"
|
||||
#include "rectd.h"
|
||||
#include "jnxmap.h"
|
||||
@ -212,6 +213,10 @@ int JNXMap::zoomOut()
|
||||
|
||||
QPixmap JNXMap::pixmap(const Tile *tile, QFile *file)
|
||||
{
|
||||
QPixmap pm;
|
||||
|
||||
QString key = file->fileName() + "-" + QString::number(tile->offset);
|
||||
if (!QPixmapCache::find(key, &pm)) {
|
||||
QByteArray ba;
|
||||
ba.resize(tile->size + 2);
|
||||
ba[0] = (char)0xFF;
|
||||
@ -222,8 +227,13 @@ QPixmap JNXMap::pixmap(const Tile *tile, QFile *file)
|
||||
return QPixmap();
|
||||
if (!file->read(data, tile->size))
|
||||
return QPixmap();
|
||||
pm = QPixmap::fromImage(QImage::fromData(ba));
|
||||
|
||||
return QPixmap::fromImage(QImage::fromData(ba));
|
||||
if (!pm.isNull())
|
||||
QPixmapCache::insert(key, pm);
|
||||
}
|
||||
|
||||
return pm;
|
||||
}
|
||||
|
||||
bool JNXMap::cb(Tile *tile, void *context)
|
||||
|
Loading…
Reference in New Issue
Block a user