diff options
author | Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org> | 2009-05-29 23:59:28 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-07-22 18:04:38 (GMT) |
commit | afaa14f2d84c0071b1ca8b75e35ba456382bb29f (patch) | |
tree | 7f14532de0509460f25faee691d775c05e27043d | |
parent | a3d7de451c005d76e6680a785195fab0f986c06c (diff) | |
download | Qt-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>
-rw-r--r-- | src/gui/graphicsview/qsimplex_p.cpp | 8 |
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) |