Commit 1093ae99 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit
Browse files

Avoid modifying vtkAxis unless things changed.

Plots may do extra work when axis' Mtime changes. Don't change its Mtime
unless absolutely needed.
parent a2fb41f0
259db7bb94d95d977ca713dac57b61d3
fd11c765b7040b74dcd81aebbb4a9b9f
......@@ -155,9 +155,12 @@ void vtkAxis::SetPosition(int position)
void vtkAxis::SetPoint1(const vtkVector2f &pos)
{
this->Position1 = pos;
this->Resized = true;
this->Modified();
if (this->Position1 != pos)
{
this->Position1 = pos;
this->Resized = true;
this->Modified();
}
}
void vtkAxis::SetPoint1(float x, float y)
......@@ -172,9 +175,12 @@ vtkVector2f vtkAxis::GetPosition1()
void vtkAxis::SetPoint2(const vtkVector2f &pos)
{
this->Position2 = pos;
this->Resized = true;
this->Modified();
if (this->Position2 != pos)
{
this->Position2 = pos;
this->Resized = true;
this->Modified();
}
}
void vtkAxis::SetPoint2(float x, float y)
......
......@@ -314,11 +314,8 @@ void vtkChartXY::Update()
if (this->AutoAxes)
{
for (int i = 0; i < 4; ++i)
{
this->ChartPrivate->axes[i]->SetVisible(false);
}
for (size_t i = 0; i < this->ChartPrivate->PlotCorners.size(); ++i)
vtkTuple<bool, 4> visibilities(false);
for (int i = 0; i < static_cast<int>(this->ChartPrivate->PlotCorners.size()); ++i)
{
int visible = 0;
for (unsigned int j = 0;
......@@ -332,18 +329,14 @@ void vtkChartXY::Update()
}
if (visible)
{
if (i < 3)
{
this->ChartPrivate->axes[i]->SetVisible(true);
this->ChartPrivate->axes[i+1]->SetVisible(true);
}
else
{
this->ChartPrivate->axes[0]->SetVisible(true);
this->ChartPrivate->axes[3]->SetVisible(true);
}
visibilities[i % 4] = true;
visibilities[(i+1) % 4] = true;
}
}
for (int i = 0; i < 4; ++i)
{
this->ChartPrivate->axes[i]->SetVisible(visibilities[i]);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment