[Kst] extragear/graphics/kst/kst
Ted Kisner
tskisner.public at gmail.com
Wed Nov 2 01:14:21 CET 2005
SVN commit 476773 by tskisner:
remove matrix checks from functions that are only called from the paint function. If these get called, then we have already checked for the matrix.
M +14 -20 kstimage.cpp
--- trunk/extragear/graphics/kst/kst/kstimage.cpp #476772:476773
@@ -259,23 +259,21 @@
QColor KstImage::getMappedColor(double x, double y) {
bool ok;
- if (_inputMatrices.contains(THEMATRIX)) {
- double z = _inputMatrices[THEMATRIX]->value(x, y, &ok);
- if (ok) {
- int index;
- if (_zUpper - _zLower != 0) {
- if (z > _zUpper) {
- index = _pal->nrColors() - 1;
- } else if (z < _zLower) {
- index = 0;
- } else {
- index = (int)floor(((z - _zLower) * (_pal->nrColors() - 1)) / (_zUpper - _zLower));
- }
- } else {
+ double z = _inputMatrices[THEMATRIX]->value(x, y, &ok);
+ if (ok) {
+ int index;
+ if (_zUpper - _zLower != 0) {
+ if (z > _zUpper) {
+ index = _pal->nrColors() - 1;
+ } else if (z < _zLower) {
index = 0;
+ } else {
+ index = (int)floor(((z - _zLower) * (_pal->nrColors() - 1)) / (_zUpper - _zLower));
}
- return _pal->color(index);
+ } else {
+ index = 0;
}
+ return _pal->color(index);
}
return QColor();
}
@@ -405,12 +403,8 @@
bool KstImage::getNearestZ(double x, double y, double& z) {
bool ok;
- if (_inputMatrices.contains(THEMATRIX)) {
- z = _inputMatrices[THEMATRIX]->value(x,y,&ok);
- return ok;
- } else {
- return false;
- }
+ z = _inputMatrices[THEMATRIX]->value(x,y,&ok);
+ return ok;
}
More information about the Kst
mailing list