[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Thu Aug 26 18:53:44 CEST 2004
CVS commit by arwalker:
Simplify the code for plotting of non-solid line types.
M +22 -45 kst2dplot.cpp 1.254
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.253:1.254
@@ -4161,6 +4161,6 @@ void Kst2DPlot::plotCurves(QPainter& p,
double maxY = 0.0, minY = 0.0;
double rX, rY, rEX, rEY;
- double X1, Y1;
- double X2, Y2;
+ double X1 = 0.0, Y1 = 0.0;
+ double X2 = 0.0, Y2 = 0.0;
double last_x1, last_y1;
bool overlap;
@@ -4286,35 +4286,10 @@ void Kst2DPlot::plotCurves(QPainter& p,
p.drawLine((int)X2, (int)minY, (int)X2, (int)maxY);
} else {
- if (index == 0) {
- if (Y2 == minY) {
- points.setPoint(index++, (int)X2, (int)maxY);
- points.setPoint(index++, (int)X2, (int)minY);
- } else if (Y2 == maxY) {
- points.setPoint(index++, (int)X2, (int)minY);
- points.setPoint(index++, (int)X2, (int)maxY);
- } else {
- points.setPoint(index++, (int)X2, (int)minY);
- points.setPoint(index++, (int)X2, (int)maxY);
- if (Y2 >= Ly && Y2 <= Hy) {
- points.setPoint(index++, (int)X2, (int)Y2);
- }
- }
- } else if (lastPlottedX == (int)X2 && index < MAX_NUM_POLYLINES-1) {
- if (Y2 == minY) {
- points.setPoint(index++, (int)X2, (int)maxY);
- points.setPoint(index++, (int)X2, (int)minY);
- } else if (Y2 == maxY) {
- points.setPoint(index++, (int)X2, (int)minY);
- points.setPoint(index++, (int)X2, (int)maxY);
- } else {
- points.setPoint(index++, (int)X2, (int)minY);
- points.setPoint(index++, (int)X2, (int)maxY);
- if (Y2 >= Ly && Y2 <= Hy) {
- points.setPoint(index++, (int)X2, (int)Y2);
- }
- }
- } else if (index > 0) {
+ if (lastPlottedX != (int)X2 || index >= MAX_NUM_POLYLINES-2) {
+ if (index > 1) {
p.drawPolyline(points, 0, index);
+ }
index = 0;
+ }
if (Y2 == minY) {
points.setPoint(index++, (int)X2, (int)maxY);
@@ -4330,5 +4305,4 @@ void Kst2DPlot::plotCurves(QPainter& p,
}
}
- }
lastPlottedX = (int)X2;
lastPlottedY = (int)Y2;
@@ -4432,5 +4406,7 @@ void Kst2DPlot::plotCurves(QPainter& p,
points.setPoint(index++, (int)X1, (int)Y1);
} else {
+ if (index > 1) {
p.drawPolyline(points, 0, index);
+ }
index = 0;
points.setPoint(index++, (int)X2, (int)Y2);
@@ -4449,6 +4425,7 @@ void Kst2DPlot::plotCurves(QPainter& p,
// we might a have polyline left undrawn...
//
- if (index > 0) {
+ if (index > 1) {
p.drawPolyline(points, 0, index);
+ index = 0;
}
More information about the Kst
mailing list