sc/source/core/data/bcaslot.cxx | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
New commits: commit 131710cba68e46c175babbd20c810e7fc2fb811f Author: Luboš Luňák <[email protected]> AuthorDate: Sun Feb 20 00:56:37 2022 +0100 Commit: Luboš Luňák <[email protected]> CommitDate: Sun Feb 20 07:59:01 2022 +0100 optimize AreaBroadcast() a bit Use ComputeAreaPoints() rather than repeated ComputeSlotOffset(). Change-Id: If7869fe4c37a1e844ec9e6513a7c1799290c077f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130204 Tested-by: Jenkins Reviewed-by: Luboš Luňák <[email protected]> diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index 6869ca24e120..7e6383a9c35b 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -909,24 +909,23 @@ bool ScBroadcastAreaSlotMachine::AreaBroadcast( const ScHint& rHint ) const TableSlotsMap::const_iterator iTab( aTableSlotsMap.find( rAddress.Tab())); if (iTab == aTableSlotsMap.end()) return false; - // Process all slots for the given row range, but it's enough to process - // each only once. - ScBroadcastAreaSlot* pLastSlot = nullptr; - ScAddress address(rAddress); - bool wasBroadcast = false; - for( SCROW nRow = rAddress.Row(); nRow < rAddress.Row() + rHint.GetRowCount(); ++nRow ) + // Process all slots for the given row range. + ScRange broadcastRange( rAddress, + ScAddress( rAddress.Col(), rAddress.Row() + rHint.GetRowCount() - 1, rAddress.Tab())); + bool bBroadcasted = false; + ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots(); + SCSIZE nStart, nEnd, nRowBreak; + ComputeAreaPoints( broadcastRange, nStart, nEnd, nRowBreak ); + SCSIZE nOff = nStart; + SCSIZE nBreak = nOff + nRowBreak; + ScBroadcastAreaSlot** pp = ppSlots + nOff; + while ( nOff <= nEnd ) { - address.SetRow(nRow); - ScBroadcastAreaSlot* pSlot = (*iTab).second->getAreaSlot( - ComputeSlotOffset( address)); - if ( pSlot && pSlot != pLastSlot ) - { - if(pSlot->AreaBroadcast( rHint )) - wasBroadcast = true; - pLastSlot = pSlot; - } + if ( *pp ) + bBroadcasted |= (*pp)->AreaBroadcast( rHint ); + ComputeNextSlot( nOff, nBreak, pp, nStart, ppSlots, nRowBreak, mnBcaSlotsCol); } - return wasBroadcast; + return bBroadcasted; } }
