summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-05-21 23:10:35 -0400
committerAshod Nakashian <ashnakash@gmail.com>2016-05-22 03:36:09 +0000
commit4c338a328d6be0450bfdcb08876abfd149cb80ca (patch)
treeaf9678cecadf5096b91309589ed59d08f30bd824
parent4475acb6e52652890e5470c4cd1f4e1aaa84fbb5 (diff)
sc lok bccu#1610 - Tiles not rendering in large spreadsheets
Variable max info rows instead of hard-coded allows for collecting info on more rows. FillInfo, however, is extremely slow for large row count (a few thousand) and needs improving. Change-Id: Ib0e475513bc3ba98fff66a5b9d405aeba1057331 Reviewed-on: https://gerrit.libreoffice.org/25293 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r--sc/inc/fillinfo.hxx5
-rw-r--r--sc/source/core/data/fillinfo.cxx17
-rw-r--r--sc/source/ui/view/gridwin4.cxx2
3 files changed, 12 insertions, 12 deletions
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index d35bb8e42df5..419f1c962173 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -195,10 +195,11 @@ struct ScTableInfo
{
svx::frame::Array maArray;
RowInfo* mpRowInfo;
- sal_uInt16 mnArrCount;
+ sal_uInt16 mnArrCount;
+ sal_uInt16 mnArrCapacity;
bool mbPageMode;
- explicit ScTableInfo();
+ explicit ScTableInfo(const sal_uInt16 capacity = 1024);
~ScTableInfo();
ScTableInfo(const ScTableInfo&) = delete;
const ScTableInfo& operator=(const ScTableInfo&) = delete;
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index b167a82c9058..8a543df27592 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -46,8 +46,6 @@
#include <memory>
#include <o3tl/make_unique.hxx>
-const sal_uInt16 ROWINFO_MAX = 1024;
-
enum FillInfoLinePos
{
FILP_TOP,
@@ -209,7 +207,7 @@ bool isRotateItemUsed(ScDocumentPool *pPool)
return false;
}
-void initRowInfo(ScDocument* pDoc, RowInfo* pRowInfo,
+void initRowInfo(ScDocument* pDoc, RowInfo* pRowInfo, const SCSIZE nMaxRow,
double fRowScale, SCROW nRow1, SCTAB nTab, SCROW& rYExtra, SCSIZE& rArrRow, SCROW& rRow2)
{
sal_uInt16 nDocHeight = ScGlobal::nStdRowHeight;
@@ -249,7 +247,7 @@ void initRowInfo(ScDocument* pDoc, RowInfo* pRowInfo,
pThisRowInfo->nRotMaxCol = SC_ROTMAX_NONE;
++rArrRow;
- if (rArrRow >= ROWINFO_MAX)
+ if (rArrRow >= nMaxRow)
{
OSL_FAIL("FillInfo: Range too big" );
rYExtra = nSignedY; // End
@@ -434,7 +432,7 @@ void ScDocument::FillInfo(
nArrRow=0;
SCROW nYExtra = nRow2+1;
- initRowInfo(this, pRowInfo, fRowScale, nRow1,
+ initRowInfo(this, pRowInfo, rTabInfo.mnArrCapacity, fRowScale, nRow1,
nTab, nYExtra, nArrRow, nRow2);
nArrCount = nArrRow; // incl. Dummys
@@ -1125,17 +1123,18 @@ void ScDocument::FillInfo(
rArray.MirrorSelfX( true, false );
}
-ScTableInfo::ScTableInfo()
- : mpRowInfo(new RowInfo[ROWINFO_MAX])
+ScTableInfo::ScTableInfo(const sal_uInt16 capacity)
+ : mpRowInfo(new RowInfo[capacity])
, mnArrCount(0)
+ , mnArrCapacity(capacity)
, mbPageMode(false)
{
- memset(mpRowInfo, 0, ROWINFO_MAX*sizeof(RowInfo));
+ memset(mpRowInfo, 0, mnArrCapacity * sizeof(RowInfo));
}
ScTableInfo::~ScTableInfo()
{
- for( sal_uInt16 nIdx = 0; nIdx < ROWINFO_MAX; ++nIdx )
+ for( sal_uInt16 nIdx = 0; nIdx < mnArrCapacity; ++nIdx )
delete [] mpRowInfo[ nIdx ].pCellInfo;
delete [] mpRowInfo;
}
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index c4d7da116910..979af6b6b3a3 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -975,7 +975,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
double fPPTX = pViewData->GetPPTX();
double fPPTY = pViewData->GetPPTY();
- ScTableInfo aTabInfo;
+ ScTableInfo aTabInfo(nEndRow + 2);
pDoc->FillInfo(aTabInfo, nStartCol, nStartRow, nEndCol, nEndRow, nTab, fPPTX, fPPTY, false, false, NULL);
ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab,