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);
|
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,21 +267,29 @@ 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);
|
||||||
|
|
||||||
lp.setPen(ri->pen(_zoom));
|
if (ri->area()) {
|
||||||
lp.setBrush(ri->brush());
|
lp.setPen(ri->pen(_zoom));
|
||||||
lp.drawPath(is.path()->path);
|
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()
|
void RasterTile::render()
|
||||||
|
@ -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