From b9eecfab8a26fdcacaf23b0c313504b7a4f318d2 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Thu, 8 Nov 2007 08:00:31 +0000 Subject: [PATCH] optimizations (halves the number of multiplication). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21516 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiPainter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt4/GuiPainter.cpp b/src/frontends/qt4/GuiPainter.cpp index 390e1507d5..98bb44b74c 100644 --- a/src/frontends/qt4/GuiPainter.cpp +++ b/src/frontends/qt4/GuiPainter.cpp @@ -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; }