[Kst] extragear/graphics/kst/kst
Andrew Walker
arwalker at sumusltd.com
Wed Dec 14 22:58:06 CET 2005
SVN commit 488545 by arwalker:
BUG:118148 Fixes bug with clipping while drawing curves and is more efficient.
M +13 -15 kst2dplot.cpp
M +0 -7 kstvcurve.cpp
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #488544:488545
@@ -2444,14 +2444,6 @@
bt[i_bt++] = benchTime.elapsed();
#endif
- if (_xReversed) {
- p.scale(-1,1);
- p.translate(d2i(-1.0 * Hx - Lx), 0);
- }
- if (_yReversed) {
- p.scale(1,-1);
- p.translate(0, d2i(-1.0 * Hy - Ly));
- }
// create the context
KstCurveRenderContext context;
// FIXME: someone document what these things mean
@@ -2479,17 +2471,23 @@
context._backgroundColor = _backgroundColor;
// paint the curves
- for (KstBaseCurveList::Iterator i = Curves.begin(); i != Curves.end(); ++i) {
- (*i)->paint(context);
+ p.save();
+ if (_xReversed) {
+ p.scale(-1, 1);
+ p.translate(d2i(-1.0 * Hx - Lx), 0);
}
if (_yReversed) {
- p.scale(1,-1);
+ p.scale(1, -1);
p.translate(0, d2i(-1.0 * Hy - Ly));
+ }
+ if (p.type() == KstPainter::P_EXPORT || p.type() == KstPainter::P_PRINT) {
+ } else {
+ p.setClipRect(int(Lx), int(Ly), int(Hx - Lx), int(Hy - Ly), QPainter::CoordPainter);
+ }
+ for (KstBaseCurveList::Iterator i = Curves.begin(); i != Curves.end(); ++i) {
+ (*i)->paint(context);
}
- if (_xReversed) {
- p.scale(-1,1);
- p.translate(d2i(-1.0 * Hx - Lx), 0);
- }
+ p.restore();
#ifdef BENCHMARK
bt_label[i_bt] = "Plot Curves";
--- trunk/extragear/graphics/kst/kst/kstvcurve.cpp #488544:488545
@@ -843,10 +843,6 @@
bool overlap = false;
int i_pt;
- QRegion clipRegion = p->clipRegion();
- bool clipping = p->hasClipping();
- p->setClipRect(int(Lx), int(Ly), int(Hx - Lx), int(Hy - Ly), QPainter::CoordPainter);
-
#ifdef BENCHMARK
QTime bench_time, benchtmp;
int b_1 = 0, b_2 = 0, b_3 = 0, b_4 = 0;
@@ -1530,9 +1526,6 @@
if (b_3 - b_2 > 0) kstdDebug() << " Points: " << (b_3 - b_2) << "ms" << endl;
if (b_4 - b_3 > 0) kstdDebug() << " Errors: " << (b_4 - b_3) << "ms" << endl;
#endif
-
- p->setClipRegion(clipRegion);
- p->setClipping(clipping);
}
More information about the Kst
mailing list