Mike Fenton | 1 Apr 2009 16:50

branches/work/kst/portto4/kst/src/libkstapp

SVN commit 947891 by fenton:

Move margin sizing calculations out of access functions.
Add calculatedFont to PlotLabel and code cleanup.

 M  +75 -126   plotitem.cpp  
 M  +4 -11     plotitem.h  
 M  +3 -3      plotitemdialog.cpp  

--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #947890:947891
 <at>  <at>  -522,6 +522,8  <at>  <at> 
   calculateTopLabelMargin(painter);
   calculateBottomLabelMargin(painter);

+  calculateMargins();
+
   setPlotRectsDirty();
 }

 <at>  <at>  -538,7 +540,7  <at>  <at> 
   painter->restore();

   painter->save();
-  painter->setFont(calculatedNumberLabelFont());
+  painter->setFont(numberLabelDetails()->calculatedFont());

   // FIXME: the plot size calculations need to be separated from the 
   // painting to avoid n^2 or worse behavior.
 <at>  <at>  -898,7 +900,7  <at>  <at> 
   int flags = Qt::TextSingleLine | Qt::AlignCenter;
(Continue reading)

Mike Fenton | 1 Apr 2009 22:23

branches/work/kst/portto4/kst/src/libkstapp

SVN commit 947970 by fenton:

Cleanup LabelTab
Fix AutoLabels by making overrideText purely an override.

 M  +0 -12     labeltab.cpp  
 M  +0 -1      labeltab.h  
 M  +57 -30    plotitem.cpp  
 M  +10 -5     plotitem.h  

--- branches/work/kst/portto4/kst/src/libkstapp/labeltab.cpp #947969:947970
 <at>  <at>  -56,9 +56,6  <at>  <at> 

   connect(_showLegend, SIGNAL(stateChanged(int)), this, SIGNAL(modified()));

-  //connect(_applyGlobalsButton, SIGNAL(pressed()), this, SLOT(applyGlobals()));
-  //connect(_autoLabel, SIGNAL(pressed()), this, SLOT(autoLabel()));
-
   connect(_editLegendContents, SIGNAL(pressed()), _plotItem->legend(), SLOT(edit()));

   connect(_globalLabelFontSize, SIGNAL(valueChanged(double)), this, SIGNAL(globalFontUpdate()));
 <at>  <at>  -143,15 +140,6  <at>  <at> 
 }

 
-void LabelTab::autoLabel() {
-  setLeftLabel(_plotItem->leftLabel());
-  setBottomLabel(_plotItem->bottomLabel());
-  setTopLabel(_plotItem->topLabel());
-  setRightLabel(_plotItem->rightLabel());
(Continue reading)

Mike Fenton | 2 Apr 2009 16:28

branches/work/kst/portto4/kst/src/libkstapp

SVN commit 948189 by fenton:

Fix missing update for ticks.

 M  +1 -0      plotaxis.cpp  

--- branches/work/kst/portto4/kst/src/libkstapp/plotaxis.cpp #948188:948189
 <at>  <at>  -633,6 +633,7  <at>  <at> 

     updateTicks(true);
   }
+  setTicksUpdated();
 }
Mike Fenton | 3 Apr 2009 21:34

branches/work/kst/portto4/kst/src/libkstapp

SVN commit 948786 by fenton:

Fix multiple Plot updates triggered on zoom actions.

 M  +13 -0     plotitem.cpp  
 M  +1 -0      plotitem.h  
 M  +6 -5      viewgridlayout.cpp  

--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #948785:948786
 <at>  <at>  -1074,6 +1074,19  <at>  <at> 
 }

 
