summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-11-19 16:11:43 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-11-19 16:35:04 +0100
commit9ece5c870a0ce39690109777bb8f76c1463a10c2 (patch)
tree46637b44458e7aead379fe43a2b3c25d13ccad37 /sw/source/uibase
parent162ae47a046b0c501e09d611a9834e875db884b8 (diff)
sw lok comments: optimize sidebar text control invalidation
Instead of invalidating the whole area, invalidate the sub-widget when the whole area of the sub-widget would be invalidated. With this, a test comment with enough comment to have a scrollbar results in 3 paintTile() calls instead of 11 ones (70% save). Change-Id: I2fe317549eefac9a63aaf50f5a9a242e15c4dc86
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx34
1 files changed, 19 insertions, 15 deletions
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 31ac8d0ee51f..d8ff85a8385c 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -191,24 +191,28 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang
void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle)
{
- OString sRectangle;
+ Rectangle aRectangle;
+
if (!pRectangle)
- sRectangle = "EMPTY";
- else
{
- // Convert from relative twips to absolute ones.
- Rectangle aRectangle(*pRectangle);
- vcl::Window& rParent = mrSidebarWin.EditWin();
- Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
- rParent.Push(PushFlags::MAPMODE);
- rParent.EnableMapMode();
- aOffset = rParent.PixelToLogic(aOffset);
- rParent.Pop();
- aRectangle.Move(aOffset.getX(), aOffset.getY());
-
- sRectangle = aRectangle.toString();
+ Push(PushFlags::MAPMODE);
+ EnableMapMode();
+ aRectangle = Rectangle(Point(0, 0), PixelToLogic(GetSizePixel()));
+ Pop();
}
-
+ else
+ aRectangle = *pRectangle;
+
+ // Convert from relative twips to absolute ones.
+ vcl::Window& rParent = mrSidebarWin.EditWin();
+ Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
+ rParent.Push(PushFlags::MAPMODE);
+ rParent.EnableMapMode();
+ aOffset = rParent.PixelToLogic(aOffset);
+ rParent.Pop();
+ aRectangle.Move(aOffset.getX(), aOffset.getY());
+
+ OString sRectangle = aRectangle.toString();
SwWrtShell& rWrtShell = mrDocView.GetWrtShell();
rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
}