Blame SOURCES/0348-sw-lok-comments-optimize-sidebar-text-control-invali.patch

135360
From eea254dd5eb834b846ff9c55662d5704c266f438 Mon Sep 17 00:00:00 2001
135360
From: Miklos Vajna <vmiklos@collabora.co.uk>
135360
Date: Thu, 19 Nov 2015 16:11:43 +0100
135360
Subject: [PATCH 348/398] sw lok comments: optimize sidebar text control
135360
 invalidation
135360
135360
Instead of invalidating the whole area, invalidate the sub-widget when
135360
the whole area of the sub-widget would be invalidated.
135360
135360
With this, a test comment with enough comment to have a scrollbar
135360
results in 3 paintTile() calls instead of 11 ones (70% save).
135360
135360
(cherry picked from commit 9ece5c870a0ce39690109777bb8f76c1463a10c2)
135360
135360
Change-Id: I2fe317549eefac9a63aaf50f5a9a242e15c4dc86
135360
---
135360
 sw/source/uibase/docvw/SidebarTxtControl.cxx | 34 ++++++++++++++++------------
135360
 1 file changed, 19 insertions(+), 15 deletions(-)
135360
135360
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
index d6887a475312..4558c4071bfd 100644
135360
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
135360
@@ -190,24 +190,28 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang
135360
 
135360
 void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle)
135360
 {
135360
-    OString sRectangle;
135360
+    Rectangle aRectangle;
135360
+
135360
     if (!pRectangle)
135360
-        sRectangle = "EMPTY";
135360
-    else
135360
     {
135360
-        // Convert from relative twips to absolute ones.
135360
-        Rectangle aRectangle(*pRectangle);
135360
-        vcl::Window& rParent = *mrSidebarWin.EditWin();
135360
-        Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
135360
-        rParent.Push(PushFlags::MAPMODE);
135360
-        rParent.EnableMapMode();
135360
-        aOffset = rParent.PixelToLogic(aOffset);
135360
-        rParent.Pop();
135360
-        aRectangle.Move(aOffset.getX(), aOffset.getY());
135360
-
135360
-        sRectangle = aRectangle.toString();
135360
+        Push(PushFlags::MAPMODE);
135360
+        EnableMapMode();
135360
+        aRectangle = Rectangle(Point(0, 0), PixelToLogic(GetSizePixel()));
135360
+        Pop();
135360
     }
135360
-
135360
+    else
135360
+        aRectangle = *pRectangle;
135360
+
135360
+    // Convert from relative twips to absolute ones.
135360
+    vcl::Window& rParent = *mrSidebarWin.EditWin();
135360
+    Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel());
135360
+    rParent.Push(PushFlags::MAPMODE);
135360
+    rParent.EnableMapMode();
135360
+    aOffset = rParent.PixelToLogic(aOffset);
135360
+    rParent.Pop();
135360
+    aRectangle.Move(aOffset.getX(), aOffset.getY());
135360
+
135360
+    OString sRectangle = aRectangle.toString();
135360
     SwWrtShell& rWrtShell = mrDocView.GetWrtShell();
135360
     rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
135360
 }
135360
-- 
135360
2.12.0
135360