sc/qa/unit/tiledrendering/tiledrendering.cxx | 15 ++++------ sc/source/ui/view/tabview.cxx | 38 +++++++++++++-------------- 2 files changed, 25 insertions(+), 28 deletions(-)
New commits: commit 9f71c43ca0ff956adc74f171bd20d3163ecf366c Author: Tamás Zolnai <[email protected]> AuthorDate: Fri Sep 27 19:29:27 2019 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Sat Sep 28 03:31:45 2019 +0200 sc lok: Optimize invalidation triggered by getRowColumnHeaders() method Don't call a full invalidation, rather use invalidation only on the new area. Make sure that the invalidation is called first. Reviewed-on: https://gerrit.libreoffice.org/79494 Reviewed-by: Tamás Zolnai <[email protected]> Tested-by: Tamás Zolnai <[email protected]> (cherry picked from commit e740aaf876edd58c1f5c5e17af2495cad36cfc27) Change-Id: I89d1c6342ed8e95fe738a876a76ca6feda031962 Reviewed-on: https://gerrit.libreoffice.org/79620 Reviewed-by: Tamás Zolnai <[email protected]> Tested-by: Tamás Zolnai <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/79763 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index e7937792abd9..f88070b065b0 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1799,9 +1799,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(0, 15, 19650, 5400)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[0]); // Extend area top-to-bottom aView1.m_bInvalidateTiles = false; @@ -1809,9 +1808,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(0, 5400, 19650, 9800)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[0]); // Extend area left-to-right aView1.m_bInvalidateTiles = false; @@ -1819,9 +1817,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(5400, 5400, 25050, 9800)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); - CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]); - CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]); } } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 210308caf3f3..935ed1ef290d 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2564,14 +2564,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) SAL_INFO("sc.lok.header", "Row Header: a new height: " << aNewSize.Height()); if (pDocSh) { - // Provide size in the payload, so clients don't have to - // call lok::Document::getDocumentSize(). - std::stringstream ss; - ss << aNewSize.Width() << ", " << aNewSize.Height(); - OString sSize = ss.str().c_str(); - ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel); - // New area extended to the bottom of the sheet after last row // excluding overlapping area with aNewColArea tools::Rectangle aNewRowArea(0, aOldSize.getHeight(), aOldSize.getWidth(), aNewSize.getHeight()); @@ -2582,6 +2574,14 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) UpdateSelectionOverlay(); SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString()); } + + // Provide size in the payload, so clients don't have to + // call lok::Document::getDocumentSize(). + std::stringstream ss; + ss << aNewSize.Width() << ", " << aNewSize.Height(); + OString sSize = ss.str().c_str(); + ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false); } } @@ -2705,17 +2705,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) if (pDocSh) { - if (aOldSize != aNewSize) - { - // Provide size in the payload, so clients don't have to - // call lok::Document::getDocumentSize(). - std::stringstream ss; - ss << aNewSize.Width() << ", " << aNewSize.Height(); - OString sSize = ss.str().c_str(); - ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); - SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel); - } - // New area extended to the right of the sheet after last column // including overlapping area with aNewRowArea tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight()); @@ -2726,6 +2715,17 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) UpdateSelectionOverlay(); SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewColArea.toString()); } + + if (aOldSize != aNewSize) + { + // Provide size in the payload, so clients don't have to + // call lok::Document::getDocumentSize(). + std::stringstream ss; + ss << aNewSize.Width() << ", " << aNewSize.Height(); + OString sSize = ss.str().c_str(); + ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false); + } } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
