diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-11-18 15:35:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-11-19 06:42:15 +0100 |
commit | d5036b0e2bc50c991858e85760a8580cdf08629e (patch) | |
tree | 33071aa32bdc39b30565e7eedc4b356106d1552c /sc | |
parent | afe3205efb82447e49851c239334fe84692dec4f (diff) |
crashtesting fdo78617-2.ods
as a consequence of
commit feec8e3c34e08b621098a17f1011dccd0b4f7f4c
Date: Tue Nov 12 16:00:55 2019 +0200
reduce iteration in ScViewData::GetScrPos
Change-Id: Iec539c33bd80b9ad2d2a3698d443c5cec81f8f85
Reviewed-on: https://gerrit.libreoffice.org/83093
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit 00e1adec49c50f9128dd02ae721e62ae3e729ad6)
Reviewed-on: https://gerrit.libreoffice.org/83120
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/table2.cxx | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index e86f3d215778..c80d08602b15 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -3178,17 +3178,20 @@ sal_uLong ScTable::GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fS // round-down a single height value, multiply resulting (pixel) values const sal_uLong nOneHeight = static_cast<sal_uLong>( aData.mnValue * fScale ); - SCROW nRowsInSegment = nSegmentEnd + 1 - nRow; - if (pnMaxHeight) + // sometimes scaling results in zero height + if (nOneHeight) { - nRowsInSegment = std::min(nRowsInSegment, static_cast<SCROW>(*pnMaxHeight / nOneHeight + 1)); - nHeight += nOneHeight * nRowsInSegment; - if (nHeight > *pnMaxHeight) - return nHeight; + SCROW nRowsInSegment = nSegmentEnd + 1 - nRow; + if (pnMaxHeight) + { + nRowsInSegment = std::min(nRowsInSegment, static_cast<SCROW>(*pnMaxHeight / nOneHeight + 1)); + nHeight += nOneHeight * nRowsInSegment; + if (nHeight > *pnMaxHeight) + return nHeight; + } + else + nHeight += nOneHeight * nRowsInSegment; } - else - nHeight += nOneHeight * nRowsInSegment; - nRow = nSegmentEnd + 1; } |