[Libreoffice-commits] core.git: sc/inc sc/source

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu May 26 19:07:06 UTC 2016


 sc/inc/fillinfo.hxx              |    5 +++--
 sc/source/core/data/fillinfo.cxx |   17 ++++++++---------
 sc/source/ui/view/gridwin4.cxx   |    2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit bdb112ea8bcf6f6f80483c31af05fefb2a40e026
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.
    
    Reviewed-on: https://gerrit.libreoffice.org/25293
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>
    (cherry picked from commit 4c338a328d6be0450bfdcb08876abfd149cb80ca)
    
    Change-Id: Ib0e475513bc3ba98fff66a5b9d405aeba1057331
    Reviewed-on: https://gerrit.libreoffice.org/25423
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx
index d35bb8e..3b42dff 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;
+    SCSIZE              mnArrCount;
+    SCSIZE              mnArrCapacity;
     bool                mbPageMode;
 
-    explicit            ScTableInfo();
+    explicit            ScTableInfo(const SCSIZE 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 8cd7534..6f71550 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
 
@@ -1124,17 +1122,18 @@ void ScDocument::FillInfo(
         rArray.MirrorSelfX();
 }
 
-ScTableInfo::ScTableInfo()
-    : mpRowInfo(new RowInfo[ROWINFO_MAX])
+ScTableInfo::ScTableInfo(const SCSIZE 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( SCSIZE 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 3da00b5..e698066 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -986,7 +986,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);
 
     ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab,


More information about the Libreoffice-commits mailing list