[Kst] branches/work/kst/1.5/kst/src/libkstmath
Andrew Walker
arwalker at sumusltd.com
Sat Sep 15 00:58:33 CEST 2007
SVN commit 712631 by arwalker:
prevent crash that resulted from javeScript being used to set point density to 4
M +9 -6 kstvcurve.cpp
--- branches/work/kst/1.5/kst/src/libkstmath/kstvcurve.cpp #712630:712631
@@ -812,14 +812,15 @@
void KstVCurve::setPointDensity(int in_PointDensity) {
- PointDensity = in_PointDensity;
- setDirty();
- emit modifiedLegendEntry();
+ if (in_PointDensity >= 0 && (unsigned int)in_PointDensity < KSTPOINTDENSITY_MAXTYPE) {
+ PointDensity = in_PointDensity;
+ setDirty();
+ }
}
void KstVCurve::setPointStyle(int in_PointStyle) {
- if (in_PointStyle >= 0 && (unsigned int)in_PointStyle <KSTPOINT_MAXTYPE)
+ if (in_PointStyle >= 0 && (unsigned int)in_PointStyle < KSTPOINT_MAXTYPE)
{
PointStyle = in_PointStyle;
setDirty();
@@ -1370,12 +1371,14 @@
// draw the points, if any...
if (hasPoints()) {
- if (hasLines() && pointDensity() != 0) {
+ if (hasLines() && pointDensity() > 0 &&
+ (unsigned int)pointDensity() < KSTPOINTDENSITY_MAXTYPE) {
const double w = Hx - Lx;
const double h = Hy - Ly;
+ const int size = int(kMax(w, h)) / int(pow(3.0, KSTPOINTDENSITY_MAXTYPE - pointDensity()));
QRegion rgn((int)Lx, (int)Ly, (int)w, (int)h);
- const int size = int(kMax(w, h)) / int(pow(3.0, KSTPOINTDENSITY_MAXTYPE - pointDensity()));
QPoint pt;
+
for (i_pt = i0; i_pt <= iN; ++i_pt) {
rX = xv->interpolate(i_pt, NS);
rY = yv->interpolate(i_pt, NS);
More information about the Kst
mailing list