summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-18 09:31:17 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-30 20:59:57 +0100
commit0690f0cc3683dbe47ae237b3a00d02ba4db6966c (patch)
treeb9cfcb714420ede5195d28d48b3d75ccaac45b05 /svx
parent5f6542e77a3ae8313199ca6704ef050be336a2f0 (diff)
cool#7769 Reduce unnecessary invalidations on calc save
https://github.com/CollaboraOnline/online/issues/7769 Reduce unnecessary invalidations. Don't invalidate windows if layer visibility didn't really change. Change-Id: Ic2abd78d60aea2e8676c8e56608cf51e941f5918 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162301 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdpagv.cxx17
-rw-r--r--svx/source/svdraw/svdpntv.cxx15
2 files changed, 16 insertions, 16 deletions
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 86210865e72c..4e5d7a47286c 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -557,15 +557,22 @@ void SdrPageView::AdjHdl()
GetView().AdjustMarkHdl();
}
-void SdrPageView::SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa)
+// return true if changed, false if unchanged
+bool SdrPageView::SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa)
{
- if(!GetPage())
- return;
+ if (!GetPage())
+ return false;
SdrLayerID nID = GetPage()->GetLayerAdmin().GetLayerID(rName);
- if(SDRLAYER_NOTFOUND != nID)
- rBS.Set(nID, bJa);
+ if (SDRLAYER_NOTFOUND == nID)
+ return false;
+
+ if (rBS.IsSet(nID) == bJa)
+ return false;
+
+ rBS.Set(nID, bJa);
+ return true;
}
bool SdrPageView::IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 4584e7f83174..f0928872509a 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -414,22 +414,15 @@ void SdrPaintView::DeleteDeviceFromPaintView(OutputDevice& rOldDev)
void SdrPaintView::SetLayerVisible(const OUString& rName, bool bShow)
{
- if(mpPageView)
- {
- mpPageView->SetLayerVisible(rName, bShow);
- }
-
+ const bool bChanged = mpPageView && mpPageView->SetLayerVisible(rName, bShow);
+ if (!bChanged)
+ return;
InvalidateAllWin();
}
bool SdrPaintView::IsLayerVisible(const OUString& rName) const
{
- if(mpPageView)
- {
- return mpPageView->IsLayerVisible(rName);
- }
-
- return false;
+ return mpPageView && mpPageView->IsLayerVisible(rName);
}
void SdrPaintView::SetLayerLocked(const OUString& rName, bool bLock)