[Kst] extragear/graphics/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Sun Sep 18 07:14:01 CEST 2005
SVN commit 461581 by netterfield:
More improvements to view labels.
resize resize bug fixed
fewer renders called
M +1 -1 kst2dplot.cpp
M +19 -9 kstviewlabel.cpp
M +8 -0 kstviewobject.cpp
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #461580:461581
@@ -2283,7 +2283,7 @@
if (_zoomPaused) {
return;
}
-
+ kdDebug() << type << "paint 2dplot\n";
// check for optimizations
QSize sizeNew = size();
QRect alignment = KST::alignment.limits(geometry());
--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #461580:461581
@@ -140,6 +140,7 @@
if (_rotation != rotation) {
setDirty();
_rotation = rotation;
+ kdDebug() << "setRotation\n";
drawToBuffer(_parsed);
}
}
@@ -149,6 +150,7 @@
if (_justify != justify) {
setDirty();
_justify = justify;
+ kdDebug() << "setJustification\n";
drawToBuffer(_parsed);
}
}
@@ -156,6 +158,7 @@
void KstViewLabel::resize(const QSize& size) {
KstBorderedViewObject::resize(size);
+ kdDebug() << "resize\n";
drawToBuffer(_parsed);
}
@@ -169,6 +172,7 @@
if (_fontName != fontName) {
setDirty();
_fontName = fontName;
+ kdDebug() << "setFontName\n";
drawToBuffer(_parsed);
}
}
@@ -198,6 +202,7 @@
if (replace != _replace) {
setDirty();
_replace = replace;
+ kdDebug() << "setDoScalarReplacement\n";
drawToBuffer(_parsed);
}
}
@@ -205,7 +210,7 @@
void KstViewLabel::drawToBuffer(Label::Parsed *lp) {
if (dirty()) {
- computeTextSize(lp); // hmm this is inefficient
+ //computeTextSize(lp); // hmm this is inefficient
}
setDirty(false);
@@ -294,23 +299,29 @@
void KstViewLabel::paint(KstPaintType type, QPainter& p) {
+ //kdDebug() << type << "paint viewlabel\n";
if (type == P_PRINT) {
p.save();
if (_autoResize) {
adjustSizeForText(p.window());
+ } else {
+ computeTextSize(_parsed);
}
p.setViewport(geometry());
p.setWindow(0,0,geometry().width(), geometry().height());
drawToPainter(_parsed, p);
- setDirty();
+ //setDirty();
p.restore();
} else {
bool d = dirty();
if (d) {
if (_autoResize) {
- adjustSizeForText(p.window());
+ adjustSizeForText(p.window()); // calls computeTextSize and drawToBuffer
+ } else {
+ computeTextSize(_parsed);
+ kdDebug() << "in paint/no autoResize\n";
+ drawToBuffer(_parsed);
}
- drawToBuffer(_parsed);
}
if (_transparent) {
@@ -336,7 +347,7 @@
QPixmap pm(geometry().bottomRight().x(), geometry().bottomRight().y());
if (!pm.isNull()) {
if (dirty()) {
- computeTextSize(_parsed); // hmm this is inefficient?
+ //computeTextSize(_parsed); // hmm this is inefficient?
}
pm.fill();
QPainter p(&pm);
@@ -405,10 +416,8 @@
}
}
- if (dirty()) {
- computeTextSize(_parsed); // FIXME this is inefficient
- }
-
+ computeTextSize(_parsed);
+
if (_rotation != 0 && _rotation != 180) {
QPointArray pts(4);
pts[0] = QPoint(0, 0);
@@ -576,6 +585,7 @@
if (n != _dataPrecision) {
setDirty();
_dataPrecision = n;
+ kdDebug() << "setDataPrecision\n";
drawToBuffer(_parsed);
}
}
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #461580:461581
@@ -472,9 +472,17 @@
void KstViewObject::resize(const QSize& size) {
+ double xc, yc;
+
+ xc = _aspect.x; // preserve position in double precision to avoid wander on resize...
+ yc = _aspect.y;
+
setMinimumSize(minimumSize().expandedTo(QSize(_children.count(), _children.count())));
_geom.setSize(size.expandedTo(_minimumSize));
updateAspect();
+ _aspect.x = xc; // restore position.
+ _aspect.y = yc;
+ updateFromAspect();
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
(*i)->parentResized();
}
More information about the Kst
mailing list