summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-03-10 18:00:28 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-03-11 08:19:37 +0100
commitcf95c0024ad9312ebdda382aba8f3cc201a0fdb2 (patch)
treec5c8d680d7ad1d4b3e10c02c9d907c7b18b87131
parenteeffa4b2a85751fd0153503520f6fc49b3510d86 (diff)
don't bother drawing zero-width cells
If a document has most columns hidden, then they'd be "drawn" anyway, since ScGridWindow::Draw() calls ExtendHidden(), this appears to be needed in order to drawn properly background after the last cell. So at least try avoid zero-sized draw operations which may add up enough to be noticeable with 16k columns Change-Id: I631e3be7467f8ea2dbfb824e647f900a7573da61 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131326 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--sc/source/ui/view/output.cxx38
1 files changed, 22 insertions, 16 deletions
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 045066e96689..09a1fc041eeb 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1099,6 +1099,27 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext)
nOldMerged = nMergedCols;
+ tools::Long nNewPosX = nPosX;
+ // extend for all merged cells
+ nMergedCols = 1;
+ if (pInfo->bMerged && pInfo->pPatternAttr)
+ {
+ const ScMergeAttr* pMerge =
+ &pInfo->pPatternAttr->GetItem(ATTR_MERGE);
+ nMergedCols = std::max<SCCOL>(1, pMerge->GetColMerge());
+ }
+
+ for (SCCOL nMerged = 0; nMerged < nMergedCols; ++nMerged)
+ {
+ SCCOL nCol = nX+nOldMerged+nMerged;
+ if (nCol > nX2+2)
+ break;
+ nNewPosX += pRowInfo[0].basicCellInfo(nCol-1).nWidth * nLayoutSign;
+ }
+
+ if (nNewPosX == nPosX)
+ continue; // Zero width, no need to draw.
+
if (bCellContrast)
{
// high contrast for cell borders and backgrounds -> empty background
@@ -1142,22 +1163,7 @@ void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext)
drawCells(rRenderContext, pColor, pBackground, pOldColor, pOldBackground, aRect, nPosXLogic, nLayoutSign, nOneXLogic, nOneYLogic, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo, mpDoc->GetIconSetBitmapMap());
- // extend for all merged cells
- nMergedCols = 1;
- if (pInfo->bMerged && pInfo->pPatternAttr)
- {
- const ScMergeAttr* pMerge =
- &pInfo->pPatternAttr->GetItem(ATTR_MERGE);
- nMergedCols = std::max<SCCOL>(1, pMerge->GetColMerge());
- }
-
- for (SCCOL nMerged = 0; nMerged < nMergedCols; ++nMerged)
- {
- SCCOL nCol = nX+nOldMerged+nMerged;
- if (nCol > nX2+2)
- break;
- nPosX += pRowInfo[0].basicCellInfo(nCol-1).nWidth * nLayoutSign;
- }
+ nPosX = nNewPosX;
}
tools::Long nPosXLogic = nPosX;