[Libreoffice-commits] core.git: sfx2/source
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jan 6 18:18:03 UTC 2020
sfx2/source/sidebar/Deck.cxx | 1 +
sfx2/source/sidebar/DeckLayouter.cxx | 35 +++++++++++++++++++++++++++++++----
2 files changed, 32 insertions(+), 4 deletions(-)
New commits:
commit 182f0e95dbbdc64f7340b0fbb7af7720536a1140
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat Jan 4 22:37:31 2020 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Jan 6 19:17:33 2020 +0100
sidebar: improve invalidation tracking for Panels.
Only emit an invalidation on panels that change position.
Ensure we invalidate the ScrollContainerWindow for updated separators.
Emit a single vcl::Region for an invalidation rather than per panel.
Change-Id: I5452791ac9a7d1a9b8604c7704d24641160c275b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86234
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86288
Tested-by: Jenkins
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 26723738b7ee..a015b0db2bd6 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -394,6 +394,7 @@ void Deck::ScrollContainerWindow::Paint(vcl::RenderContext& rRenderContext, cons
void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& rSeparators)
{
maSeparators = rSeparators;
+ Invalidate();
}
} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/DeckLayouter.cxx b/sfx2/source/sidebar/DeckLayouter.cxx
index c83ced15b334..bc1bf6e93986 100644
--- a/sfx2/source/sidebar/DeckLayouter.cxx
+++ b/sfx2/source/sidebar/DeckLayouter.cxx
@@ -86,6 +86,8 @@ namespace {
const sal_Int32 nHeightToDistribute,
const sal_Int32 nContainerHeight,
const bool bMinimumHeightIsBase);
+ bool MoveResizePixel(const VclPtr<vcl::Window> &pWindow,
+ const Point &rNewPos, const Size &rNewSize);
sal_Int32 PlacePanels (
::std::vector<LayoutItem>& rLayoutItems,
const sal_Int32 nWidth,
@@ -254,6 +256,17 @@ tools::Rectangle LayoutPanels (
return aBox;
}
+bool MoveResizePixel(const VclPtr<vcl::Window> &pWindow,
+ const Point &rNewPos, const Size &rNewSize)
+{
+ Point aCurPos = pWindow->GetPosPixel();
+ Size aCurSize = pWindow->GetSizePixel();
+ if (rNewPos == aCurPos && aCurSize == rNewSize)
+ return false;
+ pWindow->setPosSizePixel(rNewPos.X(), rNewPos.Y(), rNewSize.Width(), rNewSize.Height());
+ return true;
+}
+
sal_Int32 PlacePanels (
::std::vector<LayoutItem>& rLayoutItems,
const sal_Int32 nWidth,
@@ -264,6 +277,8 @@ sal_Int32 PlacePanels (
const sal_Int32 nDeckSeparatorHeight (Theme::GetInteger(Theme::Int_DeckSeparatorHeight));
sal_Int32 nY (0);
+ vcl::Region aInvalidRegions;
+
// Assign heights and places.
for(::std::vector<LayoutItem>::const_iterator iItem(rLayoutItems.begin()),
iEnd(rLayoutItems.end());
@@ -276,8 +291,11 @@ sal_Int32 PlacePanels (
Panel& rPanel (*iItem->mpPanel);
// Separator above the panel title bar.
- aSeparators.push_back(nY);
- nY += nDeckSeparatorHeight;
+ if (!rPanel.IsLurking())
+ {
+ aSeparators.push_back(nY);
+ nY += nDeckSeparatorHeight;
+ }
// Place the title bar.
VclPtr<PanelTitleBar> pTitleBar = rPanel.GetTitleBar();
@@ -321,8 +339,15 @@ sal_Int32 PlacePanels (
}
// Place the panel.
- rPanel.setPosSizePixel(0, nY, nWidth, nPanelHeight);
- rPanel.Invalidate();
+ Point aNewPos(0, nY);
+ Size aNewSize(nWidth, nPanelHeight);
+
+ // Only invalidate if we moved
+ if (MoveResizePixel(&rPanel, aNewPos, aNewSize))
+ {
+ tools::Rectangle aRect(aNewPos, aNewSize);
+ aInvalidRegions.Union(rPanel.PixelToLogic(aRect));
+ }
nY += nPanelHeight;
}
@@ -346,6 +371,8 @@ sal_Int32 PlacePanels (
if (pScrollContainerWindow != nullptr)
pScrollContainerWindow->SetSeparators(aSeparators);
+ rScrollContainer.Invalidate(aInvalidRegions);
+
return nY;
}
More information about the Libreoffice-commits
mailing list