Kaydet (Commit) 9ece5c87 authored tarafından Miklos Vajna's avatar Miklos Vajna

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
üst 162ae47a
...@@ -191,24 +191,28 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang ...@@ -191,24 +191,28 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const Rectang
void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle) void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle)
{ {
OString sRectangle; Rectangle aRectangle;
if (!pRectangle) if (!pRectangle)
sRectangle = "EMPTY";
else
{ {
// Convert from relative twips to absolute ones. Push(PushFlags::MAPMODE);
Rectangle aRectangle(*pRectangle); EnableMapMode();
vcl::Window& rParent = mrSidebarWin.EditWin(); aRectangle = Rectangle(Point(0, 0), PixelToLogic(GetSizePixel()));
Point aOffset(GetOutOffXPixel() - rParent.GetOutOffXPixel(), GetOutOffYPixel() - rParent.GetOutOffYPixel()); Pop();
rParent.Push(PushFlags::MAPMODE);
rParent.EnableMapMode();
aOffset = rParent.PixelToLogic(aOffset);
rParent.Pop();
aRectangle.Move(aOffset.getX(), aOffset.getY());
sRectangle = aRectangle.toString();
} }
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(); SwWrtShell& rWrtShell = mrDocView.GetWrtShell();
rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment