mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 13:41:16 +01:00
Optimization
This commit is contained in:
parent
359a9f0a5a
commit
e792bf3b23
12
src/ozf.cpp
12
src/ozf.cpp
@ -215,13 +215,15 @@ QPixmap OZF::tile(int x, int y)
|
|||||||
if (!_file.seek(_tiles.at(i)))
|
if (!_file.seek(_tiles.at(i)))
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
|
|
||||||
QByteArray ba = _file.read(size);
|
quint32 bes = qToBigEndian(tileSize().width() * tileSize().height());
|
||||||
if (ba.size() != size)
|
QByteArray ba;
|
||||||
|
ba.resize(sizeof(bes) + size);
|
||||||
|
*(ba.data()) = bes;
|
||||||
|
|
||||||
|
if (_file.read(ba.data() + sizeof(bes), size) != size)
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
if (_decrypt)
|
if (_decrypt)
|
||||||
decrypt(ba.data(), qMin(16, ba.size()), _key);
|
decrypt(ba.data() + sizeof(bes), qMin(16, size), _key);
|
||||||
quint32 bes = qToBigEndian(tileSize().width() * tileSize().height());
|
|
||||||
ba.prepend(QByteArray((char*)&bes, sizeof(bes)));
|
|
||||||
QByteArray uba = qUncompress(ba);
|
QByteArray uba = qUncompress(ba);
|
||||||
if (uba.size() != tileSize().width() * tileSize().height())
|
if (uba.size() != tileSize().width() * tileSize().height())
|
||||||
return QPixmap();
|
return QPixmap();
|
||||||
|
Loading…
Reference in New Issue
Block a user