[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Jan 24 23:58:51 UTC 2012
SVN commit 1275749 by netterfield:
Make antialiasing optional: there are serios performance issues with
antialiasing on some systems.
M +0 -13 libkst/datasource.cpp
M +13 -0 libkstapp/applicationsettings.cpp
M +4 -0 libkstapp/applicationsettings.h
M +2 -0 libkstapp/applicationsettingsdialog.cpp
M +2 -0 libkstapp/cartesianrenderitem.cpp
M +8 -0 libkstapp/generaltab.cpp
M +3 -0 libkstapp/generaltab.h
M +33 -26 libkstapp/generaltab.ui
M +8 -8 libkstapp/plotitem.cpp
M +3 -2 libkstapp/plotrenderitem.cpp
M +1 -1 libkstmath/curve.cpp
M +2 -1 libkstmath/relation.h
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #1275748:1275749
@@ -31,7 +31,6 @@
#include <QXmlStreamWriter>
#include <QTimer>
#include <QFileSystemWatcher>
-#include <QFSFileEngine>
#include "kst_i18n.h"
#include "datacollection.h"
@@ -254,9 +253,6 @@
}
-
-
-
QString DataSource::fileName() const {
// Look to see if it was a URL and save the URL instead
const QMap<QString,QString> urlMap = DataSourcePluginManager::urlMap();
@@ -269,15 +265,6 @@
}
-
-
-
-
-
-
-
-
-
QString DataSource::fileType() const {
return QString();
}
--- branches/work/kst/portto4/kst/src/libkstapp/applicationsettings.cpp #1275748:1275749
@@ -57,6 +57,7 @@
_snapToGrid = _settings->value("grid/snaptogrid", QVariant(false)).toBool();
_gridHorSpacing = _settings->value("grid/horizontalspacing", 20.0).toDouble();
_gridVerSpacing = _settings->value("grid/verticalspacing", 20.0).toDouble();
+ _antialiasPlots = _settings->value("general/antialiasplots", QVariant(true)).toBool();
Qt::BrushStyle style = (Qt::BrushStyle)_settings->value("fill/style", "0").toInt();
if (style < Qt::LinearGradientPattern) {
@@ -191,6 +192,18 @@
}
+bool ApplicationSettings::antialiasPlots() const {
+ return _antialiasPlots;
+}
+
+
+void ApplicationSettings::setAntialiasPlots(bool antialias) {
+ _antialiasPlots = antialias;
+ _settings->setValue("general/antialiasplots", antialias);
+ emit modified();
+}
+
+
bool ApplicationSettings::snapToGrid() const {
return _snapToGrid;
}
--- branches/work/kst/portto4/kst/src/libkstapp/applicationsettings.h #1275748:1275749
@@ -70,6 +70,9 @@
QSizeF layoutSpacing() const;
void setLayoutSpacing(QSizeF spacing);
+ bool antialiasPlots() const;
+ void setAntialiasPlots(bool antialias);
+
Q_SIGNALS:
void modified();
@@ -94,6 +97,7 @@
QGradientStops _gradientStops;
QSizeF _layoutMargins;
QSizeF _layoutSpacing;
+ bool _antialiasPlots;
friend class ApplicationSettingsDialog;
};
--- branches/work/kst/portto4/kst/src/libkstapp/applicationsettingsdialog.cpp #1275748:1275749
@@ -76,6 +76,7 @@
_generalTab->setUseOpenGL(ApplicationSettings::self()->useOpenGL());
_generalTab->setTransparentDrag(ApplicationSettings::self()->transparentDrag());
_generalTab->setMinimumUpdatePeriod(ApplicationSettings::self()->minimumUpdatePeriod());
+ _generalTab->setAntialiasPlot(ApplicationSettings::self()->antialiasPlots());
}
@@ -108,6 +109,7 @@
ApplicationSettings::self()->setTransparentDrag(_generalTab->transparentDrag());
ApplicationSettings::self()->setUseOpenGL(_generalTab->useOpenGL());
ApplicationSettings::self()->setMinimumUpdatePeriod(_generalTab->minimumUpdatePeriod());
+ ApplicationSettings::self()->setAntialiasPlots(_generalTab->antialiasPlot());
ApplicationSettings::self()->blockSignals(false);
emit ApplicationSettings::self()->modified();
--- branches/work/kst/portto4/kst/src/libkstapp/cartesianrenderitem.cpp #1275748:1275749
@@ -17,6 +17,7 @@
#include "math_kst.h"
#include "plotitem.h"
+#include "applicationsettings.h"
namespace Kst {
@@ -80,6 +81,7 @@
context.m_Y = m_Y;
context.b_X = b_X;
context.b_Y = b_Y;
+ context.antialias = ApplicationSettings::self()->antialiasPlots();
relation->paint(context);
}
--- branches/work/kst/portto4/kst/src/libkstapp/generaltab.cpp #1275748:1275749
@@ -46,6 +46,14 @@
_transparentDrag->setChecked(transparent_drag);
}
+bool GeneralTab::antialiasPlot() const {
+ return _antialiasPlots->isChecked();
+}
+
+void GeneralTab::setAntialiasPlot(bool antialias) {
+ _antialiasPlots->setChecked(antialias);
+}
+
int GeneralTab::minimumUpdatePeriod() const {
return _maxUpdate->value();
}
--- branches/work/kst/portto4/kst/src/libkstapp/generaltab.h #1275748:1275749
@@ -32,6 +32,9 @@
bool transparentDrag() const;
void setTransparentDrag(const bool transparent_drag);
+ bool antialiasPlot() const;
+ void setAntialiasPlot(bool antialias);
+
int minimumUpdatePeriod() const;
void setMinimumUpdatePeriod(const int Period);
--- branches/work/kst/portto4/kst/src/libkstapp/generaltab.ui #1275748:1275749
@@ -14,20 +14,7 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
- <item row="2" column="0">
- <widget class="QLabel" name="label_5">
- <property name="text">
- <string>&Period between updates (ms):</string>
- </property>
- <property name="alignment">
- <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
- </property>
- <property name="buddy">
- <cstring>_maxUpdate</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2">
+ <item row="3" column="1" colspan="2">
<widget class="QSpinBox" name="_maxUpdate">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -56,18 +43,25 @@
</widget>
</item>
<item row="3" column="0">
- <spacer>
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>&Period between updates (ms):</string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>44</width>
- <height>16</height>
- </size>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
- </spacer>
+ <property name="buddy">
+ <cstring>_maxUpdate</cstring>
+ </property>
+ </widget>
</item>
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="_transparentDrag">
+ <property name="text">
+ <string>Use transparency when dragging</string>
+ </property>
+ </widget>
+ </item>
<item row="0" column="1">
<widget class="QCheckBox" name="_useOpenGL">
<property name="toolTip">
@@ -81,10 +75,23 @@
</property>
</widget>
</item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="_transparentDrag">
+ <item row="4" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>44</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="_antialiasPlots">
<property name="text">
- <string>Use transparency when dragging</string>
+ <string>&Antialias Plots</string>
</property>
</widget>
</item>
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1275748:1275749
@@ -871,7 +871,7 @@
pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);
- //pixmapPainter.setRenderHint(QPainter::Antialiasing);
+ //pixmapPainter.setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
pixmapPainter.save();
if (rect().topLeft() != QPointF(0, 0)) {
@@ -1267,7 +1267,7 @@
if (xAxis()->drawAxisMajorGridLines()) {
painter->save();
painter->setPen(QPen(QBrush(_xAxis->axisMajorGridLineColor()), _xAxis->axisMajorGridLineWidth(), _xAxis->axisMajorGridLineStyle()));
- painter->setRenderHint(QPainter::Antialiasing);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
painter->drawLines(_xMajorGridLines);
painter->restore();
}
@@ -1275,7 +1275,7 @@
if (yAxis()->drawAxisMajorGridLines()) {
painter->save();
painter->setPen(QPen(QBrush(_yAxis->axisMajorGridLineColor()), _yAxis->axisMajorGridLineWidth(), _yAxis->axisMajorGridLineStyle()));
- painter->setRenderHint(QPainter::Antialiasing);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
painter->drawLines(_yMajorGridLines);
painter->restore();
}
@@ -1286,7 +1286,7 @@
if (xAxis()->drawAxisMinorGridLines()) {
painter->save();
painter->setPen(QPen(QBrush(_xAxis->axisMinorGridLineColor()), _xAxis->axisMinorGridLineWidth(), _xAxis->axisMinorGridLineStyle()));
- painter->setRenderHint(QPainter::Antialiasing);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
painter->drawLines(_xMinorGridLines);
painter->restore();
}
@@ -1294,7 +1294,7 @@
if (yAxis()->drawAxisMinorGridLines()) {
painter->save();
painter->setPen(QPen(QBrush(_yAxis->axisMinorGridLineColor()), _yAxis->axisMinorGridLineWidth(), _yAxis->axisMinorGridLineStyle()));
- painter->setRenderHint(QPainter::Antialiasing);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
painter->drawLines(_yMinorGridLines);
painter->restore();
}
@@ -1303,7 +1303,7 @@
void PlotItem::paintMajorTicks(QPainter *painter) {
painter->save();
- painter->setRenderHint(QPainter::Antialiasing);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
if (xAxis()->drawAxisMajorTicks()) {
painter->drawLines(_xMajorTickLines);
}
@@ -1317,7 +1317,7 @@
void PlotItem::paintMinorTicks(QPainter *painter) {
painter->save();
- painter->setRenderHint(QPainter::Antialiasing);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
if (xAxis()->drawAxisMinorTicks()) {
painter->drawLines(_xMinorTickLines);
}
@@ -4363,7 +4363,7 @@
item->setProjectionRect(QRectF(item->projectionRect().x(),
compute.y(),
item->projectionRect().width(),
- compute.height()));
+ compute.height()));
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1275748:1275749
@@ -20,6 +20,7 @@
#include "sharedaxisboxitem.h"
#include "image.h"
#include "debug.h"
+#include "applicationsettings.h"
#include <QTime>
#include <QMenu>
@@ -303,7 +304,7 @@
QPointF point = plotItem()->mapToPlot(_referencePoint);
painter->save();
painter->setPen(QPen(QColor("gray"), 1));
- painter->setRenderHint(QPainter::Antialiasing, true);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
CurvePointSymbol::draw(7, painter, point.x(), point.y(), 1);
painter->restore();
}
@@ -322,7 +323,7 @@
}
painter->setBrush(highlightColor);
- painter->setRenderHint(QPainter::Antialiasing, true);
+ painter->setRenderHint(QPainter::Antialiasing, ApplicationSettings::self()->antialiasPlots());
painter->drawEllipse(point, 3, 3);
painter->restore();
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1275748:1275749
@@ -669,7 +669,7 @@
QPainter *p = context.painter;
p->save();
- p->setRenderHint(QPainter::Antialiasing);
+ p->setRenderHint(QPainter::Antialiasing, context.antialias);
Qt::PenStyle style = Kst::LineStyle[lineStyle()];
if (hasBars()) {
--- branches/work/kst/portto4/kst/src/libkstmath/relation.h #1275748:1275749
@@ -43,7 +43,7 @@
x_max(0.0), y_max(0.0), x_min(0.0), y_min(0.0),
XMin(0.0), YMin(0.0), XMax(0.0), YMax(0.0),
xLog(false), yLog(false), xLogBase(0.0),
- yLogBase(0.0), penWidth(0)
+ yLogBase(0.0), penWidth(0), antialias(false)
{}
QPainter* painter;
@@ -57,6 +57,7 @@
QColor foregroundColor; // plot foreground color
QColor backgroundColor; // plot background color
int penWidth;
+ bool antialias;
};
struct CurveContextDetails {
More information about the Kst
mailing list