summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qsimplex_p.cpp
diff options
context:
space:
mode:
authorAnselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>2009-05-29 23:59:28 (GMT)
committerEduardo M. Fleury <eduardo.fleury@openbossa.org>2009-07-22 18:04:38 (GMT)
commitafaa14f2d84c0071b1ca8b75e35ba456382bb29f (patch)
tree7f14532de0509460f25faee691d775c05e27043d /src/gui/graphicsview/qsimplex_p.cpp
parenta3d7de451c005d76e6680a785195fab0f986c06c (diff)
downloadQt-afaa14f2d84c0071b1ca8b75e35ba456382bb29f.zip
Qt-afaa14f2d84c0071b1ca8b75e35ba456382bb29f.tar.gz
Qt-afaa14f2d84c0071b1ca8b75e35ba456382bb29f.tar.bz2
QSimplex: Skip x = x + y*0.0
A small optimization. Added a verification in combineRows to skip calculating x = x + y*0.0 as it obviously won't change the value of x. Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
Diffstat (limited to 'src/gui/graphicsview/qsimplex_p.cpp')
-rw-r--r--src/gui/graphicsview/qsimplex_p.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp
index b1cba45..b90d53f 100644
--- a/src/gui/graphicsview/qsimplex_p.cpp
+++ b/src/gui/graphicsview/qsimplex_p.cpp
@@ -220,7 +220,13 @@ void QSimplex::combineRows(int toIndex, int fromIndex, qreal factor)
qreal *to = matrix + toIndex * columns;
for (int j = 1; j < columns; ++j) {
- to[j] += factor * from[j];
+ qreal value = from[j];
+
+ // skip to[j] = to[j] + factor*0.0
+ if (value == 0.0)
+ continue;
+
+ to[j] += factor * value;
// ### Avoid Numerical errors
if (qAbs(to[j]) < 0.0000000001)