sd/qa/unit/tiledrendering/LOKitSearchTest.cxx |    4 ++--
 vcl/source/window/paint.cxx                   |   21 ++++++++++++++++++---
 2 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit c7451989984cc96e8d195dbe026d803bc462c1f5
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Thu Jul 22 22:07:42 2021 +0200
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Sep 8 10:33:56 2021 +0200

    avoid painting to windows in LOK mode
    
    There are no actual toplevel windows in that case, and tiled rendering
    is used to paint whenever any painting is needed. The painting is
    already made useless by using (1,1)-sized Cairo surfaces for windows
    (SvpSalFrame::SetPosSize() calling SvpSalFrame::GetSurfaceFrameSize()),
    this should avoid it altogether.
    
    It is possible this commit causes regressions if some code relies
    on Paint() getting called at specific times (such as 2f961c7a811bdff66
    doing relayout there, causing geometry changes), but those should be
    fixed.
    
    Change-Id: Ie4be16301fdddb7c1b0350e6458178efca88aa4d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119270
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx 
b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
index beba53b67078..4bb6ca2d9a5f 100644
--- a/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
+++ b/sd/qa/unit/tiledrendering/LOKitSearchTest.cxx
@@ -244,8 +244,8 @@ void LOKitSearchTest::testSearchAllSelections()
     lcl_search("third", /*bFindAll=*/true);
     // Make sure this is found on the 3rd slide.
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), 
mpCallbackRecorder->m_nPart);
-
-    CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(1), 
mpCallbackRecorder->m_aSelection.size());
+    // This was 1: only the first match was highlighted.
+    CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(2), 
mpCallbackRecorder->m_aSelection.size());
 }
 
 void LOKitSearchTest::testSearchAllNotifications()
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 95640db261bb..02c15254ad0a 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -645,6 +645,12 @@ void Window::ImplCallOverlapPaint()
 
 IMPL_LINK_NOARG(Window, ImplHandlePaintHdl, Timer *, void)
 {
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // Tiled rendering is used, idle paint does not need to do anything.
+        mpWindowImpl->mpFrameData->maPaintIdle.Stop();
+        return;
+    }
 #ifndef IOS
     comphelper::ProfileZone aZone("VCL idle re-paint");
 
@@ -664,9 +670,6 @@ IMPL_LINK_NOARG(Window, ImplHandlePaintHdl, Timer *, void)
     else if ( mpWindowImpl->mbReallyVisible )
     {
         ImplCallOverlapPaint();
-        if (comphelper::LibreOfficeKit::isActive() &&
-            mpWindowImpl->mpFrameData->maPaintIdle.IsActive())
-            mpWindowImpl->mpFrameData->maPaintIdle.Stop();
     }
 #endif
 }
@@ -688,6 +691,12 @@ IMPL_LINK_NOARG(Window, ImplHandleResizeTimerHdl, Timer *, 
void)
 
 void Window::ImplInvalidateFrameRegion( const vcl::Region* pRegion, 
InvalidateFlags nFlags )
 {
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // Tiled rendering is used, so there's no need to invalidate for idle 
painting.
+        return;
+    }
+
     // set PAINTCHILDREN for all parent windows till the first OverlapWindow
     if ( !ImplIsOverlapWindow() )
     {
@@ -1293,6 +1302,12 @@ void Window::PaintImmediately()
     if (!mpWindowImpl)
         return;
 
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        // Tiled rendering is used, direct paint does not need to do anything.
+        return;
+    }
+
     if ( mpWindowImpl->mpBorderWindow )
     {
         mpWindowImpl->mpBorderWindow->PaintImmediately();

Reply via email to