From fdd3613c4a118148584e6e3933395c7fd753acf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 5 Nov 2022 13:41:13 +0100 Subject: [PATCH] Drop the unused lines background drawing --- src/map/ENC/rastertile.cpp | 17 +++-------------- src/map/ENC/style.h | 15 +++++---------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/map/ENC/rastertile.cpp b/src/map/ENC/rastertile.cpp index 0ecf849d..80ce1d1c 100644 --- a/src/map/ENC/rastertile.cpp +++ b/src/map/ENC/rastertile.cpp @@ -99,25 +99,14 @@ void RasterTile::drawLines(QPainter *painter) painter->setBrush(Qt::NoBrush); - for (int i = 0; i < _lines.size(); i++) { - const MapData::Line *line = _lines.at(i); - const Style::Line &style = s.line(line->type()); - - if (style.background() == Qt::NoPen) - continue; - - painter->setPen(style.background()); - painter->drawPolyline(polyline(line->path())); - } - for (int i = 0; i < _lines.size(); i++) { const MapData::Line *line = _lines.at(i); const Style::Line &style = s.line(line->type()); if (!style.img().isNull()) { BitmapLine::draw(painter, polyline(line->path()), style.img()); - } else if (style.foreground() != Qt::NoPen) { - painter->setPen(style.foreground()); + } else if (style.pen() != Qt::NoPen) { + painter->setPen(style.pen()); painter->drawPolyline(polyline(line->path())); } } @@ -165,7 +154,7 @@ void RasterTile::processLines(QList &textItems) const MapData::Line *line = _lines.at(i); const Style::Line &style = s.line(line->type()); - if (style.img().isNull() && style.foreground() == Qt::NoPen) + if (style.img().isNull() && style.pen() == Qt::NoPen) continue; if (line->label().isEmpty() || style.textFontSize() == Style::None) continue; diff --git a/src/map/ENC/style.h b/src/map/ENC/style.h index 8a6439da..ebf97a14 100644 --- a/src/map/ENC/style.h +++ b/src/map/ENC/style.h @@ -36,27 +36,22 @@ public: class Line { public: - Line() : _foreground(Qt::NoPen), _background(Qt::NoPen), - _textFontSize(None) {} - Line(const QPen &foreground, const QPen &background = Qt::NoPen) - : _foreground(foreground), _background(background), - _textFontSize(None) {} + Line() : _pen(Qt::NoPen), _textFontSize(None) {} + Line(const QPen &pen) : _pen(pen), _textFontSize(None) {} Line(const QImage &img) - : _foreground(Qt::NoPen), _background(Qt::NoPen), - _textFontSize(None), _img(img.convertToFormat( + : _pen(Qt::NoPen), _textFontSize(None), _img(img.convertToFormat( QImage::Format_ARGB32_Premultiplied)) {} void setTextColor(const QColor &color) {_textColor = color;} void setTextFontSize(FontSize size) {_textFontSize = size;} - const QPen &foreground() const {return _foreground;} - const QPen &background() const {return _background;} + const QPen &pen() const {return _pen;} const QColor &textColor() const {return _textColor;} FontSize textFontSize() const {return _textFontSize;} const QImage &img() const {return _img;} private: - QPen _foreground, _background; + QPen _pen; QColor _textColor; FontSize _textFontSize; QImage _img;