Kaydet (Commit) 3acc5a23 authored tarafından Noel Grandin's avatar Noel Grandin

tdf#69977 improve creation of large charts

this patch only tweaks a few things around the edges. The bulk of the
cost is down in the chart2 module where it creates ticks and labels.

Change-Id: If73a16d2f0a7511f07eff379a9b5c1b38ef96786
Reviewed-on: https://gerrit.libreoffice.org/51931Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst c49b42fc
......@@ -1133,8 +1133,10 @@ void ScTable::LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol
while ( rStartRow<rEndRow && IsEmptyLine(rStartRow, rStartCol, rEndCol) )
++rStartRow;
while ( rStartRow<rEndRow && IsEmptyLine(rEndRow, rStartCol, rEndCol) )
--rEndRow;
// Optimised loop for finding the bottom of the area, can be costly in large
// spreadsheets.
for (SCCOL i=rStartCol; i<=rEndCol; i++)
rEndRow = std::min(rEndRow, aCol[i].GetLastDataPos());
}
SCCOL ScTable::FindNextVisibleCol( SCCOL nCol, bool bRight ) const
......
......@@ -86,14 +86,17 @@ do { \
void SfxItemPool::AddSfxItemPoolUser(SfxItemPoolUser& rNewUser)
{
pImpl->maSfxItemPoolUsers.push_back(&rNewUser);
// maintain sorted to reduce cost of remove
const auto insertIt = ::std::lower_bound(
pImpl->maSfxItemPoolUsers.begin(), pImpl->maSfxItemPoolUsers.end(), &rNewUser);
pImpl->maSfxItemPoolUsers.insert(insertIt, &rNewUser);
}
void SfxItemPool::RemoveSfxItemPoolUser(SfxItemPoolUser& rOldUser)
{
const std::vector<SfxItemPoolUser*>::iterator aFindResult = ::std::find(
const auto aFindResult = ::std::lower_bound(
pImpl->maSfxItemPoolUsers.begin(), pImpl->maSfxItemPoolUsers.end(), &rOldUser);
if(aFindResult != pImpl->maSfxItemPoolUsers.end())
if(aFindResult != pImpl->maSfxItemPoolUsers.end() && *aFindResult == &rOldUser)
{
pImpl->maSfxItemPoolUsers.erase(aFindResult);
}
......
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