+void PlotItem::setPadding(const qreal left, const qreal right, const qreal top, const qreal bottom) {
+  if ((left == _leftPadding) && (right == _rightPadding) && (top == _topPadding) && (bottom ==
_bottomPadding)) {
+    return;
+  }
+  _leftPadding = left;
+  _rightPadding = right;
+  _topPadding = top;
+  _bottomPadding = bottom;
+  setPlotRectsDirty();
+  updatePlotRect();
+}
+
+
 void PlotItem::setLeftPadding(const qreal padding) {
   if (padding != _leftPadding) {
     _leftPadding = padding;
(Continue reading)

Mike Fenton | 6 Apr 2009 18:32

branches/work/kst/portto4/kst/src/libkstapp

SVN commit 950203 by fenton:

Fix curve drawing offset in plot.

 M  +3 -2      plotitem.cpp  
 M  +1 -0      plotitem.h  

--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #950202:950203
 <at>  <at>  -136,7 +136,7  <at>  <at> 
   _gnum++;

   setPlotBordersDirty(true);
-  connect(this, SIGNAL(updatePlotRect()), this, SLOT(redrawPlot()));
+  connect(this, SIGNAL(triggerRedraw()), this, SLOT(redrawPlot()));
   connect(this, SIGNAL(geometryChanged()), this, SLOT(setLabelsDirty()));
 }

 <at>  <at>  -1025,6 +1025,7  <at>  <at> 
   }
   _calculatedPlotRect = plot;
   _plotRectsDirty = false;
+  emit updatePlotRect();
 }

 
 <at>  <at>  -1083,7 +1084,7  <at>  <at> 
   _topPadding = top;
   _bottomPadding = bottom;
   setPlotRectsDirty();
-  updatePlotRect();
(Continue reading)

Бирюк | 9 Apr 2009 20:34
Picon

Вам нужен хостинг под рассылку?

СПAM ХОСТИНГ
(абузоустойчивый хостинг)

Вы хотите заказать е-мэйл рассылку и указать в сообщении ссылку на ваш сайт?
Хорошая идея, это действительно сработает и увеличит посещаемость вашего сайта!

Однако, Внимание!!! Если Вы рекламируете свой сайт в Интернет всеми возможными способами, в том числе и массовыми рассылками, Вам необходим специальный хостинг под спам, потому что сайт, находящийся на обычном, неустойчивом к жалобам от почтовых сервисов хостинге, НЕМИНУЕМО БУДЕТ ЗАКРЫТ. И произойдёт это достаточно быстро!

Чтобы Ваш хостер не закрыл Ваш сайт из-за жалоб на СПАМ, закажите на время проведения массовой рассылки абузоустойчивый хостинг.

MINI PLAN
Объем диска
Домены
Трафик*
FTP-доступ
БД MySQL
Панель управления
СТОИМОСТЬ
400 мб

1

Неограничен
есть
есть
есть
4 000 руб./1 мес.

STARTER PLAN
Объем диска
Домены
Трафик*
FTP-доступ
БД MySQL
Панель управления
СТОИМОСТЬ
500 мб

3

Неограничен
есть
есть
есть
5 000 руб./1 мес.

BUSINESS PLAN
Объем диска
Домены
Трафик*
FTP-доступ
БД MySQL
Панель управления
СТОИМОСТЬ
1000 мб

6

Неограничен
есть
есть
есть
7 000 руб./1 мес.

PREMIUM PLAN
Объем диска
Домены
Трафик*
FTP-доступ
БД MySQL
Панель управления
СТОИМОСТЬ
Неограничен

Неограничен

Неограничен
есть
есть
есть
18 000 руб./1 мес

НЕОГРАНИЧЕННЫЙ ТРАФИК
Неограничен он для всех проектов, кроме файловых архивов.
Для подобных проектах трафик оговаривается.

Рассылка исходящего CПAМа с хостинга КАТЕГОРИЧЕСКИ ЗАПРЕЩЕНА!

ТЕЛЕФОН: (495) 51Ч-42-65, (Ч95)5Ч2-З987
ICQ: 4183 962 04, 387 661 55 8

_______________________________________________
Kst mailing list
Kst <at> kde.org
https://mail.kde.org/mailman/listinfo/kst
Mike Fenton | 9 Apr 2009 21:43

branches/work/kst/portto4/kst/src/libkstapp

SVN commit 951617 by fenton:

Cache entire PlotItem into pixmap.

 M  +70 -20    plotitem.cpp  
 M  +13 -6     plotitem.h  

