[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Jan 12 22:48:33 CET 2010
SVN commit 1073794 by netterfield:
don't redraw plots/curve that are masked by maximizing another plot.
BUG: 221687
M +3 -1 libkst/vector.cpp
M +0 -1 libkstapp/cartesianrenderitem.cpp
M +6 -2 libkstapp/plotitem.cpp
M +2 -1 libkstapp/plotitem.h
M +5 -0 libkstapp/plotrenderitem.cpp
M +2 -1 libkstapp/view.cpp
M +4 -0 libkstapp/view.h
--- branches/work/kst/portto4/kst/src/libkst/vector.cpp #1073793:1073794
@@ -118,7 +118,9 @@
\
double fj = in_i * double(_size - 1) / double(ns_i-1); /* scaled index */ \
\
- int j = int(floor(fj)); /* index of sample one lower */ \
+ /*int j = int(floor(fj));*/ /* index of sample one lower */ \
+ int j = int(fj); /* index of sample one lower */ \
+ /*assert(j==int(floor(fj)));*/ \
assert(j+1 < _size && j >= 0); \
if (_v[j + 1] != _v[j + 1] || _v[j] != _v[j]) { \
return NOPOINT; \
--- branches/work/kst/portto4/kst/src/libkstapp/cartesianrenderitem.cpp #1073793:1073794
@@ -40,7 +40,6 @@
painter->translate(normalRect.x(), normalRect.y());
foreach (RelationPtr relation, relationList()) {
- //FIXME static_cast to kstvcurve and take advantage of extra api
CurveRenderContext context;
context.painter = painter;
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1073793:1073794
@@ -813,6 +813,10 @@
QTime bench_time;
bench_time.start();
#endif
+ if (maskedByMaximization()) {
+ _plotPixmapDirty = false;
+ return;
+ }
_plotPixmapDirty = false;
QPixmap pixmap(rect().width()+1, rect().height()+1);
@@ -850,7 +854,6 @@
painter->setPen(Qt::NoPen);
painter->drawRect(rect());
painter->restore();
-
painter->drawPixmap(rect().topLeft(), _plotPixmap);
}
#if BENCHMARK
@@ -1996,7 +1999,6 @@
if (!_leftLabel.dirty) {
return;
}
-
_leftLabel.valid = false;
_leftLabel.dirty = false;
Label::Parsed *parsed = Label::parse(leftLabel());
@@ -2694,6 +2696,7 @@
setPos(_plotMaximizedSourcePosition);
setViewRect(_plotMaximizedSourceRect);
setZValue(_plotMaximizedSourceZValue);
+ parentView()->setChildMaximized(false);
parentView()->setFontRescale(1.0);
} else {
_plotMaximized = true;
@@ -2711,6 +2714,7 @@
double rescale = double(parentView()->sceneRect().width() +
parentView()->sceneRect().height())/
double(_plotMaximizedSourceRect.width() + _plotMaximizedSourceRect.height());
+ parentView()->setChildMaximized(true);
parentView()->setFontRescale(rescale);
}
setPlotBordersDirty();
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #1073793:1073794
@@ -251,6 +251,7 @@
void saveAsDialogDefaults() const;
void applyDefaults();
+ bool maskedByMaximization() {return (parentView()->childMaximized() && !_plotMaximized);}
protected:
virtual QString _automaticDescriptiveName() const;
virtual void _initializeShortName();
@@ -317,7 +318,7 @@
void setBottomLabelDirty() { _bottomLabel.dirty = true; setPlotPixmapDirty(); }
void setLabelsDirty() { _leftLabel.dirty = true; _rightLabel.dirty = true; _topLabel.dirty = true; _bottomLabel.dirty = true; setPlotPixmapDirty(); }
- void setPlotPixmapDirty(bool dirty = true) { _plotPixmapDirty = dirty; }
+ void setPlotPixmapDirty(bool dirty = true) {_plotPixmapDirty = dirty; }
void setAxisLabelsDirty(bool dirty = true) { _axisLabelsDirty = dirty; }
private:
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1073793:1073794
@@ -237,8 +237,13 @@
if (!rect().isValid()) {
return;
}
+ if (plotItem()->maskedByMaximization()) {
+ return;
+ }
+
painter->setRenderHint(QPainter::Antialiasing, false);
+
#ifdef CURVE_DRAWING_TIME
QTime time;
time.start();
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #1073793:1073794
@@ -52,7 +52,8 @@
_plotBordersDirty(false),
_printing(false),
_dataMode(false),
- _fontRescale(1.0) {
+ _fontRescale(1.0),
+ _childMaximized(false) {
_undoStack = new QUndoStack(this);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
--- branches/work/kst/portto4/kst/src/libkstapp/view.h #1073793:1073794
@@ -104,6 +104,9 @@
void setFontRescale(double rescale) {_fontRescale = rescale;}
double fontRescale() const {return _fontRescale;}
+
+ void setChildMaximized(bool isMax) { _childMaximized = isMax;}
+ bool childMaximized() const {return _childMaximized;}
Q_SIGNALS:
void viewModeChanged(View::ViewMode oldMode);
void mouseModeChanged(View::MouseMode oldMode);
@@ -155,6 +158,7 @@
bool _printing;
bool _dataMode;
double _fontRescale;
+ bool _childMaximized;
};
}
More information about the Kst
mailing list