This commit is contained in:
2023-03-17 13:48:26 +03:00
parent e9b995879a
commit c3d1d0fa69

View File

@@ -2206,12 +2206,14 @@ void Graphic::calcLOD(int index) {
if (!m_LODOptimization) return; if (!m_LODOptimization) return;
GraphicType & t(graphics[index]); GraphicType & t(graphics[index]);
t._lod.clear(); t._lod.clear();
t._lod.reserve(32);
int pcnt = t.polyline.size(); int pcnt = t.polyline.size();
// qDebug() << "calcLOD" << index; // qDebug() << "calcLOD" << index;
while (pcnt >= 10) { while (pcnt >= 10) {
QPolygonF & pl(t._lod.isEmpty() ? t.polyline : t._lod.back()); QPolygonF & pl(t._lod.isEmpty() ? t.polyline : t._lod.back());
t._lod.append(QPolygonF()); t._lod.append(QPolygonF());
QPolygonF & cl(t._lod.back()); QPolygonF & cl(t._lod.back());
if (pl.size() > 4) {
cl << pl.front(); cl << pl.front();
int qcnt = (pl.size() + 1) / 4; int qcnt = (pl.size() + 1) / 4;
pcnt = qcnt * 2 + 2; pcnt = qcnt * 2 + 2;
@@ -2243,6 +2245,8 @@ void Graphic::calcLOD(int index) {
cl << QPointF(cx - dx, my[1]) << QPointF(cx + dx, my[0]); cl << QPointF(cx - dx, my[1]) << QPointF(cx + dx, my[0]);
} }
cl << pl.back(); cl << pl.back();
} else
cl = pl;
// qDebug() << "lod" << t._lod.size() << "->" << cl.size(); // qDebug() << "lod" << t._lod.size() << "->" << cl.size();
} }
} }