--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #951616:951617
 <at>  <at>  -49,7 +49,8  <at>  <at> 
 #define DEBUG_LABEL_REGION 0

 // Benchmark drawing
-// #define BENCHMARK 1
+// 0 = None, 1 = PlotItem, 2 = More Details
+#define BENCHMARK 0

 static const int PLOT_MAXIMIZED_ZORDER = 1000;

 <at>  <at>  -80,11 +81,12  <at>  <at> 
   _allowUpdates(true),
   _updateDelayed(false),
   _legend(0),
-  _axisLabelsDirty(true),
   _zoomMenu(0),
   _filterMenu(0),
   _fitMenu(0),
-  _sharedBox(0)
+  _sharedBox(0),
+  _axisLabelsDirty(true),
+  _plotPixmapDirty(true)
 {

   setTypeName("Plot");
 <at>  <at>  -99,6 +101,8  <at>  <at> 
   connect(this, SIGNAL(geometryChanged()), _yAxis, SLOT(setTicksUpdated()));
   connect(this, SIGNAL(geometryChanged()), this, SLOT(setPlotRectsDirty()));

+  _globalFont = parentView()->defaultFont();
+
   _leftLabelDetails = new PlotLabel(this);
   _rightLabelDetails = new PlotLabel(this);
   _topLabelDetails = new PlotLabel(this);
 <at>  <at>  -138,6 +142,8  <at>  <at> 
   setPlotBordersDirty(true);
   connect(this, SIGNAL(triggerRedraw()), this, SLOT(redrawPlot()));
   connect(this, SIGNAL(geometryChanged()), this, SLOT(setLabelsDirty()));
+  connect(this, SIGNAL(updateAxes()), this, SLOT(setPlotPixmapDirty()));
+  connect(this, SIGNAL(geometryChanged()), this, SLOT(setPlotPixmapDirty()));
 }

 
 <at>  <at>  -529,18 +535,63  <at>  <at> 
 }

 
+void PlotItem::updatePlotPixmap() {
+#if BENCHMARK
+  QTime bench_time;
+  bench_time.start();
+#endif
+  _plotPixmapDirty = false;
+
+  QPixmap pixmap(rect().width()+1, rect().height()+1);
+  pixmap.fill(Qt::transparent);
+  QPainter pixmapPainter(&pixmap);
+
+  paintPixmap(&pixmapPainter);
+
+  _plotPixmap = pixmap;
+#if BENCHMARK
+  int i = bench_time.elapsed();
+  qDebug() << "Total Time to update plot pixmap " << (void *)this << ": " << i << "ms";
+#endif
+}
+
+
 void PlotItem::paint(QPainter *painter) {
+#if BENCHMARK
+  QTime bench_time;
+  bench_time.start();
+#endif
+  if (_plotPixmapDirty) {
+    updatePlotPixmap();
+  }
+
+  painter->save();
+  painter->setPen(Qt::NoPen);
+  painter->drawRect(rect());
+  painter->restore();
+
+  painter->drawPixmap(QPointF(0, 0), _plotPixmap);
+#if BENCHMARK
+  int i = bench_time.elapsed();
+  qDebug() << "Total Time to paint " << (void *)this << ": " << i << "ms" << endl;
+#endif
+
+}
+
+
+void PlotItem::paintPixmap(QPainter *painter) {
   if (parentView()->plotBordersDirty() || (creationState() == ViewItem::InProgress)) {
     ViewGridLayout::standardizePlotMargins(this, painter);
     setPlotBordersDirty(false);
   }

-#ifdef BENCHMARK
+#if BENCHMARK
   QTime bench_time, benchtmp;
   int b_1 = 0, b_2 = 0, b_3 = 0, b_4 = 0, b_5 = 0;
   bench_time.start();
   benchtmp.start();
 #endif
+
   painter->save();
   painter->setPen(Qt::NoPen);
   painter->drawRect(rect());
 <at>  <at>  -549,7 +600,7  <at>  <at> 
   painter->save();
   painter->setFont(numberLabelDetails()->calculatedFont());

-#ifdef BENCHMARK
+#if BENCHMARK
     b_1 = benchtmp.elapsed();
 #endif
 #if DEBUG_LABEL_REGION
 <at>  <at>  -568,29 +619,29  <at>  <at> 
   //  qDebug() << "=============> topLabel:" << topLabel() << endl;
 #endif
   paintTopLabel(painter);
-#ifdef BENCHMARK
+#if BENCHMARK
     b_2 = benchtmp.elapsed();
 #endif

   paintPlot(painter);
-#ifdef BENCHMARK
+#if BENCHMARK
     b_3 = benchtmp.elapsed();
 #endif

   paintTickLabels(painter);
-#ifdef BENCHMARK
+#if BENCHMARK
     b_4 = benchtmp.elapsed();
 #endif

   paintPlotMarkers(painter);
-#ifdef BENCHMARK
+#if BENCHMARK
     b_5 = benchtmp.elapsed();
 #endif

   painter->restore();
-#ifdef BENCHMARK
+#if BENCHMARK
   int i = bench_time.elapsed();
-  qDebug() << endl << "Painting Plot " << (void *)this << ": " << i << "ms";
+  qDebug() << "Painting Plot Pixmap " << (void *)this << ": " << i << "ms";
   if (b_1 > 0)       qDebug() << "            Setup: " << b_1 << "ms";
   if (b_2 - b_1 > 0) qDebug() << "           Labels: " << (b_2 - b_1) << "ms";
   if (b_3 - b_2 > 0) qDebug() << "             Plot: " << (b_3 - b_2) << "ms";
 <at>  <at>  -624,39 +675,39  <at>  <at> 
       updateYAxisLabels(painter);
     }
   }
