summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-27 13:17:30 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-27 13:17:30 +0200
commit584222d0621969f082f032566cc10ddf35fa043e (patch)
treeb1766ec2cf1ad4fa9589f4b9b5fe9887e373644b
parent2f29ca69d1d5f303da2d80588007e4ab224d0735 (diff)
sc lok: Optimize invalidation triggered by ScTabView::SetCursor() 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/79497 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit db0e7e3715bdef7ad6c1f536e9cf1ea84773fbe8) Change-Id: Ibdcc71a81f852acbd40a710204540ebd8df77907 Reviewed-on: https://gerrit.libreoffice.org/79623 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx10
-rw-r--r--sc/source/ui/view/tabview3.cxx16
2 files changed, 12 insertions, 14 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 6e5f5d1d5280..06f576ccf38a 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1873,9 +1873,8 @@ void ScTiledRenderingTest::testJumpHorizontallyInvalidation()
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD2);
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, 39525, 13005), aView1.m_aInvalidations[1]);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[0]);
mxComponent->dispose();
mxComponent.clear();
@@ -1902,9 +1901,8 @@ void ScTiledRenderingTest::testJumpToLastRowInvalidation()
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN | KEY_MOD1);
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, 26775, 127500255), aView1.m_aInvalidations[1]);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 127500255), aView1.m_aInvalidations[0]);
mxComponent->dispose();
mxComponent.clear();
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index f64b8d35ecfe..ab357ccf9463 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -382,14 +382,6 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
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 right of the sheet after last column
// including overlapping area with aNewRowArea
tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight());
@@ -408,6 +400,14 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew )
{
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);
}
}
}