mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Only do the layered painting for areas
This commit is contained in:
parent
cdd5c47da3
commit
c29acb1aea
@ -122,7 +122,6 @@ void RasterTile::processPoints(QList<TextItem*> &textItems)
|
||||
textItems.append(item);
|
||||
else
|
||||
delete item;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,9 +253,7 @@ QVector<RasterTile::PathInstruction> RasterTile::pathInstructions()
|
||||
void RasterTile::drawPaths(QPainter *painter)
|
||||
{
|
||||
QVector<PathInstruction> instructions(pathInstructions());
|
||||
if (instructions.isEmpty())
|
||||
return;
|
||||
const Style::PathRender *lri = instructions.first().render();
|
||||
const Style::PathRender *lri = 0;
|
||||
|
||||
QPixmap layer(_pixmap.size());
|
||||
layer.fill(Qt::transparent);
|
||||
@ -270,21 +267,29 @@ void RasterTile::drawPaths(QPainter *painter)
|
||||
PathInstruction &is = instructions[i];
|
||||
const Style::PathRender *ri = is.render();
|
||||
|
||||
if (ri != lri) {
|
||||
if (lri && lri != ri) {
|
||||
painter->drawPixmap(_xy, layer);
|
||||
lp.fillRect(QRect(_xy, _pixmap.size()), Qt::transparent);
|
||||
lri = ri;
|
||||
}
|
||||
|
||||
if (!is.path()->path.elementCount())
|
||||
is.path()->path = painterPath(is.path()->poly);
|
||||
|
||||
lp.setPen(ri->pen(_zoom));
|
||||
lp.setBrush(ri->brush());
|
||||
lp.drawPath(is.path()->path);
|
||||
if (ri->area()) {
|
||||
lp.setPen(ri->pen(_zoom));
|
||||
lp.setBrush(ri->brush());
|
||||
lp.drawPath(is.path()->path);
|
||||
lri = ri;
|
||||
} else {
|
||||
painter->setPen(ri->pen(_zoom));
|
||||
painter->setBrush(ri->brush());
|
||||
painter->drawPath(is.path()->path);
|
||||
lri = 0;
|
||||
}
|
||||
}
|
||||
|
||||
painter->drawPixmap(_xy, layer);
|
||||
if (lri)
|
||||
painter->drawPixmap(_xy, layer);
|
||||
}
|
||||
|
||||
void RasterTile::render()
|
||||
|
@ -84,6 +84,7 @@ void Style::area(QXmlStreamReader &reader, const QString &dir, const Rule &rule)
|
||||
QString file;
|
||||
int height = 0, width = 0;
|
||||
|
||||
ri._area = true;
|
||||
if (attr.hasAttribute("fill"))
|
||||
ri._fillColor = QColor(attr.value("fill").toString());
|
||||
if (attr.hasAttribute("stroke"))
|
||||
|
@ -165,11 +165,12 @@ public:
|
||||
public:
|
||||
PathRender(const Rule &rule, int zOrder) : Render(rule),
|
||||
_zOrder(zOrder), _strokeWidth(0), _strokeCap(Qt::RoundCap),
|
||||
_strokeJoin(Qt::RoundJoin) {}
|
||||
_strokeJoin(Qt::RoundJoin), _area(false) {}
|
||||
|
||||
int zOrder() const {return _zOrder;}
|
||||
QPen pen(int zoom) const;
|
||||
QBrush brush() const;
|
||||
bool area() const {return _area;}
|
||||
|
||||
private:
|
||||
friend class Style;
|
||||
@ -181,6 +182,7 @@ public:
|
||||
Qt::PenCapStyle _strokeCap;
|
||||
Qt::PenJoinStyle _strokeJoin;
|
||||
QImage _fillImage;
|
||||
bool _area;
|
||||
};
|
||||
|
||||
class TextRender : public Render
|
||||
|
Loading…
Reference in New Issue
Block a user