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

Drop the unused lines background drawing

This commit is contained in:
Martin Tůma 2022-11-05 13:41:13 +01:00
parent 4ce5dfbcf9
commit fdd3613c4a
2 changed files with 8 additions and 24 deletions

View File

@ -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<TextItem*> &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;

View File

@ -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;