mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 19:55:53 +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)))
|
||||
return QPixmap();
|
||||
|
||||
QByteArray ba = _file.read(size);
|
||||
if (ba.size() != size)
|
||||
quint32 bes = qToBigEndian(tileSize().width() * tileSize().height());
|
||||
QByteArray ba;
|
||||
ba.resize(sizeof(bes) + size);
|
||||
*(ba.data()) = bes;
|
||||
|
||||
if (_file.read(ba.data() + sizeof(bes), size) != size)
|
||||
return QPixmap();
|
||||
if (_decrypt)
|
||||
decrypt(ba.data(), qMin(16, ba.size()), _key);
|
||||
quint32 bes = qToBigEndian(tileSize().width() * tileSize().height());
|
||||
ba.prepend(QByteArray((char*)&bes, sizeof(bes)));
|
||||
decrypt(ba.data() + sizeof(bes), qMin(16, size), _key);
|
||||
QByteArray uba = qUncompress(ba);
|
||||
if (uba.size() != tileSize().width() * tileSize().height())
|
||||
return QPixmap();
|
||||
|
Loading…
Reference in New Issue
Block a user