mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-01-31 09:05:14 +01:00
Some more code cleanup
This commit is contained in:
parent
3338bfa73f
commit
c364922625
@ -164,6 +164,18 @@ static bool skipNodes(const NODFile *nod, SubFile::Handle &nodHdl,
|
||||
return true;
|
||||
}
|
||||
|
||||
static int sign(quint32 flags, quint32 &bits)
|
||||
{
|
||||
if (!((flags >> bits) & 1)) {
|
||||
bits--;
|
||||
return 0;
|
||||
} else {
|
||||
quint32 sb = bits - 1;
|
||||
bits -= 2;
|
||||
return ((flags >> sb) & 1) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
static bool readShape(const NODFile *nod, SubFile::Handle &nodHdl,
|
||||
NODFile::AdjacencyInfo &adj, BitStream4R &bs, const HuffmanTable *table,
|
||||
const SubDiv *subdiv, quint32 shift, MapData::Poly &poly,
|
||||
@ -185,29 +197,14 @@ static bool readShape(const NODFile *nod, SubFile::Handle &nodHdl,
|
||||
bool startWithStream = flags & (1 << (v2b + 6));
|
||||
bool useEosBit = flags & (1 << (v2b + 5));
|
||||
|
||||
quint32 extraBits;
|
||||
int lonSign, latSign;
|
||||
quint32 extraBits = v2b + 4;
|
||||
int lonSign = sign(flags, extraBits);
|
||||
int latSign = sign(flags, extraBits);
|
||||
|
||||
HuffmanStreamR stream(bs, *table);
|
||||
if (!stream.init(lonSign, latSign, flags, extraBits + 1))
|
||||
return false;
|
||||
|
||||
if ((flags >> (v2b + 4) & 1) == 0) {
|
||||
extraBits = v2b + 4;
|
||||
lonSign = 0;
|
||||
} else {
|
||||
extraBits = v2b + 3;
|
||||
lonSign = 1;
|
||||
if ((flags >> (v2b + 3) & 1) != 0) {
|
||||
lonSign = -1;
|
||||
}
|
||||
}
|
||||
extraBits -= 1;
|
||||
if ((flags >> extraBits & 1) == 0) {
|
||||
latSign = 0;
|
||||
} else {
|
||||
extraBits -= 1;
|
||||
latSign = -1;
|
||||
if ((flags >> extraBits & 1) == 0) {
|
||||
latSign = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (nod->nextNode(nodHdl, adj))
|
||||
return false;
|
||||
@ -236,12 +233,9 @@ static bool readShape(const NODFile *nod, SubFile::Handle &nodHdl,
|
||||
}
|
||||
}
|
||||
|
||||
HuffmanStreamR stream(bs, *table);
|
||||
if (!stream.init(lonSign, latSign, flags, extraBits))
|
||||
return false;
|
||||
|
||||
qint32 lonDelta, latDelta;
|
||||
QVector<QPoint> deltas;
|
||||
|
||||
quint32 adjustBit = 0;
|
||||
quint32 stepsCnt = 0;
|
||||
quint32 steps = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user