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