[Libreoffice-commits] core.git: 2 commits - editeng/source sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Nov 19 07:41:54 PST 2015
editeng/source/editeng/impedit.cxx | 6 ++++
sw/source/uibase/docvw/SidebarTxtControl.cxx | 34 +++++++++++++++------------
2 files changed, 25 insertions(+), 15 deletions(-)
New commits:
commit 9ece5c870a0ce39690109777bb8f76c1463a10c2
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Nov 19 16:11:43 2015 +0100
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
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 31ac8d0..d8ff85a 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());
}
commit 162ae47a046b0c501e09d611a9834e875db884b8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Nov 19 15:09:05 2015 +0100
editeng lok: invalidate on scroll
E.g. when a Witer comment has long enough contents to get scrolled, the
desktop case repaints its contents by vcl::Window::Scroll(), followed by
a vcl::Window::Update(), i.e. vcl::Window::Invalidate() is not called.
The result of this in case of tiled rendering is that no tile is
repainted, so call vcl::Window::Invalidate() after scrolling manually.
A generic VCL-level invalidate-after-scroll is not wanted, as the
scrolling of the document contents and the main document window is not
in sync when tiled rendering.
Change-Id: I74296a0f0e52c92cf3db6aefa73f28bb2b202871
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index df875ed..850abc4 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -47,6 +47,7 @@
#include <sot/formats.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/string.hxx>
+#include <comphelper/lok.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -1084,6 +1085,11 @@ Pair ImpEditView::Scroll( long ndX, long ndY, ScrollRangeCheck nRangeCheck )
aVisDocStartPos = pOutWin->PixelToLogic( aVisDocStartPos );
Rectangle aRect( aOutArea );
pOutWin->Scroll( nRealDiffX, nRealDiffY, aRect, ScrollFlags::Clip );
+
+ if (comphelper::LibreOfficeKit::isActive())
+ // Need to invalidate the window, otherwise no tile will be re-painted.
+ pOutWin->Invalidate();
+
pOutWin->Update();
pCrsr->SetPos( pCrsr->GetPos() + Point( nRealDiffX, nRealDiffY ) );
if ( bVisCursor )
More information about the Libreoffice-commits
mailing list