[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 2 commits - sc/inc sc/source
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sun May 22 03:36:19 UTC 2016
sc/inc/fillinfo.hxx | 54 ++++++++++++++++++++---
sc/source/core/data/fillinfo.cxx | 89 +++++++++++++--------------------------
sc/source/ui/view/gridwin4.cxx | 2
3 files changed, 78 insertions(+), 67 deletions(-)
New commits:
commit 4c338a328d6be0450bfdcb08876abfd149cb80ca
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat May 21 23:10:35 2016 -0400
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 at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index d35bb8e..419f1c9 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 b167a82..8a543df 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 c4d7da1..979af6b 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,
commit 4475acb6e52652890e5470c4cd1f4e1aaa84fbb5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Apr 9 20:39:48 2016 +0100
coverity#738785 reorg to silence Uninitialized pointer field
(cherry picked from commit 3ac0778c0a2b2f693a1029b7b05c1be4f71944a9)
Change-Id: If2225e77215e2a6fb6b9e9dfc6021a2c20babe50
Reviewed-on: https://gerrit.libreoffice.org/25292
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index 94bd6b1..d35bb8e 100644
--- a/sc/inc/fillinfo.hxx
+++ b/sc/inc/fillinfo.hxx
@@ -29,8 +29,6 @@
#include "colorscale.hxx"
#include "cellvalue.hxx"
-#include <boost/noncopyable.hpp>
-
class SfxItemSet;
class SvxBrushItem;
class SvxBoxItem;
@@ -96,8 +94,42 @@ struct ScIconSetInfo
bool mbShowValue;
};
-struct CellInfo : boost::noncopyable
+struct CellInfo
{
+ CellInfo()
+ : pPatternAttr(nullptr)
+ , pConditionSet(nullptr)
+ , pBackground(nullptr) // TODO: omit?
+ , pLinesAttr(nullptr)
+ , mpTLBRLine(nullptr)
+ , mpBLTRLine(nullptr)
+ , pShadowAttr(nullptr)
+ , pHShadowOrigin(nullptr)
+ , pVShadowOrigin(nullptr)
+ , eHShadowPart(SC_SHADOW_HSTART)
+ , eVShadowPart(SC_SHADOW_HSTART)
+ , nClipMark(SC_CLIPMARK_NONE)
+ , nWidth(0)
+ , nRotateDir(SC_ROTDIR_NONE)
+ , bMarked(false)
+ , bEmptyCellText(false)
+ , bMerged(false)
+ , bHOverlapped(false)
+ , bVOverlapped(false)
+ , bAutoFilter(false)
+ , bPivotButton(false)
+ , bPivotPopupButton(false)
+ , bFilterActive(false)
+ , bPrinted(false) // view-internal
+ , bHideGrid(false) // view-internal
+ , bEditEngine(false) // view-internal
+ {
+ }
+
+ ~CellInfo() = default;
+ CellInfo(const CellInfo&) = delete;
+ const CellInfo& operator=(const CellInfo&) = delete;
+
ScRefCellValue maCell;
const ScPatternAttr* pPatternAttr;
@@ -139,8 +171,13 @@ struct CellInfo : boost::noncopyable
const SCCOL SC_ROTMAX_NONE = SCCOL_MAX;
-struct RowInfo : boost::noncopyable
+struct RowInfo
{
+ RowInfo() = default;
+ ~RowInfo() = default;
+ RowInfo(const RowInfo&) = delete;
+ const RowInfo& operator=(const RowInfo&) = delete;
+
CellInfo* pCellInfo;
sal_uInt16 nHeight;
@@ -154,7 +191,7 @@ struct RowInfo : boost::noncopyable
bool bChanged:1; // TRUE, if not tested
};
-struct ScTableInfo : boost::noncopyable
+struct ScTableInfo
{
svx::frame::Array maArray;
RowInfo* mpRowInfo;
@@ -163,6 +200,8 @@ struct ScTableInfo : boost::noncopyable
explicit ScTableInfo();
~ScTableInfo();
+ ScTableInfo(const ScTableInfo&) = delete;
+ const ScTableInfo& operator=(const ScTableInfo&) = delete;
};
#endif
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 5786216..b167a82 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -157,11 +157,11 @@ class RowInfoFiller
{
alignArray(nRow);
- RowInfo* pThisRowInfo = &mpRowInfo[mnArrY];
- CellInfo* pInfo = &pThisRowInfo->pCellInfo[mnArrX];
- pInfo->maCell = rCell;
- pThisRowInfo->bEmptyText = false;
- pInfo->bEmptyCellText = false;
+ RowInfo& rThisRowInfo = mpRowInfo[mnArrY];
+ CellInfo& rInfo = rThisRowInfo.pCellInfo[mnArrX];
+ rInfo.maCell = rCell;
+ rThisRowInfo.bEmptyText = false;
+ rInfo.bEmptyCellText = false;
++mnArrY;
}
@@ -266,55 +266,27 @@ void initCellInfo(RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nRotMax, bool bPain
const SvxShadowItem* pDefShadow, SCROW nBlockStartY, SCROW nBlockEndY,
SCCOL nBlockStartX, SCCOL nBlockEndX)
{
- for (SCSIZE nArrRow = 0; nArrRow < nArrCount; nArrRow++)
+ for (SCSIZE nArrRow = 0; nArrRow < nArrCount; ++nArrRow)
{
- RowInfo* pThisRowInfo = &pRowInfo[nArrRow];
- SCROW nY = pThisRowInfo->nRowNo;
- pThisRowInfo->pCellInfo = new CellInfo[ nRotMax+1+2 ]; // to delete the caller!
+ RowInfo& rThisRowInfo = pRowInfo[nArrRow];
+ SCROW nY = rThisRowInfo.nRowNo;
+ rThisRowInfo.pCellInfo = new CellInfo[nRotMax + 1 + 2]; // to delete the caller!
- for (SCCOL nArrCol = 0; nArrCol <= nRotMax+2; nArrCol++) // Preassign cell info
+ for (SCCOL nArrCol = 0; nArrCol <= nRotMax+2; ++nArrCol) // Preassign cell info
{
- SCCOL nX;
- if (nArrCol>0)
- nX = nArrCol-1;
- else
- nX = MAXCOL+1; // invalid
-
- CellInfo* pInfo = &pThisRowInfo->pCellInfo[nArrCol];
- pInfo->bEmptyCellText = true;
- pInfo->maCell.clear();
+ CellInfo& rInfo = rThisRowInfo.pCellInfo[nArrCol];
if (bPaintMarks)
- pInfo->bMarked = ( nX >= nBlockStartX && nX <= nBlockEndX
- && nY >= nBlockStartY && nY <= nBlockEndY );
- else
- pInfo->bMarked = false;
- pInfo->nWidth = 0;
-
- pInfo->nClipMark = SC_CLIPMARK_NONE;
- pInfo->bMerged = false;
- pInfo->bHOverlapped = false;
- pInfo->bVOverlapped = false;
- pInfo->bAutoFilter = false;
- pInfo->bPivotButton = false;
- pInfo->bPivotPopupButton = false;
- pInfo->bFilterActive = false;
- pInfo->nRotateDir = SC_ROTDIR_NONE;
-
- pInfo->bPrinted = false; // view-internal
- pInfo->bHideGrid = false; // view-internal
- pInfo->bEditEngine = false; // view-internal
-
- pInfo->pBackground = nullptr; //TODO: omit?
- pInfo->pPatternAttr = nullptr;
- pInfo->pConditionSet= nullptr;
-
- pInfo->pLinesAttr = nullptr;
- pInfo->mpTLBRLine = nullptr;
- pInfo->mpBLTRLine = nullptr;
-
- pInfo->pShadowAttr = pDefShadow;
- pInfo->pHShadowOrigin = nullptr;
- pInfo->pVShadowOrigin = nullptr;
+ {
+ SCCOL nX;
+ if (nArrCol>0)
+ nX = nArrCol-1;
+ else
+ nX = MAXCOL+1; // invalid
+ rInfo.bMarked = (nX >= nBlockStartX && nX <= nBlockEndX &&
+ nY >= nBlockStartY && nY <= nBlockEndY);
+ }
+ rInfo.bEmptyCellText = true;
+ rInfo.pShadowAttr = pDefShadow;
}
}
}
More information about the Libreoffice-commits
mailing list