-#ifdef BENCHMARK
+#if BENCHMARK > 1
   QTime bench_time, benchtmp;
   int b_1 = 0, b_2 = 0, b_3 = 0, b_4 = 0, b_5 = 0;
   bench_time.start();
   benchtmp.start();
 #endif
   paintMajorGridLines(painter);
-#ifdef BENCHMARK
+#if BENCHMARK > 1
     b_1 = benchtmp.elapsed();
 #endif
   paintMinorGridLines(painter);
-#ifdef BENCHMARK
+#if BENCHMARK > 1
     b_2 = benchtmp.elapsed();
 #endif
   painter->save();
   painter->setBrush(Qt::NoBrush);
   painter->drawRect(plotRect());
   painter->restore();
-#ifdef BENCHMARK
+#if BENCHMARK > 1
     b_3 = benchtmp.elapsed();
 #endif
   paintMajorTicks(painter);
-#ifdef BENCHMARK
+#if BENCHMARK > 1
     b_4 = benchtmp.elapsed();
 #endif
   paintMinorTicks(painter);
-#ifdef BENCHMARK
+#if BENCHMARK > 1
     b_5 = benchtmp.elapsed();
 #endif

-#ifdef BENCHMARK
+#if BENCHMARK > 1
   int i = bench_time.elapsed();
-  qDebug() << endl << "Painting Plot - PaintPlot " << (void *)this << ": " << i << "ms";
+  qDebug() << "Painting Plot - PaintPlot " << (void *)this << ": " << i << "ms";
   if (b_1 > 0)       qDebug() << "            Major Lines: " << b_1 << "ms";
   if (b_2 - b_1 > 0) qDebug() << "            Minor Lines: " << (b_2 - b_1) << "ms";
   if (b_3 - b_2 > 0) qDebug() << "                   Rect: " << (b_3 - b_2) << "ms";
 <at>  <at>  -787,7 +838,6  <at>  <at> 
     p2 = p1 - QPointF(minorTickLength, 0);
     _yMinorTickLines << QLineF(p1, p2);
   }
