mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Speed up the grid: don't repaint when uneeded.
Added a flag to only recalculate the axis when needed. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
addec6b69f
commit
4c9dd0e698
2 changed files with 10 additions and 2 deletions
|
@ -34,6 +34,7 @@ double DiveCartesianAxis::tickSize() const
|
|||
void DiveCartesianAxis::setFontLabelScale(qreal scale)
|
||||
{
|
||||
labelScale = scale;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void DiveCartesianAxis::setMaximum(double maximum)
|
||||
|
@ -41,6 +42,7 @@ void DiveCartesianAxis::setMaximum(double maximum)
|
|||
if (IS_FP_SAME(max, maximum))
|
||||
return;
|
||||
max = maximum;
|
||||
changed = true;
|
||||
emit maxChanged();
|
||||
}
|
||||
|
||||
|
@ -49,6 +51,7 @@ void DiveCartesianAxis::setMinimum(double minimum)
|
|||
if (IS_FP_SAME(min, minimum))
|
||||
return;
|
||||
min = minimum;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void DiveCartesianAxis::setTextColor(const QColor &color)
|
||||
|
@ -67,7 +70,8 @@ DiveCartesianAxis::DiveCartesianAxis() : QObject(),
|
|||
textVisibility(true),
|
||||
lineVisibility(true),
|
||||
labelScale(1.0),
|
||||
line_size(1)
|
||||
line_size(1),
|
||||
changed(true)
|
||||
{
|
||||
setPen(gridPen());
|
||||
}
|
||||
|
@ -79,11 +83,13 @@ DiveCartesianAxis::~DiveCartesianAxis()
|
|||
void DiveCartesianAxis::setLineSize(qreal lineSize)
|
||||
{
|
||||
line_size = lineSize;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
void DiveCartesianAxis::setOrientation(Orientation o)
|
||||
{
|
||||
orientation = o;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
QColor DiveCartesianAxis::colorForValue(double value)
|
||||
|
@ -126,7 +132,7 @@ void emptyList(QList<T *> &list, double steps)
|
|||
|
||||
void DiveCartesianAxis::updateTicks(color_indice_t color)
|
||||
{
|
||||
if (!scene())
|
||||
if (!scene() || !changed)
|
||||
return;
|
||||
QLineF m = line();
|
||||
// unused so far:
|
||||
|
@ -241,6 +247,7 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
|
|||
item->setVisible(textVisibility);
|
||||
Q_FOREACH (DiveLineItem *item, lines)
|
||||
item->setVisible(lineVisibility);
|
||||
changed = false;
|
||||
}
|
||||
|
||||
void DiveCartesianAxis::animateChangeLine(const QLineF &newLine)
|
||||
|
|
|
@ -69,6 +69,7 @@ protected:
|
|||
bool lineVisibility;
|
||||
double labelScale;
|
||||
qreal line_size;
|
||||
bool changed;
|
||||
};
|
||||
|
||||
class DepthAxis : public DiveCartesianAxis {
|
||||
|
|
Loading…
Add table
Reference in a new issue