sc/inc/formulacell.hxx | 2 +- sc/source/core/data/colorscale.cxx | 2 +- sc/source/core/data/column.cxx | 23 ++++++++++++++++++----- sc/source/core/data/column3.cxx | 9 ++++++++- sc/source/core/data/documen4.cxx | 11 ++++++----- sc/source/core/data/documen7.cxx | 5 +++-- sc/source/core/data/formulacell.cxx | 11 ++++------- sc/source/core/data/validat.cxx | 2 +- sc/source/core/tool/detfunc.cxx | 10 +++++----- sc/source/ui/docshell/docfunc.cxx | 2 +- 10 files changed, 48 insertions(+), 29 deletions(-)
New commits: commit 565232aa89889b373d487d77fcba826abaf875f1 Author: Tor Lillqvist <t...@collabora.com> Date: Thu Oct 1 17:07:36 2015 +0300 Make less calls to officecfg::...::UseOpenCL::get() Change-Id: I5f7f52b6f2fb92c46e2b24e0edf95b4ccd17671d diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index c017dbe..bb97160 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -242,7 +242,7 @@ public: void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); // compile temporary string tokens void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ); bool MarkUsedExternalReferences(); - void Interpret(); + void Interpret(bool bUseOpenCL); bool IsIterCell() const { return bIsIterCell; } sal_uInt16 GetSeenInIteration() const { return nSeenInIteration; } diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 9be59b7..9bd845f 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -219,7 +219,7 @@ double ScColorScaleEntry::GetValue() const { if(mpCell) { - mpCell->Interpret(); + mpCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); if(mpCell->IsValue()) return mpCell->GetValue(); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 9accde9..7529043 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -867,6 +867,7 @@ class CopyToClipHandler sc::ColumnBlockPosition maDestPos; sc::ColumnBlockPosition* mpDestPos; bool mbCopyNotes; + bool mbUseOpenCL; void setDefaultAttrsToDest(size_t nRow, size_t nSize) { @@ -882,7 +883,11 @@ class CopyToClipHandler public: CopyToClipHandler(const ScColumn& rSrcCol, ScColumn& rDestCol, sc::ColumnBlockPosition* pDestPos, bool bCopyNotes) : - mrSrcCol(rSrcCol), mrDestCol(rDestCol), mpDestPos(pDestPos), mbCopyNotes(bCopyNotes) + mrSrcCol(rSrcCol), + mrDestCol(rDestCol), + mpDestPos(pDestPos), + mbCopyNotes(bCopyNotes), + mbUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get()) { if (mpDestPos) maDestPos = *mpDestPos; @@ -953,7 +958,7 @@ public: { const ScFormulaCell& rOld = **it; if (rOld.GetDirty() && mrSrcCol.GetDoc().GetAutoCalc()) - const_cast<ScFormulaCell&>(rOld).Interpret(); + const_cast<ScFormulaCell&>(rOld).Interpret(mbUseOpenCL); aCloned.push_back(new ScFormulaCell(rOld, mrDestCol.GetDoc(), aDestPos)); } @@ -1057,6 +1062,7 @@ void ScColumn::CopyStaticToDocument( size_t nOffset = aPos.second; size_t nDataSize = 0; size_t nCurRow = nRow1; + const bool bUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get()); for (; it != maCells.end() && nCurRow <= static_cast<size_t>(nRow2); ++it, nOffset = 0, nCurRow += nDataSize) { @@ -1122,7 +1128,7 @@ void ScColumn::CopyStaticToDocument( ScFormulaCell& rFC = const_cast<ScFormulaCell&>(**itData); if (rFC.GetDirty() && pDocument->GetAutoCalc()) - rFC.Interpret(); + rFC.Interpret(bUseOpenCL); if (rFC.GetErrCode()) // Skip cells with error. @@ -1187,7 +1193,7 @@ void ScColumn::CopyCellToDocument( SCROW nSrcRow, SCROW nDestRow, ScColumn& rDes { ScFormulaCell* p = sc::formula_block::at(*it->data, aPos.second); if (p->GetDirty() && pDocument->GetAutoCalc()) - p->Interpret(); + p->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); ScAddress aDestPos = p->aPos; aDestPos.SetRow(nDestRow); @@ -2777,6 +2783,13 @@ struct SetDirtyIfPostponedHandler struct CalcAllHandler { + bool mbUseOpenCL; + + CalcAllHandler() : + mbUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get()) + { + } + void operator() (size_t /*nRow*/, ScFormulaCell* pCell) { #if OSL_DEBUG_LEVEL > 1 @@ -2784,7 +2797,7 @@ struct CalcAllHandler double nOldVal, nNewVal; nOldVal = pCell->GetValue(); #endif - pCell->Interpret(); + pCell->Interpret(mbUseOpenCL); #if OSL_DEBUG_LEVEL > 1 if (pCell->GetCode()->IsRecalcModeNormal()) nNewVal = pCell->GetValue(); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 40ec240..9dc95c1 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -92,10 +92,17 @@ void ScColumn::BroadcastCells( const std::vector<SCROW>& rRows, sal_uLong nHint struct DirtyCellInterpreter { + bool mbUseOpenCL; + + DirtyCellInterpreter() : + mbUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get()) + { + } + void operator() (size_t, ScFormulaCell* p) { if (p->GetDirty()) - p->Interpret(); + p->Interpret(mbUseOpenCL); } }; diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 6d0c89d..b0a2af8 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -85,6 +85,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, ScFormulaCell* pFormula = NULL; double fTargetVal = 0.0; sal_uInt32 nFIndex = 0; + const bool bUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get()); if ( eFType == CELLTYPE_FORMULA && eVType == CELLTYPE_VALUE && GetFormatTable()->IsNumberFormat( sValStr, nFIndex, fTargetVal ) ) { @@ -109,7 +110,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, double fBestF, fFPrev; fBestX = fXPrev = fSaveVal; - pFormula->Interpret(); + pFormula->Interpret( bUseOpenCL ); bool bError = ( pFormula->GetErrCode() != 0 ); // bError always corresponds with fF @@ -131,7 +132,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, { *pVCell = fX; SetDirty( aVRange, false ); - pFormula->Interpret(); + pFormula->Interpret( bUseOpenCL ); bError = ( pFormula->GetErrCode() != 0 ); fF = pFormula->GetValue() - fTargetVal; @@ -165,7 +166,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, *pVCell = fHorX; SetDirty( aVRange, false ); - pFormula->Interpret(); + pFormula->Interpret( bUseOpenCL ); bHorMoveError = ( pFormula->GetErrCode() != 0 ); if ( bHorMoveError ) break; @@ -229,7 +230,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, { *pVCell = nX; SetDirty( aVRange, false ); - pFormula->Interpret(); + pFormula->Interpret( bUseOpenCL ); if ( fabs( pFormula->GetValue() - fTargetVal ) > fabs( fF ) ) nX = fBestX; bRet = true; @@ -240,7 +241,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, } *pVCell = fSaveVal; SetDirty( aVRange, false ); - pFormula->Interpret(); + pFormula->Interpret( bUseOpenCL ); if ( !bDoneIteration ) { SetError( nVCol, nVRow, nVTab, NOTAVAILABLE ); diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx index 795e93c..3d89773 100644 --- a/sc/source/core/data/documen7.cxx +++ b/sc/source/core/data/documen7.cxx @@ -460,6 +460,7 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet pCell = pFormulaTree; ScFormulaCell* pLastNoGood = 0; + const bool bUseOpenCL(officecfg::Office::Common::Misc::UseOpenCL::get()); while ( pCell ) { // Interpret resets bDirty and calls Remove, also the referenced! @@ -467,11 +468,11 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSet if ( bOnlyForced ) { if ( pCell->GetCode()->IsRecalcModeForced() ) - pCell->Interpret(); + pCell->Interpret( bUseOpenCL ); } else { - pCell->Interpret(); + pCell->Interpret( bUseOpenCL ); } if ( pCell->GetPrevious() || pCell == pFormulaTree ) { // (IsInFormulaTree(pCell)) no Remove was called => next diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index f38e7da..7f91492 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -1434,7 +1434,7 @@ bool ScFormulaCell::MarkUsedExternalReferences() return pCode && pDocument->MarkUsedExternalReferences(*pCode, aPos); } -void ScFormulaCell::Interpret() +void ScFormulaCell::Interpret(bool bUseOpenCL) { if (!IsDirtyOrInTableOpDirty() || pDocument->GetRecursionHelper().IsInReturn()) return; // no double/triple processing @@ -1479,7 +1479,7 @@ void ScFormulaCell::Interpret() } else { - if ( ! InterpretFormulaGroup() ) + if ( !bUseOpenCL || !InterpretFormulaGroup() ) InterpretTail( SCITP_NORMAL); } @@ -2369,7 +2369,7 @@ bool ScFormulaCell::NeedsInterpret() const void ScFormulaCell::MaybeInterpret() { if (NeedsInterpret()) - Interpret(); + Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); } bool ScFormulaCell::IsHyperLinkCell() const @@ -2456,7 +2456,7 @@ const ScMatrix* ScFormulaCell::GetMatrix() if( IsDirtyOrInTableOpDirty() // Was stored !bDirty but an accompanying matrix cell was bDirty? || (!bDirty && cMatrixFlag == MM_FORMULA && !aResult.GetMatrix())) - Interpret(); + Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); } return aResult.GetMatrix().get(); } @@ -3829,9 +3829,6 @@ bool ScFormulaCell::InterpretFormulaGroup() return false; } - if (!officecfg::Office::Common::Misc::UseOpenCL::get()) - return false; - // TODO : Disable invariant formula group interpretation for now in order // to get implicit intersection to work. if (mxGroup->mbInvariant && false) diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx index bb19d02..25b7f94 100644 --- a/sc/source/core/data/validat.cxx +++ b/sc/source/core/data/validat.cxx @@ -634,7 +634,7 @@ bool ScValidationData::GetSelectionFromFormula( // Make sure the formula gets interpreted and a result is delivered, // regardless of the AutoCalc setting. - aValidationSrc.Interpret(); + aValidationSrc.Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); ScMatrixRef xMatRef; const ScMatrix *pValues = aValidationSrc.GetMatrix(); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index d21476f..2958827 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -811,7 +811,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetective return DET_INS_CIRCULAR; if (pFCell->GetDirty()) - pFCell->Interpret(); // can't be called after SetRunning + pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning pFCell->SetRunning(true); sal_uInt16 nResult = DET_INS_EMPTY; @@ -900,7 +900,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL return nLevel; if (pFCell->GetDirty()) - pFCell->Interpret(); // can't be called after SetRunning + pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning pFCell->SetRunning(true); sal_uInt16 nResult = nLevel; @@ -958,7 +958,7 @@ sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiv return DET_INS_CIRCULAR; if (pFCell->GetDirty()) - pFCell->Interpret(); // can't be called after SetRunning + pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning pFCell->SetRunning(true); sal_uInt16 nResult = DET_INS_EMPTY; @@ -1010,7 +1010,7 @@ sal_uInt16 ScDetectiveFunc::InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCo bool bRunning = pFCell->IsRunning(); if (pFCell->GetDirty()) - pFCell->Interpret(); // can't be called after SetRunning + pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning pFCell->SetRunning(true); ScDetectiveRefIter aIter(pFCell); @@ -1098,7 +1098,7 @@ sal_uInt16 ScDetectiveFunc::FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2 bool bRunning = pFCell->IsRunning(); if (pFCell->GetDirty()) - pFCell->Interpret(); // can't be called after SetRunning + pFCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); // can't be called after SetRunning pFCell->SetRunning(true); ScDetectiveRefIter aIter(pFCell); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 1245ef5..a575f71 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1014,7 +1014,7 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo if (bInteraction && !rDoc.GetAutoCalc() && pCell) { // calculate just the cell once and set Dirty again - pCell->Interpret(); + pCell->Interpret(officecfg::Office::Common::Misc::UseOpenCL::get()); pCell->SetDirtyVar(); rDoc.PutInFormulaTree( pCell); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits