Skip to content

Commit

Permalink
Optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
tumic0 committed Feb 5, 2024
1 parent 97d5748 commit ee1b913
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/style.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool Style::Layer::Filter::match(const PBF::Feature &feature) const

QString Style::Layer::Template::value(int zoom, const PBF::Feature &feature) const
{
QRegularExpression rx("\\{[^\\}]*\\}");
static QRegularExpression rx("\\{[^\\}]*\\}");
QString text(_field.value(zoom));
QRegularExpressionMatchIterator it = rx.globalMatch(text);
QStringList keys;
Expand Down Expand Up @@ -546,11 +546,11 @@ void Style::Layer::setTextProperties(Tile &tile) const
void Style::Layer::addSymbol(Tile &tile, const QPainterPath &path,
const PBF::Feature &feature, const Sprites &sprites) const
{
QString text = _layout.text(tile.zoom(), feature);
QString text(_layout.text(tile.zoom(), feature));
if (text.isEmpty())
return;

QString icon = _layout.icon(tile.zoom(), feature);
QString icon(_layout.icon(tile.zoom(), feature));
tile.text().addLabel(text, sprites.icon(icon), path);
}

Expand Down Expand Up @@ -597,7 +597,7 @@ bool Style::load(const QString &fileName)
_layers.append(Layer(layers[i].toObject()));
}

QDir styleDir = QFileInfo(fileName).absoluteDir();
QDir styleDir(QFileInfo(fileName).absoluteDir());
loadSprites(styleDir, "sprite.json", "sprite.png", _sprites);
loadSprites(styleDir, "[email protected]", "[email protected]", _sprites2x);

Expand Down
2 changes: 1 addition & 1 deletion src/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void Text::addLabel(const QString &text, const QImage &icon,
ti->setHalo(_halo);
addItem(ti);

QList<TextItem*> ci = collidingItems(ti);
QList<TextItem*> ci(collidingItems(ti));
for (int i = 0; i < ci.size(); i++)
ci[i]->setVisible(false);
}
Expand Down

0 comments on commit ee1b913

Please sign in to comment.