sc/qa/unit/tiledrendering/tiledrendering.cxx |   11 +++++++++--
 sc/source/ui/view/tabview5.cxx               |    8 +++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit 2939a0f4805c7f708a803d624c5ac42f78bcf791
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Fri Sep 27 19:49:55 2019 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Sat Sep 28 03:33:38 2019 +0200

    sc lok: Optimize invalidation triggered by ScTabView::TabChanged() method
    
    We don't need to invalidate all parts of the document. It's enough to
    invalidate only that sheet which we changed to.
    
    Reviewed-on: https://gerrit.libreoffice.org/79500
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>
    (cherry picked from commit 96bd7504165f89ec5485d00a487e54634af347ce)
    
    Change-Id: I2c3aeb226c83bef473b0b33444b625e93d111b01
    Reviewed-on: https://gerrit.libreoffice.org/79626
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>
    Tested-by: Tamás Zolnai <tamas.zol...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/79769
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 685b36659845..07c54e6f671f 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -450,6 +450,7 @@ public:
     bool m_bFullInvalidateTiles;
     bool m_bInvalidateTiles;
     std::vector<tools::Rectangle> m_aInvalidations;
+    std::vector<int> m_aInvalidationsParts;
     bool m_bViewLock;
     OString m_sCellFormula;
     boost::property_tree::ptree m_aCommentCallbackResult;
@@ -525,6 +526,8 @@ public:
                 aInvalidationRect.setWidth(aSeq[2].toInt32());
                 aInvalidationRect.setHeight(aSeq[3].toInt32());
                 m_aInvalidations.push_back(aInvalidationRect);
+                if (aSeq.getLength() == 5)
+                    m_aInvalidationsParts.push_back(aSeq[4].toInt32());
                 m_bInvalidateTiles = true;
             }
         }
@@ -1732,12 +1735,16 @@ void ScTiledRenderingTest::testSheetChangeInvalidation()
     SfxLokHelper::setView(nView1);
     aView1.m_bInvalidateTiles = false;
     aView1.m_aInvalidations.clear();
+    aView1.m_aInvalidationsParts.clear();
     pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | 
KEY_MOD1);
     pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | 
KEY_MOD1);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
-    CPPUNIT_ASSERT_EQUAL(size_t(3), aView1.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
     CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), 
aView1.m_aInvalidations[0]);
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), 
aView1.m_aInvalidations[1]);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidationsParts.size());
+    CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), 
aView1.m_aInvalidationsParts[0]);
 }
 
 void ScTiledRenderingTest::testInsertDeletePageInvalidation()
@@ -1766,7 +1773,7 @@ void 
ScTiledRenderingTest::testInsertDeletePageInvalidation()
     comphelper::dispatchCommand(".uno:Insert", aArgs);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
-    CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(6), aView1.m_aInvalidations.size());
     CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), 
aView1.m_aInvalidations[0]);
     CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts());
 
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 88d35b111ed3..396b1c63a72c 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -329,8 +329,14 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
             ss << aDocSize.Width() << ", " << aDocSize.Height();
             OString sRect = ss.str().c_str();
             ScTabViewShell* pViewShell = aViewData.GetViewShell();
+
+            // Invalidate first
+            tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000);
+            OString sPayload = aRectangle.toString() + OString(", ") + 
OString::number(aViewData.GetTabNo());
+            
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, 
sPayload.getStr());
+
             ScModelObj* pModel = 
ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
-            SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel);
+            SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, 
false);
         }
     }
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to