optimizations (halves the number of multiplication).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21516 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-11-08 08:00:31 +00:00
parent 3a1290815e
commit b9eecfab8a

View File

@ -127,7 +127,7 @@ QColor GuiPainter::filterColor(QColor const & col)
QColor const & max = monochrome_max_.top();
qreal v = col.valueF();
v = v * v; // make it a bit steeper (i.e. darker)
v *= v; // make it a bit steeper (i.e. darker)
qreal minr, ming, minb;
qreal maxr, maxg, maxb;
@ -135,7 +135,10 @@ QColor GuiPainter::filterColor(QColor const & col)
max.getRgbF(&maxr, &maxg, &maxb);
QColor c;
c.setRgbF(v*minr+(1-v)*maxr, v*ming+(1-v)*maxg, v*minb+(1-v)*maxb);
c.setRgbF(
v * (minr - maxr) + maxr,
v * (ming - maxg) + maxg,
v * (minb - maxb) + maxb);
return c;
}