Simple optimisation: reuse current QPainter if no there's no change in settings.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14078 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-06-11 21:22:36 +00:00
parent 73a4be7143
commit 5c4d89d816
2 changed files with 11 additions and 0 deletions

View File

@ -58,6 +58,13 @@ int QLPainter::paperHeight() const
QPainter & QLPainter::setQPainterPen(QPainter & qp, LColor_color c,
Painter::line_style ls, Painter::line_width lw)
{
if (c == current_color_ && ls == current_ls_ && lw == current_lw_)
return qp;
current_color_ = c;
current_ls_ = ls;
current_lw_ = lw;
QPen pen = qp.pen();
pen.setColor(lcolorcache.get(c));

View File

@ -147,6 +147,10 @@ private:
/// the working area
QWorkArea * qwa_;
LColor::color current_color_;
Painter::line_style current_ls_;
Painter::line_width current_lw_;
};
#endif // QLPAINTER_H