-
   _yPlotMarkerLines.clear();
   foreach (double y, _yAxis->axisPlotMarkers().markers()) {
     if (y > _yMin && y < _yMax) {
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #951616:951617
 <at>  <at>  -280,6 +280,7  <at>  <at> 
     void setBottomLabelDirty() { _bottomLabel.dirty = true; }
     void setLabelsDirty() { _leftLabel.dirty = true; _rightLabel.dirty = true; _topLabel.dirty = true;
_bottomLabel.dirty = true; }

+    void setPlotPixmapDirty() { _plotPixmapDirty = true; } 
     void setAxisLabelsDirty() { _axisLabelsDirty = true; }

   private:
 <at>  <at>  -290,6 +291,9  <at>  <at> 

     void resetSelectionRect();

+    void updatePlotPixmap();
+    virtual void paintPixmap(QPainter *painter);
+
     void updateXAxisLines();
     void updateYAxisLines();

 <at>  <at>  -407,12 +411,6  <at>  <at> 

     LegendItem* _legend;

-    bool _axisLabelsDirty;
-    DrawnLabel _leftLabel;
-    DrawnLabel _rightLabel;
-    DrawnLabel _topLabel;
-    DrawnLabel _bottomLabel;
-
     QMenu *_zoomMenu;
     QAction *_zoomMaximum;
     QAction *_zoomMaxSpikeInsensitive;
 <at>  <at>  -442,6 +440,12  <at>  <at> 

     SharedAxisBoxItem * _sharedBox;

+    bool _axisLabelsDirty;
+    DrawnLabel _leftLabel;
+    DrawnLabel _rightLabel;
+    DrawnLabel _topLabel;
+    DrawnLabel _bottomLabel;
+
     QVector<QLineF> _xMajorGridLines;
     QVector<QLineF> _yMajorGridLines;
     QVector<QLineF> _xMinorGridLines;
 <at>  <at>  -457,6 +461,9  <at>  <at> 
     QVector<CachedPlotLabel> _xPlotLabels;
     QVector<CachedPlotLabel> _yPlotLabels;

+    bool _plotPixmapDirty;
+    QPixmap _plotPixmap;
+
     QUndoStack *_undoStack;

     friend class ZoomCommand;

Mike Fenton | 14 Apr 2009 15:06

branches/work/kst/portto4/kst/src/libkstmath

SVN commit 953663 by fenton:

Fix typo.

 M  +1 -1      curve.cpp  
 M  +1 -1      curve.h  
 M  +1 -1      image.cpp  
 M  +1 -1      image.h  
 M  +1 -1      relation.cpp  
 M  +1 -1      relation.h  

--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #953662:953663
 <at>  <at>  -715,7 +715,7  <at>  <at> 
 }

 
-void Curve::paintObects(const CurveRenderContext& context) {
+void Curve::paintObjects(const CurveRenderContext& context) {
   QPainter *p = context.painter;
   Qt::PenStyle style = Kst::LineStyle[lineStyle()];

--- branches/work/kst/portto4/kst/src/libkstmath/curve.h #953662:953663
 <at>  <at>  -134,7 +134,7  <at>  <at> 
     virtual RelationPtr makeDuplicate(QMap<RelationPtr, RelationPtr> &duplicatedRelations);

     // render this curve
-    virtual void paintObects(const CurveRenderContext& context);
+    virtual void paintObjects(const CurveRenderContext& context);

     // Update the curve details.
     void updatePaintObjects(const CurveRenderContext& context);
--- branches/work/kst/portto4/kst/src/libkstmath/image.cpp #953662:953663
 <at>  <at>  -465,7 +465,7  <at>  <at> 
 }

 
-void Image::paintObects(const CurveRenderContext& context) {
+void Image::paintObjects(const CurveRenderContext& context) {
   QPainter* p = context.painter;
   p->drawImage(_imageLocation, _image);

--- branches/work/kst/portto4/kst/src/libkstmath/image.h #953662:953663
 <at>  <at>  -106,7 +106,7  <at>  <at> 
     virtual double distanceToPoint(double xpos, double dx, double ypos) const;

     // see KstRelation::paint
-    void paintObects(const CurveRenderContext& context);
+    void paintObjects(const CurveRenderContext& context);

     // Update the curve details.
     void updatePaintObjects(const CurveRenderContext& context);
--- branches/work/kst/portto4/kst/src/libkstmath/relation.cpp #953662:953663
 <at>  <at>  -65,7 +65,7  <at>  <at> 
     _redrawRequired = false;
   }

-  paintObects(context);
+  paintObjects(context);
 }

 
--- branches/work/kst/portto4/kst/src/libkstmath/relation.h #953662:953663
 <at>  <at>  -133,7 +133,7  <at>  <at> 
     // render this curve
     void paint(const CurveRenderContext& context);

-    virtual void paintObects(const CurveRenderContext& context) = 0;
+    virtual void paintObjects(const CurveRenderContext& context) = 0;
     virtual void updatePaintObjects(const CurveRenderContext& context) = 0;

     // render the legend symbol for this curve

Mike Fenton | 14 Apr 2009 16:47

branches/work/kst/portto4/kst/src/libkstapp

SVN commit 953795 by fenton:

Remove pixmap based caching of labels.  Add caching of parsed label.

 M  +58 -87    plotitem.cpp  
 M  +7 -7      plotitem.h  

--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #953794:953795
 <at>  <at>  -1584,30 +1584,11  <at>  <at> 
   if (parsed) {
     parsed->chunk->attributes.color = _leftLabelDetails->fontColor();

-    QRectF leftLabel = leftLabelRect();
-    QPixmap pixmap(leftLabel.height(), leftLabel.width());
-    pixmap.fill(Qt::transparent);
-    QPainter pixmapPainter(&pixmap);
-
-    Label::RenderContext rc(leftLabelDetails()->calculatedFont(), &pixmapPainter);
-    QFontMetrics fm(leftLabelDetails()->calculatedFont());
-    rc.y = fm.ascent();
-    Label::renderLabel(rc, parsed->chunk);
-
-    leftLabel.moveTopRight(plotAxisRect().topLeft());
-    leftLabel.moveBottomLeft(QPointF(leftLabel.bottomLeft().x(), plotRect().center().y()+ rc.x / 2));
-
-    QTransform t;
-    t.rotate(-90.0);
-    _leftLabel.pixmap = pixmap.transformed(t);
-    _leftLabel.rect = leftLabel;
-    _leftLabel.location = rc.x;
-    if (rc.x > 0) {
-      _leftLabel.valid = true;
+    if (_leftLabel.parsed) {
+      delete _leftLabel.parsed;
     }
-
-    delete parsed;
-    parsed = 0;
+    _leftLabel.parsed = parsed;
+    _leftLabel.valid = true;
   }
 }

 <at>  <at>  -1620,7 +1601,19  <at>  <at> 

   if (_leftLabel.valid) {
     painter->save();
-    painter->drawPixmap(_leftLabel.rect.topLeft(), _leftLabel.pixmap, QRectF(0, 0,
_leftLabel.location, _leftLabel.rect.height()));
+    QRectF leftLabel = leftLabelRect();
+
+    QRectF box = rect();
+
+    Label::RenderContext rc(leftLabelDetails()->calculatedFont(), painter);
+    leftLabel.moveTopRight(plotAxisRect().topLeft());
+    leftLabel.moveBottomLeft(QPointF(leftLabel.bottomLeft().x(), plotRect().center().y()));
+    QFontMetrics fm(leftLabelDetails()->calculatedFont());
+    rc.y = fm.ascent();
+    // Needs to be adjusted to be centered.  Must add way to get rc.x before painting.
+    painter->translate(QPointF(leftLabel.x(), -(leftLabel.y())));
+    painter->rotate(-90.0);
+    Label::renderLabel(rc, _leftLabel.parsed->chunk);
     painter->restore();
   }

 <at>  <at>  -1677,27 +1670,11  <at>  <at> 
   if (parsed) {
     parsed->chunk->attributes.color = _bottomLabelDetails->fontColor();

-    QRectF bottomLabel = bottomLabelRect();
-    QPixmap pixmap(bottomLabel.width(), bottomLabel.height());
-    pixmap.fill(Qt::transparent);
-    QPainter pixmapPainter(&pixmap);
-
-    Label::RenderContext rc(bottomLabelDetails()->calculatedFont(), &pixmapPainter);
-    QFontMetrics fm(bottomLabelDetails()->calculatedFont());
-    rc.y = fm.ascent();
-    Label::renderLabel(rc, parsed->chunk);
-
-    bottomLabel.moveBottomLeft(QPointF(plotRect().center().x()-rc.x/2, rect().bottomLeft().y()));
-
-    _bottomLabel.pixmap = pixmap;
-    _bottomLabel.rect = bottomLabel;
-    _bottomLabel.location = rc.x;
-    if (rc.x > 0) {
-      _bottomLabel.valid = true;
+    if (_bottomLabel.parsed) {
+      delete _bottomLabel.parsed;
     }
-
-    delete parsed;
-    parsed = 0;
+    _bottomLabel.parsed = parsed;
+    _bottomLabel.valid = true;
   }
 }

 <at>  <at>  -1710,7 +1687,15  <at>  <at> 

   if (_bottomLabel.valid) {
     painter->save();
-    painter->drawPixmap(_bottomLabel.rect.topLeft(), _bottomLabel.pixmap, QRectF(0, 0,
_bottomLabel.location, _bottomLabel.rect.height()));
+    QRectF bottomLabel = bottomLabelRect();
+    bottomLabel.moveTopLeft(QPointF(plotRect().center().x(), plotAxisRect().bottomLeft().y()));
+
+    Label::RenderContext rc(bottomLabelDetails()->calculatedFont(), painter);
+    QFontMetrics fm(bottomLabelDetails()->calculatedFont());
+    rc.y = fm.ascent();
+    // Needs to be adjusted to be centered.  Must add way to get rc.x before painting.
+    painter->translate(QPointF(bottomLabel.x(), bottomLabel.y()));
+    Label::renderLabel(rc, _bottomLabel.parsed->chunk);
     painter->restore();
   }

 <at>  <at>  -1763,28 +1748,11  <at>  <at> 
   if (parsed && rightLabel.isValid()) {
     parsed->chunk->attributes.color = _rightLabelDetails->fontColor();

-    QPixmap pixmap(rightLabel.height(), rightLabel.width());
-    pixmap.fill(Qt::transparent);
-    QPainter pixmapPainter(&pixmap);
-
-    Label::RenderContext rc(rightLabelDetails()->calculatedFont(), &pixmapPainter);
-    QFontMetrics fm(rightLabelDetails()->calculatedFont());
-    rc.y = fm.ascent();
-    Label::renderLabel(rc, parsed->chunk);
-
-    rightLabel.moveTopLeft(QPointF(plotAxisRect().right(), plotRect().center().y() - rc.x / 2));
-
-    QTransform t;
-    t.rotate(90.0);
-    _rightLabel.pixmap = pixmap.transformed(t);
-    _rightLabel.rect = rightLabel;
-    _rightLabel.location = rc.x;
-    if (rc.x > 0) {
-      _rightLabel.valid = true;
+    if (_rightLabel.parsed) {
+      delete _rightLabel.parsed;
     }
-
-    delete parsed;
-    parsed = 0;
+    _rightLabel.parsed = parsed;
+    _rightLabel.valid = true;
   }
 }

 <at>  <at>  -1797,7 +1765,17  <at>  <at> 

   if (_rightLabel.valid) {
     painter->save();
-    painter->drawPixmap(_rightLabel.rect.topLeft(), _rightLabel.pixmap, QRectF(0, 0,
_rightLabel.location, _rightLabel.rect.height()));
+    QRectF rightLabel = rightLabelRect();
+    rightLabel.moveTopLeft(plotAxisRect().topRight());
+    rightLabel.moveBottomRight(QPointF(rightLabel.bottomRight().x(), plotRect().center().y()));
+
+    Label::RenderContext rc(rightLabelDetails()->calculatedFont(), painter);
+    QFontMetrics fm(rightLabelDetails()->calculatedFont());
+    rc.y = fm.ascent();
+    // Needs to be adjusted to be centered.  Must add way to get rc.x before painting.
+    painter->translate(QPointF(rightLabel.x() + rightLabel.width(), -(rightLabel.y())));
+    painter->rotate(90.0);
+    Label::renderLabel(rc, _rightLabel.parsed->chunk);
     painter->restore();
   }

 <at>  <at>  -1856,26 +1834,11  <at>  <at> 
   if (parsed && topLabel.isValid()) {
     parsed->chunk->attributes.color = _topLabelDetails->fontColor();

-    QPixmap pixmap(topLabel.width(), topLabel.height());
-    pixmap.fill(Qt::transparent);
-    QPainter pixmapPainter(&pixmap);
-
-    Label::RenderContext rc(topLabelDetails()->calculatedFont(), &pixmapPainter);
-    QFontMetrics fm(topLabelDetails()->calculatedFont());
-    rc.y = fm.ascent();
-    Label::renderLabel(rc, parsed->chunk);
-
-    topLabel.moveBottomLeft(QPointF(plotRect().center().x()-rc.x/2, plotAxisRect().topLeft().y()));
-
-    _topLabel.pixmap = pixmap;
-    _topLabel.rect = topLabel;
-    _topLabel.location = rc.x;
-    if (rc.x > 0) {
-      _topLabel.valid = true;
+    if (_topLabel.parsed) {
+      delete _topLabel.parsed;
     }
-
-    delete parsed;
-    parsed = 0;
+    _topLabel.parsed = parsed;
+    _topLabel.valid = true;
   }
 }

 <at>  <at>  -1888,7 +1851,15  <at>  <at> 

   if (_topLabel.valid) {
     painter->save();
-    painter->drawPixmap(_topLabel.rect.topLeft(), _topLabel.pixmap, QRectF(0, 0,
_topLabel.location, _topLabel.rect.height()));
+    QRectF topLabel = topLabelRect();
+    topLabel.moveBottomLeft(QPointF(plotRect().center().x(), plotAxisRect().topLeft().y()));
+
+    Label::RenderContext rc(topLabelDetails()->calculatedFont(), painter);
+    QFontMetrics fm(topLabelDetails()->calculatedFont());
+    rc.y = fm.ascent();
+    // Needs to be adjusted to be centered.  Must add way to get rc.x before painting.
+    painter->translate(QPointF(topLabel.x(), topLabel.y()));
+    Label::renderLabel(rc, _topLabel.parsed->chunk);
     painter->restore();
   }

--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #953794:953795
 <at>  <at>  -47,12 +47,12  <at>  <at> 
 };

 
-struct DrawnLabel {
-  DrawnLabel() { valid = false; dirty = true; };
+struct CachedLabel {
+  CachedLabel() { valid = false; dirty = true; parsed = 0; };

   bool valid;
   bool dirty;
-  QPixmap pixmap;
+  Label::Parsed *parsed;
   QRectF rect;
   int location;
 };
 <at>  <at>  -441,10 +441,10  <at>  <at> 
     SharedAxisBoxItem * _sharedBox;

     bool _axisLabelsDirty;
-    DrawnLabel _leftLabel;
-    DrawnLabel _rightLabel;
-    DrawnLabel _topLabel;
-    DrawnLabel _bottomLabel;
+    CachedLabel _leftLabel;
+    CachedLabel _rightLabel;
+    CachedLabel _topLabel;
+    CachedLabel _bottomLabel;

     QVector<QLineF> _xMajorGridLines;
     QVector<QLineF> _yMajorGridLines;

Andrew Walker | 14 Apr 2009 20:15

[Bug 184580] kst crashing running script to make power spectra

https://bugs.kde.org/show_bug.cgi?id=184580

Andrew Walker <arwalker <at> sumusltd.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEEDSINFO
                 CC|                            |arwalker <at> sumusltd.com
         Resolution|                            |LATER

--- Comment #2 from Andrew Walker <arwalker sumusltd com>  2009-04-14 20:15:49 ---
Will investigate further once more information is available.

--

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Gmane