chart2/source/view/charttypes/BarChart.cxx | 19 +++++++++++++++++++ include/svx/scene3d.hxx | 5 +++++ svx/source/engine3d/scene3d.cxx | 17 +++++++++++++++-- 3 files changed, 39 insertions(+), 2 deletions(-)
New commits: commit 55a7e836a2db662a53adc4f8b98d08b06790c758 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Wed Dec 13 22:08:20 2017 +0900 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/46446 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 41002429d900..34c28deb9057 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -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 { diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index 81703f1d001f..2f76cec02a13 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -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 diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index bec310a686a9..1da5c1411150 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -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 )
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits