[Kst] kdeextragear-2/kst
George Staikos
staikos at kde.org
Thu Jun 17 07:12:09 CEST 2004
CVS commit by staikos:
drawing is much faster now - eliminated unnecessary internal redraws -
profiling shows a big improvement, and it's very noticeable with, for example,
dragging labels
M +0 -1 devel-docs/newviewtodo.txt 1.31
M +23 -9 kst/kst2dplot.cpp 1.92
--- kdeextragear-2/kst/devel-docs/newviewtodo.txt #1.30:1.31
@@ -39,5 +39,4 @@
- Layout mode flicker (George)
- undo/redo
-- new view painting is very slow (George)
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.91:1.92
@@ -226,5 +226,5 @@ void Kst2DPlot::commonConstructor(const
bool y_log) {
- _xLeft = 0;
+ _xLeft = -99999999;
_hasFocus = false;
_copy_x = _copy_y = KST::NOPOINT;
@@ -972,12 +972,24 @@ void Kst2DPlot::triggerBorderAdjustments
void Kst2DPlot::paint(QPainter& p) {
setpixrect(_geom.x(), _geom.y());
- _xLeft = getXBorder(p);
+ double tmp = getXBorder(p);
PlotDisplayManager *dm = PlotDisplayManager::self();
- if (_xLeft > dm->xOffset) {
- dm->xOffset = _xLeft;
- triggerBorderAdjustments(_xLeft);
+ if (tmp > dm->xOffset) {
+ if (_xLeft != tmp) {
+ dm->xOffset = _xLeft = tmp;
+ draw();
} else {
+ dm->xOffset = tmp;
+ }
+ triggerBorderAdjustments(_xLeft);
+ } else if (tmp < dm->xOffset) {
_xLeft = dm->xOffset;
draw();
+ } else {
+ if (_xLeft != tmp) {
+ _xLeft = tmp;
+ draw();
+ } else {
+ _xLeft = tmp;
+ }
}
_buffer.paintInto(p, geometry());
@@ -991,11 +1003,13 @@ void Kst2DPlot::draw() {
_buffer.buffer().fill(backgroundColor());
QPainter p(&_buffer.buffer());
- _xLeft = getXBorder(p);
+ double tmp = getXBorder(p);
PlotDisplayManager *dm = PlotDisplayManager::self();
- if (_xLeft > dm->xOffset) {
- dm->xOffset = _xLeft;
+ if (tmp > dm->xOffset) {
+ dm->xOffset = _xLeft = tmp;
// Danger: recusion -- triggerBorderAdjustments(x);
- } else {
+ } else if (tmp < dm->xOffset) {
_xLeft = dm->xOffset;
+ } else {
+ _xLeft = tmp;
}
paint(p, dm->xOffset);
More information about the Kst
mailing list