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

Optimization

This commit is contained in:
Martin Tůma 2020-01-11 23:41:04 +01:00
parent 8c9180190a
commit 2efc6fb6d3
6 changed files with 10 additions and 13 deletions

View File

@ -50,9 +50,8 @@ static QString capitalize(const QString &str)
} }
bool LBLFile::init() bool LBLFile::init(Handle &hdl)
{ {
Handle hdl;
quint16 codepage; quint16 codepage;
quint8 multiplier, poiMultiplier; quint8 multiplier, poiMultiplier;
@ -165,7 +164,7 @@ Label LBLFile::label8b(Handle &hdl, quint32 offset) const
Label LBLFile::label(Handle &hdl, quint32 offset, bool poi) Label LBLFile::label(Handle &hdl, quint32 offset, bool poi)
{ {
if (!_multiplier && !init()) if (!_multiplier && !init(hdl))
return QString(); return QString();
quint32 labelOffset; quint32 labelOffset;

View File

@ -19,7 +19,7 @@ public:
Label label(Handle &hdl, quint32 offset, bool poi = false); Label label(Handle &hdl, quint32 offset, bool poi = false);
private: private:
bool init(); bool init(Handle &hdl);
Label label6b(Handle &hdl, quint32 offset) const; Label label6b(Handle &hdl, quint32 offset) const;
Label label8b(Handle &hdl, quint32 offset) const; Label label8b(Handle &hdl, quint32 offset) const;

View File

@ -1,8 +1,7 @@
#include "netfile.h" #include "netfile.h"
bool NETFile::init() bool NETFile::init(Handle &hdl)
{ {
Handle hdl;
quint8 multiplier; quint8 multiplier;
if (!(seek(hdl, _gmpOffset + 0x15) && readUInt32(hdl, _offset) if (!(seek(hdl, _gmpOffset + 0x15) && readUInt32(hdl, _offset)
@ -16,7 +15,7 @@ bool NETFile::init()
bool NETFile::lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset) bool NETFile::lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset)
{ {
if (!_multiplier && !init()) if (!_multiplier && !init(hdl))
return false; return false;
if (!(seek(hdl, _offset + netOffset * _multiplier) if (!(seek(hdl, _offset + netOffset * _multiplier)

View File

@ -13,7 +13,7 @@ public:
bool lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset); bool lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset);
private: private:
bool init(); bool init(Handle &hdl);
quint32 _offset; quint32 _offset;
quint32 _size; quint32 _size;

View File

@ -119,9 +119,8 @@ bool RGNFile::DeltaStream::sign(int &val)
} }
bool RGNFile::init() bool RGNFile::init(Handle &hdl)
{ {
Handle hdl;
quint16 hdrLen; quint16 hdrLen;
if (!(seek(hdl, _gmpOffset) && readUInt16(hdl, hdrLen) if (!(seek(hdl, _gmpOffset) && readUInt16(hdl, hdrLen)
@ -395,7 +394,7 @@ void RGNFile::objects(const RectC &rect, const SubDiv *subdiv, LBLFile *lbl,
{ {
Handle rgnHdl, lblHdl, netHdl; Handle rgnHdl, lblHdl, netHdl;
if (!_init && !init()) if (!_init && !init(rgnHdl))
return; return;
QVector<RGNFile::Segment> seg(segments(rgnHdl, subdiv)); QVector<RGNFile::Segment> seg(segments(rgnHdl, subdiv));
@ -427,7 +426,7 @@ void RGNFile::extObjects(const RectC &rect, const SubDiv *subdiv, LBLFile *lbl,
{ {
Handle rgnHdl, lblHdl; Handle rgnHdl, lblHdl;
if (!_init && !init()) if (!_init && !init(rgnHdl))
return; return;
if (polygons && subdiv->polygonsOffset() != subdiv->polygonsEnd()) { if (polygons && subdiv->polygonsOffset() != subdiv->polygonsEnd()) {

View File

@ -93,7 +93,7 @@ private:
quint32 _lonBits, _latBits, _readBits; quint32 _lonBits, _latBits, _readBits;
}; };
bool init(); bool init(Handle &hdl);
QVector<Segment> segments(Handle &hdl, const SubDiv *subdiv) const; QVector<Segment> segments(Handle &hdl, const SubDiv *subdiv) const;
bool polyObjects(const RectC &rect, Handle &hdl, const SubDiv *subdiv, bool polyObjects(const RectC &rect, Handle &hdl, const SubDiv *subdiv,