diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-10-07 21:51:04 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2016-10-07 22:05:11 -0400 |
commit | 7345a032bb6758dcbe425c911d557d0b22d7d5ec (patch) | |
tree | fadfafffc34c1bac5b20b752fbcc8943e66ed4a6 /sc | |
parent | f37292941fef7375b8bc29783f54e0c64d670a24 (diff) |
Reduce the number of calls to underlying flat_segment_tree structure.
By replacing the getValue() call to getRangeData().
Change-Id: Ia563b08dd356d9653e6a6ce16256196b28f56b65
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table2.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 36ed4efd74e5..7925af683a81 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -3673,9 +3673,13 @@ sal_uLong ScTable::GetRowOffset( SCROW nRow, bool bHiddenAsZero ) const SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const { - sal_uInt32 nSum = 0; + sal_uLong nSum = 0; ScFlatBoolRowSegments::RangeData aData; + + ScFlatUInt16RowSegments::RangeData aRowHeightRange; + aRowHeightRange.mnRow2 = -1; + for (SCROW nRow = 0; nRow <= MAXROW; ++nRow) { if (!mpHiddenRows->getRangeData(nRow, aData)) @@ -3689,8 +3693,15 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const continue; } - sal_uInt32 nNew = mpRowHeights->getValue(nRow); - nSum += nNew; + if (aRowHeightRange.mnRow2 < nRow) + { + if (!mpRowHeights->getRangeData(nRow, aRowHeightRange)) + // Failed to fetch the range data for whatever reason. + break; + } + + nSum += aRowHeightRange.mnValue; + if (nSum > nHeight) { if (nRow >= MAXROW) |