Kaydet (Commit) 55a7e836 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

chart2: When creating objects prevent setting object rects dirty

3D objects using a E3dScene are traversing all object in the tree
when setting rects dirty. When we are creating objects, setting
properties and adding them to the tree we trigger setting rects
dirty which slows down considerably - more are added objects,
bigger the slowdown gets. So the solution here is to temporary
disable setting object rects dirty during creation of objects.

Change-Id: Id068cda9cb798d49b75bf4228cf6460f7e98c033
Reviewed-on: https://gerrit.libreoffice.org/46446Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst e1697600
......@@ -26,6 +26,8 @@
#include <AxisIndexDefines.hxx>
#include <Clipping.hxx>
#include <DateHelper.hxx>
#include <svx/scene3d.hxx>
#include <svx/unoshape.hxx>
#include <com/sun/star/chart/DataLabelPlacement.hpp>
......@@ -404,6 +406,20 @@ void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis()
}
}
E3dScene* lcl_getE3dScene(uno::Reference<drawing::XShapes> const & xShapes)
{
E3dScene* pScene = nullptr;
SvxShape* pSvxShape = SvxShape::getImplementation(xShapes);
if (pSvxShape)
{
SdrObject* pObject = pSvxShape->GetSdrObject();
if (pObject && dynamic_cast<const E3dScene*>(pObject) != nullptr)
pScene = static_cast<E3dScene*>(pObject);
}
return pScene;
}
void BarChart::createShapes()
{
if( m_aZSlots.empty() ) //no series
......@@ -761,9 +777,12 @@ void BarChart::createShapes()
if( fTopHeight < 0 )
fTopHeight *= -1.0;
E3dScene* pScene = lcl_getE3dScene(xSeriesGroupShape_Shapes);
pScene->EnterObjectSetupMode();
xShape = createDataPoint3D_Bar(
xSeriesGroupShape_Shapes, aTransformedBottom, aSize, fTopHeight, nRotateZAngleHundredthDegree
, xDataPointProperties, nGeometry3D );
pScene->ExitObjectSetupMode();
}
else //m_nDimension!=3
{
......
......@@ -75,6 +75,8 @@ protected:
// Flag to determine if only selected objects should be drawn
bool bDrawOnlySelected : 1;
bool mbSkipSettingDirty : 1;
virtual void NewObjectInserted(const E3dObject* p3DObj) override;
virtual void StructureChanged() override;
......@@ -161,6 +163,9 @@ public:
virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
virtual bool BckCreate(SdrDragStat& rStat) override;
virtual void BrkCreate(SdrDragStat& rStat) override;
void EnterObjectSetupMode();
void ExitObjectSetupMode();
};
#endif // INCLUDED_SVX_SCENE3D_HXX
......
......@@ -174,7 +174,8 @@ E3dScene::E3dScene()
: E3dObject(),
aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()),
mp3DDepthRemapper(nullptr),
bDrawOnlySelected(false)
bDrawOnlySelected(false),
mbSkipSettingDirty(false)
{
// Set defaults
SetDefaultAttributes();
......@@ -345,7 +346,9 @@ void E3dScene::NewObjectInserted(const E3dObject* p3DObj)
void E3dScene::StructureChanged()
{
E3dObject::StructureChanged();
SetRectsDirty();
if (!GetScene()->mbSkipSettingDirty)
SetRectsDirty();
ImpCleanup3DDepthMapper();
}
......@@ -413,6 +416,16 @@ E3dScene* E3dScene::Clone() const
return CloneHelper< E3dScene >();
}
void E3dScene::EnterObjectSetupMode()
{
GetScene()->mbSkipSettingDirty = true;
}
void E3dScene::ExitObjectSetupMode()
{
GetScene()->mbSkipSettingDirty = false;
}
E3dScene& E3dScene::operator=(const E3dScene& rObj)
{
if( this == &rObj )
......
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