[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-6-4' - sc/source
sc/source/core/data/table2.cxx | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) New commits: commit 44dc896c7878ffe972c7c16df61f311f2e240a0e Author: Luboš Luňák AuthorDate: Wed Feb 16 09:54:54 2022 +0100 Commit: Gabor Kelemen CommitDate: Fri Jun 23 19:29:06 2023 +0100 for unallocated columns check default column attributes (tdf#132057) The problem was that this was returning false for the protected attribute just because a column was not allocated, but the default attributes had the flag set (so if the column had been allocated first it would have the flag set too). Change-Id: I2ef1ef40cafb7e8fc6f7b561c0a376af63f2ad26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129984 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit a717029e217621482ef799731f945090c6d6be4b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130015 Reviewed-by: Xisco Fauli (cherry picked from commit 5bdf7c93abd15dc422586228186e822096ce1517) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130018 diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 2085e623f932..0af4861983cb 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2059,15 +2059,12 @@ const ScPatternAttr* ScTable::GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, S bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, HasAttrFlags nMask ) const { -if ( nCol1 >= aCol.size() ) - return false; -if ( nCol2 >= aCol.size() ) - nCol2 = aCol.size() - 1; // Rows above range, doesn't contains flags - -bool bFound = false; -for (SCCOL i=nCol1; i<=nCol2 && !bFound; i++) -bFound |= aCol[i].HasAttrib( nRow1, nRow2, nMask ); -return bFound; +for(SCCOL nCol = nCol1; nCol <= nCol2 && nCol < aCol.size(); ++nCol ) +if( aCol[nCol].HasAttrib( nRow1, nRow2, nMask )) +return true; +if( nCol2 >= aCol.size()) + return aDefaultColAttrArray.HasAttrib( nRow1, nRow2, nMask ); +return false; } bool ScTable::HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const
[Libreoffice-commits] core.git: Branch 'libreoffice-7-5' - officecfg/registry
officecfg/registry/data/org/openoffice/Office/Common.xcu |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 03e4114097f21f82c7a6a8a64dd08684f09a99b8 Author: Luboš Luňák AuthorDate: Tue Feb 1 14:55:39 2022 +0100 Commit: Adolfo Jayme Barrientos CommitDate: Tue Jan 10 13:57:22 2023 + disable Skia as default on Mac for 7.5 There are still some problems like tdf#145988. Read discussion in https://gerrit.libreoffice.org/c/core/+/145198 Change-Id: I8c3e9713913a453c2b55a0ad9b1c8f82af8f7917 (cherry picked from commit 7db2df3d8f19cf4734ef359f238eb70e62b4be1d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145222 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 4694135efce7..98e4d87f410c 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -51,7 +51,7 @@ - true + false false true
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-2' - sc/inc sc/source
sc/inc/table.hxx |8 sc/source/core/data/table4.cxx |8 2 files changed, 12 insertions(+), 4 deletions(-) New commits: commit 495444d09dba7af63c0bf87804be02bc3f0f8c17 Author: Luboš Luňák AuthorDate: Thu Sep 29 14:22:00 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Oct 6 10:14:01 2022 +0200 introduce ScTable::GetColumnData() (tdf#151182) This is intended to handle possibly unallocated columns similarly to CreateColumnIfNotExists(), but unlike that one this one does not allocate, if the column is not allocated then the default column data is returned. This is intended for reading of columns. Change-Id: Ic3b637eb3d16bac69ebc7ecd389973407db4f7fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140737 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 305443d59a0fa579fe05b749d0891e63675d7050) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140613 Reviewed-by: Xisco Fauli (cherry picked from commit a2f91c0d5315156df1d2700deec936a4ee1c61e0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140879 Tested-by: Xisco Fauli diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 35388b54ea1f..7403b36780f1 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -294,6 +294,14 @@ public: } // out-of-line the cold part of the function void CreateColumnIfNotExistsImpl( const SCCOL nScCol ); + +ScColumnData& GetColumnData( SCCOL nCol ) +{ +if( nCol >= aCol.size()) +return aDefaultColData; +return aCol[nCol]; +} + sal_uInt64 GetCellCount() const; sal_uInt64 GetWeightedCount() const; sal_uInt64 GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const; diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 41250d5e2871..8ec1512136e7 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -910,9 +910,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( bGetPattern ) { if (bVertical) // rInner&:=nRow, rOuter&:=nCol -pSrcPattern = aCol[nCol].GetPattern(static_cast(nAtSrc)); +pSrcPattern = GetColumnData(nCol).GetPattern(static_cast(nAtSrc)); else// rInner&:=nCol, rOuter&:=nRow -pSrcPattern = aCol[nAtSrc].GetPattern(static_cast(nRow)); +pSrcPattern = GetColumnData(nAtSrc).GetPattern(static_cast(nRow)); bGetPattern = false; pStyleSheet = pSrcPattern->GetStyleSheet(); // do transfer ATTR_MERGE / ATTR_MERGE_FLAG @@ -1894,7 +1894,7 @@ void ScTable::FillAutoSimple( return; } const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType( -aCol[rCol].GetNumberFormat( rDocument.GetNonThreadedContext(), nSource)); +GetColumnData(rCol).GetNumberFormat( rDocument.GetNonThreadedContext(), nSource)); bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); bPercentCell = (nFormatType == SvNumFormatType::PERCENT); @@ -1903,7 +1903,7 @@ void ScTable::FillAutoSimple( { aSrcCell = GetCellValue(nSource, rRow); const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType( -aCol[nSource].GetNumberFormat( rDocument.GetNonThreadedContext(), rRow)); +GetColumnData(nSource).GetNumberFormat( rDocument.GetNonThreadedContext(), rRow)); bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); bPercentCell = (nFormatType == SvNumFormatType::PERCENT); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-2' - include/svl sc/qa svl/qa svl/source
include/svl/sharedstringpool.hxx |3 + sc/qa/unit/ucalc.cxx | 29 --- svl/qa/unit/svl.cxx | 67 +-- svl/source/misc/sharedstringpool.cxx |3 + 4 files changed, 69 insertions(+), 33 deletions(-) New commits: commit 97715aacd8aa32bbd0fd4e0a3fa0bdb8e7fbeaa5 Author: Luboš Luňák AuthorDate: Thu Sep 22 10:34:04 2022 +0200 Commit: Caolán McNamara CommitDate: Wed Oct 5 09:52:25 2022 +0200 make sure SharedString::EMPTY_STRING is interned in pools (tdf#150647) Without this, it may not actually be there, so interning "" would use a different string instance, and then comparing with SharedString::getEmptyString() would actually compare non-equal. Change-Id: I22660f63aa321e3a8f72cfb96df1db56e08fbb84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140402 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit e47e0cb0ad1dc3554e9b57f8562a217cf785edbf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140497 Reviewed-by: Xisco Fauli (cherry picked from commit 84dae47863f3367308cf1c5f80d45a43c3ef) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140601 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx index ff270eef5aa6..6880fec2a101 100644 --- a/include/svl/sharedstringpool.hxx +++ b/include/svl/sharedstringpool.hxx @@ -53,8 +53,9 @@ public: */ void purge(); +// For unit tests. Note that an "empty" pool may contain some internal items, +// such as SharedString::getEmptyString(). size_t getCount() const; - size_t getCountIgnoreCase() const; }; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index db371c46ddc8..df937c50f2d3 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -380,6 +380,10 @@ void Test::testSharedStringPool() { m_pDoc->InsertTab(0, "foo"); +svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); +size_t extraCount = rPool.getCount(); // internal items such as SharedString::getEmptyString() +size_t extraCountIgnoreCase = rPool.getCountIgnoreCase(); + // Strings that are identical. m_pDoc->SetString(ScAddress(0,0,0), "Andy"); // A1 m_pDoc->SetString(ScAddress(0,1,0), "Andy"); // A2 @@ -417,40 +421,39 @@ void Test::testSharedStringPool() } // Check the string counts after purging. Purging shouldn't remove any strings in this case. -svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(5), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(5+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A1 and purge again. clearRange(m_pDoc, ScAddress(0,0,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(5), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(5+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A2 and purge again. clearRange(m_pDoc, ScAddress(0,1,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(4), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(4+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A3 and purge again. clearRange(m_pDoc, ScAddress(0,2,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(3), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(3+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A4 and purge again. clearRange(m_pDoc, ScAddress(0,3,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(1), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(1), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(1+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(1+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A5 and the pool should be completely empty. clearRange(m_pDoc, ScAddress(0,4,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Now, compare string and edit text cells. m_pDoc->SetString(ScAddress(0,0,0), "Andy and Bruce"); // A1 diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/inc sc/source
sc/inc/table.hxx |8 sc/source/core/data/table4.cxx |8 2 files changed, 12 insertions(+), 4 deletions(-) New commits: commit c21ba00a93cd02e322fd28af50af1fb1930bac48 Author: Luboš Luňák AuthorDate: Thu Sep 29 14:22:00 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Oct 3 10:55:35 2022 +0200 introduce ScTable::GetColumnData() (tdf#151182) This is intended to handle possibly unallocated columns similarly to CreateColumnIfNotExists(), but unlike that one this one does not allocate, if the column is not allocated then the default column data is returned. This is intended for reading of columns. Change-Id: Ic3b637eb3d16bac69ebc7ecd389973407db4f7fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140737 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 305443d59a0fa579fe05b749d0891e63675d7050) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140613 Reviewed-by: Xisco Fauli diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 35388b54ea1f..7403b36780f1 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -294,6 +294,14 @@ public: } // out-of-line the cold part of the function void CreateColumnIfNotExistsImpl( const SCCOL nScCol ); + +ScColumnData& GetColumnData( SCCOL nCol ) +{ +if( nCol >= aCol.size()) +return aDefaultColData; +return aCol[nCol]; +} + sal_uInt64 GetCellCount() const; sal_uInt64 GetWeightedCount() const; sal_uInt64 GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const; diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 41250d5e2871..8ec1512136e7 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -910,9 +910,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( bGetPattern ) { if (bVertical) // rInner&:=nRow, rOuter&:=nCol -pSrcPattern = aCol[nCol].GetPattern(static_cast(nAtSrc)); +pSrcPattern = GetColumnData(nCol).GetPattern(static_cast(nAtSrc)); else// rInner&:=nCol, rOuter&:=nRow -pSrcPattern = aCol[nAtSrc].GetPattern(static_cast(nRow)); +pSrcPattern = GetColumnData(nAtSrc).GetPattern(static_cast(nRow)); bGetPattern = false; pStyleSheet = pSrcPattern->GetStyleSheet(); // do transfer ATTR_MERGE / ATTR_MERGE_FLAG @@ -1894,7 +1894,7 @@ void ScTable::FillAutoSimple( return; } const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType( -aCol[rCol].GetNumberFormat( rDocument.GetNonThreadedContext(), nSource)); +GetColumnData(rCol).GetNumberFormat( rDocument.GetNonThreadedContext(), nSource)); bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); bPercentCell = (nFormatType == SvNumFormatType::PERCENT); @@ -1903,7 +1903,7 @@ void ScTable::FillAutoSimple( { aSrcCell = GetCellValue(nSource, rRow); const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType( -aCol[nSource].GetNumberFormat( rDocument.GetNonThreadedContext(), rRow)); +GetColumnData(nSource).GetNumberFormat( rDocument.GetNonThreadedContext(), rRow)); bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); bPercentCell = (nFormatType == SvNumFormatType::PERCENT); }
[Libreoffice-commits] core.git: sc/inc sc/source
sc/inc/table.hxx |8 sc/source/core/data/table4.cxx |8 2 files changed, 12 insertions(+), 4 deletions(-) New commits: commit 1c53f5b6647dcffa57012990d342b21eaff19888 Author: Luboš Luňák AuthorDate: Thu Sep 29 14:22:00 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 29 16:19:18 2022 +0200 introduce ScTable::GetColumnData() (tdf#151182) This is intended to handle possibly unallocated columns similarly to CreateColumnIfNotExists(), but unlike that one this one does not allocate, if the column is not allocated then the default column data is returned. This is intended for reading of columns. Change-Id: Ic3b637eb3d16bac69ebc7ecd389973407db4f7fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140737 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 4d4e7a2f7830..a9d2ad71bd39 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -294,6 +294,14 @@ public: } // out-of-line the cold part of the function void CreateColumnIfNotExistsImpl( const SCCOL nScCol ); + +ScColumnData& GetColumnData( SCCOL nCol ) +{ +if( nCol >= aCol.size()) +return aDefaultColData; +return aCol[nCol]; +} + sal_uInt64 GetCellCount() const; sal_uInt64 GetWeightedCount() const; sal_uInt64 GetWeightedCount(SCROW nStartRow, SCROW nEndRow) const; diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx index 6cf97e5d9caf..77f17feaa8f3 100644 --- a/sc/source/core/data/table4.cxx +++ b/sc/source/core/data/table4.cxx @@ -910,9 +910,9 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if ( bGetPattern ) { if (bVertical) // rInner&:=nRow, rOuter&:=nCol -pSrcPattern = aCol[nCol].GetPattern(static_cast(nAtSrc)); +pSrcPattern = GetColumnData(nCol).GetPattern(static_cast(nAtSrc)); else// rInner&:=nCol, rOuter&:=nRow -pSrcPattern = aCol[nAtSrc].GetPattern(static_cast(nRow)); +pSrcPattern = GetColumnData(nAtSrc).GetPattern(static_cast(nRow)); bGetPattern = false; pStyleSheet = pSrcPattern->GetStyleSheet(); // do transfer ATTR_MERGE / ATTR_MERGE_FLAG @@ -1894,7 +1894,7 @@ void ScTable::FillAutoSimple( return; } const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType( -aCol[rCol].GetNumberFormat( rDocument.GetNonThreadedContext(), nSource)); +GetColumnData(rCol).GetNumberFormat( rDocument.GetNonThreadedContext(), nSource)); bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); bPercentCell = (nFormatType == SvNumFormatType::PERCENT); @@ -1903,7 +1903,7 @@ void ScTable::FillAutoSimple( { aSrcCell = GetCellValue(nSource, rRow); const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType( -aCol[nSource].GetNumberFormat( rDocument.GetNonThreadedContext(), rRow)); +GetColumnData(nSource).GetNumberFormat( rDocument.GetNonThreadedContext(), rRow)); bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL); bPercentCell = (nFormatType == SvNumFormatType::PERCENT); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - include/svl sc/qa svl/qa svl/source
include/svl/sharedstringpool.hxx |3 + sc/qa/unit/ucalc.cxx | 29 --- svl/qa/unit/svl.cxx | 67 +-- svl/source/misc/sharedstringpool.cxx |3 + 4 files changed, 69 insertions(+), 33 deletions(-) New commits: commit 66ebf61975a5d8d860eda5e661c5a82a9ca763b7 Author: Luboš Luňák AuthorDate: Thu Sep 22 10:34:04 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 26 12:36:23 2022 +0200 make sure SharedString::EMPTY_STRING is interned in pools (tdf#150647) Without this, it may not actually be there, so interning "" would use a different string instance, and then comparing with SharedString::getEmptyString() would actually compare non-equal. Change-Id: I22660f63aa321e3a8f72cfb96df1db56e08fbb84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140402 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit e47e0cb0ad1dc3554e9b57f8562a217cf785edbf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140498 Reviewed-by: Xisco Fauli diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx index ff270eef5aa6..6880fec2a101 100644 --- a/include/svl/sharedstringpool.hxx +++ b/include/svl/sharedstringpool.hxx @@ -53,8 +53,9 @@ public: */ void purge(); +// For unit tests. Note that an "empty" pool may contain some internal items, +// such as SharedString::getEmptyString(). size_t getCount() const; - size_t getCountIgnoreCase() const; }; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 1e7cde76d9f0..a5cdebe12569 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -400,6 +400,10 @@ void Test::testSharedStringPool() { m_pDoc->InsertTab(0, "foo"); +svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); +size_t extraCount = rPool.getCount(); // internal items such as SharedString::getEmptyString() +size_t extraCountIgnoreCase = rPool.getCountIgnoreCase(); + // Strings that are identical. m_pDoc->SetString(ScAddress(0,0,0), "Andy"); // A1 m_pDoc->SetString(ScAddress(0,1,0), "Andy"); // A2 @@ -437,40 +441,39 @@ void Test::testSharedStringPool() } // Check the string counts after purging. Purging shouldn't remove any strings in this case. -svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(5), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(5+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A1 and purge again. clearRange(m_pDoc, ScAddress(0,0,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(5), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(5+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A2 and purge again. clearRange(m_pDoc, ScAddress(0,1,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(4), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(4+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A3 and purge again. clearRange(m_pDoc, ScAddress(0,2,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(3), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(3+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A4 and purge again. clearRange(m_pDoc, ScAddress(0,3,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(1), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(1), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(1+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(1+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A5 and the pool should be completely empty. clearRange(m_pDoc, ScAddress(0,4,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Now, compare string and edit text cells. m_pDoc->SetString(ScAddress(0,0,0), "Andy and Bruce"); // A1 diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 523e998c60c1..9b7c78ebe062 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -48,6 +48,15 @@ static std::ostream& operator<<(std::ostream& rStrm, const Color& rColor) return rStrm; } +namespace svl +{
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - include/svl sc/qa svl/qa svl/source
include/svl/sharedstringpool.hxx |3 + sc/qa/unit/ucalc.cxx | 29 --- svl/qa/unit/svl.cxx | 67 +-- svl/source/misc/sharedstringpool.cxx |3 + 4 files changed, 69 insertions(+), 33 deletions(-) New commits: commit 15d1660ef04492bfffe4fd30d7c1942499d44f0c Author: Luboš Luňák AuthorDate: Thu Sep 22 10:34:04 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Sep 26 12:35:28 2022 +0200 make sure SharedString::EMPTY_STRING is interned in pools (tdf#150647) Without this, it may not actually be there, so interning "" would use a different string instance, and then comparing with SharedString::getEmptyString() would actually compare non-equal. Change-Id: I22660f63aa321e3a8f72cfb96df1db56e08fbb84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140402 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit e47e0cb0ad1dc3554e9b57f8562a217cf785edbf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140497 Reviewed-by: Xisco Fauli diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx index ff270eef5aa6..6880fec2a101 100644 --- a/include/svl/sharedstringpool.hxx +++ b/include/svl/sharedstringpool.hxx @@ -53,8 +53,9 @@ public: */ void purge(); +// For unit tests. Note that an "empty" pool may contain some internal items, +// such as SharedString::getEmptyString(). size_t getCount() const; - size_t getCountIgnoreCase() const; }; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index db371c46ddc8..df937c50f2d3 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -380,6 +380,10 @@ void Test::testSharedStringPool() { m_pDoc->InsertTab(0, "foo"); +svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); +size_t extraCount = rPool.getCount(); // internal items such as SharedString::getEmptyString() +size_t extraCountIgnoreCase = rPool.getCountIgnoreCase(); + // Strings that are identical. m_pDoc->SetString(ScAddress(0,0,0), "Andy"); // A1 m_pDoc->SetString(ScAddress(0,1,0), "Andy"); // A2 @@ -417,40 +421,39 @@ void Test::testSharedStringPool() } // Check the string counts after purging. Purging shouldn't remove any strings in this case. -svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(5), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(5+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A1 and purge again. clearRange(m_pDoc, ScAddress(0,0,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(5), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(5+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A2 and purge again. clearRange(m_pDoc, ScAddress(0,1,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(4), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(4+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A3 and purge again. clearRange(m_pDoc, ScAddress(0,2,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(3), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(3+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A4 and purge again. clearRange(m_pDoc, ScAddress(0,3,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(1), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(1), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(1+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(1+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A5 and the pool should be completely empty. clearRange(m_pDoc, ScAddress(0,4,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Now, compare string and edit text cells. m_pDoc->SetString(ScAddress(0,0,0), "Andy and Bruce"); // A1 diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index f125305783c5..19a8c2b3baab 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -48,6 +48,15 @@ static std::ostream& operator<<(std::ostream& rStrm, const Color& rColor) return rStrm; } +namespace svl +{
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sc/inc
sc/inc/document.hxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 2a0ea9c49084e31e5ef01bd824be53882e97f4a7 Author: Luboš Luňák AuthorDate: Mon May 9 11:10:43 2022 +0200 Commit: Szymon Kłos CommitDate: Sun Sep 25 21:18:30 2022 +0200 make ScDocument::FetchTable() public I don't see why it should be private, it's range checked, so there should be no harm. Especially when a number of classes get declared as friends to get access to it anyway. Change-Id: I333d749aa9d09aaf9dcbabf43d67a67d1257a132 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134051 Tested-by: Jenkins Reviewed-by: Luboš Luňák Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139471 Tested-by: Jenkins CollaboraOffice diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 1c26604a4fb5..4f06b4b6473b 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -2655,9 +2655,6 @@ private: ScDocument& mrDoc; }; -ScTable* FetchTable( SCTAB nTab ); -const ScTable* FetchTable( SCTAB nTab ) const; - voidMergeNumberFormatter(const ScDocument& rSrcDoc); voidImplCreateOptions(); // Suggestion: switch to on-demand? @@ -2682,6 +2679,9 @@ private: boolHasPartOfMerged( const ScRange& rRange ); public: +ScTable* FetchTable( SCTAB nTab ); +const ScTable* FetchTable( SCTAB nTab ) const; + ScRefCellValue GetRefCellValue( const ScAddress& rPos ); private: ScRefCellValue GetRefCellValue( const ScAddress& rPos, sc::ColumnBlockPosition& rBlockPos );
[Libreoffice-commits] core.git: include/svl sc/qa svl/qa svl/source
include/svl/sharedstringpool.hxx |3 + sc/qa/unit/ucalc.cxx | 13 -- svl/qa/unit/svl.cxx | 67 +-- svl/source/misc/sharedstringpool.cxx |3 + 4 files changed, 61 insertions(+), 25 deletions(-) New commits: commit e47e0cb0ad1dc3554e9b57f8562a217cf785edbf Author: Luboš Luňák AuthorDate: Thu Sep 22 10:34:04 2022 +0200 Commit: Eike Rathke CommitDate: Fri Sep 23 11:51:24 2022 +0200 make sure SharedString::EMPTY_STRING is interned in pools (tdf#150647) Without this, it may not actually be there, so interning "" would use a different string instance, and then comparing with SharedString::getEmptyString() would actually compare non-equal. Change-Id: I22660f63aa321e3a8f72cfb96df1db56e08fbb84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140402 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/include/svl/sharedstringpool.hxx b/include/svl/sharedstringpool.hxx index ff270eef5aa6..6880fec2a101 100644 --- a/include/svl/sharedstringpool.hxx +++ b/include/svl/sharedstringpool.hxx @@ -53,8 +53,9 @@ public: */ void purge(); +// For unit tests. Note that an "empty" pool may contain some internal items, +// such as SharedString::getEmptyString(). size_t getCount() const; - size_t getCountIgnoreCase() const; }; } diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index a63519f41224..d821a146eef8 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -383,6 +383,10 @@ void Test::testSharedStringPool() { m_pDoc->InsertTab(0, "foo"); +svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); +size_t extraCount = rPool.getCount(); // internal items such as SharedString::getEmptyString() +size_t extraCountIgnoreCase = rPool.getCountIgnoreCase(); + // Strings that are identical. m_pDoc->SetString(ScAddress(0,0,0), "Andy"); // A1 m_pDoc->SetString(ScAddress(0,1,0), "Andy"); // A2 @@ -420,10 +424,9 @@ void Test::testSharedStringPool() } // Check the string counts after purging. Purging shouldn't remove any strings in this case. -svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(5), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(2), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(5+extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(2+extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Clear A1 clearRange(m_pDoc, ScAddress(0,0,0)); @@ -436,8 +439,8 @@ void Test::testSharedStringPool() // Clear A5 and the pool should be completely empty. clearRange(m_pDoc, ScAddress(0,4,0)); rPool.purge(); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCount()); -CPPUNIT_ASSERT_EQUAL(static_cast(0), rPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL(extraCount, rPool.getCount()); +CPPUNIT_ASSERT_EQUAL(extraCountIgnoreCase, rPool.getCountIgnoreCase()); // Now, compare string and edit text cells. m_pDoc->SetString(ScAddress(0,0,0), "Andy and Bruce"); // A1 diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 7476ac339bdd..88add0a71793 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -48,6 +48,15 @@ static std::ostream& operator<<(std::ostream& rStrm, const Color& rColor) return rStrm; } +namespace svl +{ +static std::ostream& operator<<(std::ostream& rStrm, const SharedString& string ) +{ +return rStrm << "(" << static_cast(string.getData()) << ")" << string.getString(); +} +} + + namespace { class Test : public CppUnit::TestFixture { @@ -62,6 +71,7 @@ public: void testSharedStringPool(); void testSharedStringPoolPurge(); void testSharedStringPoolPurgeBug1(); +void testSharedStringPoolEmptyString(); void testFdo60915(); void testI116701(); void testTdf103060(); @@ -80,6 +90,7 @@ public: CPPUNIT_TEST(testSharedStringPool); CPPUNIT_TEST(testSharedStringPoolPurge); CPPUNIT_TEST(testSharedStringPoolPurgeBug1); +CPPUNIT_TEST(testSharedStringPoolEmptyString); CPPUNIT_TEST(testFdo60915); CPPUNIT_TEST(testI116701); CPPUNIT_TEST(testTdf103060); @@ -363,18 +374,21 @@ void Test::testSharedStringPoolPurge() { SvtSysLocale aSysLocale; svl::SharedStringPool aPool(aSysLocale.GetCharClass()); +size_t extraCount = aPool.getCount(); // internal items such as SharedString::getEmptyString() +size_t extraCountIgnoreCase = aPool.getCountIgnoreCase(); + aPool.intern("Andy"); aPool.intern("andy"); aPool.intern("ANDY"); -CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong string count.", static_cast(3), aPool.getCount()); -CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong case insensitive string count.", static_cast(1), aPool.getCountIgnoreCase()); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong string count.", 3+extraCount, aPool.getCount()); +
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx | 1046 ++- 1 file changed, 225 insertions(+), 821 deletions(-) New commits: commit e301b61fd4c5005418c5aef255c3cad424f4f72b Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:45 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:07:31 2022 +0200 reduce excessive code repetition when matching opcode in opencl I.e. use "ugly" macros to make code more nice. Change-Id: I053dd2313c140dbc6b25073d67155a1284c6b310 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140398 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 5920b50ca402..9c36b701cfa8 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -2184,491 +2184,6 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, throw UnhandledToken(("unhandled operand " + StackVarEnumToString(pChild->GetType()) + " for ocPush").c_str(), __FILE__, __LINE__); } break; -case ocDiv: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocMul: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocSub: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocAdd: -case ocSum: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocAverage: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocAverageA: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocMin: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocMinA: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocMax: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocMaxA: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocCount: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocCount2: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(nResultSize), nResultSize)); -break; -case ocSumProduct: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocIRR: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocMIRR: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocPMT: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocRate: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocRRI: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocPpmt: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocFisher: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocFisherInv: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); -break; -case ocGamma: -
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx |4 -- sc/source/core/opencl/op_statistical.cxx | 59 --- sc/source/core/opencl/op_statistical.hxx |6 --- 3 files changed, 69 deletions(-) New commits: commit 1af18947bfd0d6a9c318bfafd5c5d73c23266d45 Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:36 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:06:57 2022 +0200 drop opencl implementation of MEDIAN() Input data to this function is not required to be sorted, so implementing this would mean sorting it in opencl, which is not exactly trivial and not worth the effort. There also exist algorithms that find the median without sorting an array, but they work by guessing it and looping until their guess is right, so again, not worth the trouble. I'd say there's nothing to be gained here from using opencl. Change-Id: Ic6d6efdfc59b9058bdae50d07d8039db481dfb75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140397 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 967f52c4ce43..5920b50ca402 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -2344,10 +2344,6 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocMedian: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i],std::make_sharedChildren[i], std::make_shared(), nResultSize)); diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index fd28dc2fcf94..4c79d162e62c 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -804,65 +804,6 @@ void OpNormsinv:: GenSlidingWindowFunction ss << "}\n"; } -void OpMedian::GenSlidingWindowFunction( -outputstream , const std::string , -SubArguments ) -{ -GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n"; -ss << "int gid0 = get_global_id(0);\n"; -ss << "double tmp = 0;\n"; -ss << "int i;\n"; -ss << "unsigned int startFlag = 0;\n"; -ss << "unsigned int endFlag = 0;\n"; -ss << "double dataIna;\n"; -for (const DynamicKernelArgumentRef & rArg : vSubArguments) -{ -FormulaToken *pCur = rArg->GetFormulaToken(); -assert(pCur); -if (const formula::DoubleVectorRefToken* pCurDVR = -dynamic_cast(pCur)) -{ -size_t nCurWindowSize = pCurDVR->GetRefRowSize(); -ss << "startFlag = "; -if (!pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed()) -{ -ss << "gid0; endFlag = "<< nCurWindowSize <<"-gid0;\n"; -} -ss << "gid0; endFlag = gid0+"<< nCurWindowSize <<";\n"; -} -else -{ -ss<<"startFlag=gid0;endFlag=gid0;\n"; -} -} -FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken(); -const formula::DoubleVectorRefToken*tmpCurDVR0= static_cast(tmpCur0); -ss << "int buffer_fIna_len = "; -ss << tmpCurDVR0->GetArrayLength(); -ss << ";\n"; -ss<<"if((i+gid0)>=buffer_fIna_len || isnan("; -ss << vSubArguments[0]->GenSlidingWindowDeclRef(); -ss<<"))\n"; -ss<<"dataIna = 0;\n"; -ss << "int nSize =endFlag- startFlag ;\n"; -ss << "if (nSize & 1)\n"; -ss << "{\n"; -ss << "tmp = "GetName(); -ss << "[startFlag+nSize/2-1])/2;\n"; -ss << "}\n"; -ss <<" return tmp;\n"; -ss << "}\n"; -} - void OpLogInv::BinInlineFun(std::set& decls, std::set& funs) { diff --git a/sc/source/core/opencl/op_statistical.hxx b/sc/source/core/opencl/op_statistical.hxx index 2741efe49656..827c6a0456af 100644 --- a/sc/source/core/opencl/op_statistical.hxx +++ b/sc/source/core/opencl/op_statistical.hxx @@ -149,12 +149,6 @@ class OpNormdist:public Normal{ const std::string , SubArguments ) override; virtual std::string BinFuncName() const override { return "OpNormdist"; } }; -class OpMedian:public Normal{ -public: -virtual void GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) override; -virtual std::string BinFuncName() const override { return "OpMedian"; } -}; class OpNormsdist:public Normal{ public: virtual void GenSlidingWindowFunction(outputstream ,
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_financial.cxx | 158 +++--- sc/source/core/opencl/op_financial_helpers.hxx | 650 ++--- 2 files changed, 132 insertions(+), 676 deletions(-) New commits: commit e0061a955ee2efed28c1632e06e44f1318c7878d Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:32 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:06:39 2022 +0200 remove unused or duplicated opencl helper functions These mostly exist in "old" and _new variants which are more or less the same, sometimes there are minor differences. Keep just the _new ones, everything still seems to work, all tests pass. Change-Id: I903ea3f11bad6c5e1301febe03974469eb414368 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140396 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index c3b5861a5fcf..6ab2874dc78b 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -99,9 +99,9 @@ void OpDollarfr::GenSlidingWindowFunction(outputstream , void OpDISC::BinInlineFun(std::set& decls, std::set& funs) { -decls.insert(GetYearFrac_newDecl);decls.insert(DaysToDate_newDecl); +decls.insert(GetYearFracDecl);decls.insert(DaysToDateDecl); decls.insert(DaysInMonthDecl);decls.insert(IsLeapYearDecl); -funs.insert(GetYearFrac_new);funs.insert(DaysToDate_new); +funs.insert(GetYearFrac);funs.insert(DaysToDate); funs.insert(DaysInMonth);funs.insert(IsLeapYear); } @@ -121,7 +121,7 @@ void OpDISC::GenSlidingWindowFunction(outputstream& ss, ss << "int nNullDate = 693594;\n"; ss << "tmp = 1.0 - arg2 / arg3;\n"; ss << "tmp /="; -ss << " GetYearFrac_new(nNullDate, (int)arg0, (int)arg1, (int)arg4);\n"; +ss << " GetYearFrac(nNullDate, (int)arg0, (int)arg1, (int)arg4);\n"; ss << "return tmp;\n"; ss << "}"; } @@ -129,12 +129,12 @@ void OpDISC::GenSlidingWindowFunction(outputstream& ss, void OpINTRATE::BinInlineFun(std::set& decls, std::set& funs) { -decls.insert(GetYearDiff_newDecl);decls.insert(GetDiffDate_newDecl); -decls.insert(DaysToDate_newDecl);decls.insert(GetNullDateDecl); +decls.insert(GetYearDiffDecl);decls.insert(GetDiffDateDecl); +decls.insert(DaysToDateDecl);decls.insert(GetNullDateDecl); decls.insert(DateToDaysDecl);decls.insert(DaysInMonthDecl); decls.insert(IsLeapYearDecl); -funs.insert(GetYearDiff_new);funs.insert(GetDiffDate_new); -funs.insert(DaysToDate_new);funs.insert(GetNullDate); +funs.insert(GetYearDiff);funs.insert(GetDiffDate); +funs.insert(DaysToDate);funs.insert(GetNullDate); funs.insert(DateToDays);funs.insert(DaysInMonth); funs.insert(IsLeapYear); } @@ -153,7 +153,7 @@ void OpINTRATE::GenSlidingWindowFunction(outputstream& ss, GenerateArg( 3, vSubArguments, ss ); GenerateArg( 4, vSubArguments, ss ); ss << "int nNullDate = GetNullDate();\n"; -ss << "tmp = ((arg3 / arg2) - 1) / GetYearDiff_new(nNullDate, (int)arg0,"; +ss << "tmp = ((arg3 / arg2) - 1) / GetYearDiff(nNullDate, (int)arg0,"; ss << " (int)arg1,(int)arg4);\n"; ss << "return tmp;\n"; ss << "}"; @@ -289,12 +289,12 @@ void OpDuration_ADD::GenSlidingWindowFunction(outputstream& ss, void OpMDuration::BinInlineFun(std::set& decls, std::set& funs) { -decls.insert(GetDuration_newDecl);decls.insert(lcl_Getcoupnum_newDecl); +decls.insert(GetDurationDecl);decls.insert(lcl_GetcoupnumDecl); decls.insert(addMonthsDecl);decls.insert(checklessthanDecl); decls.insert(setDayDecl);decls.insert(ScaDateDecl); decls.insert(GetYearFracDecl);decls.insert(DaysToDateDecl); decls.insert(DaysInMonthDecl);decls.insert(IsLeapYearDecl); -funs.insert(GetDuration_new);funs.insert(lcl_Getcoupnum_new); +funs.insert(GetDuration);funs.insert(lcl_Getcoupnum); funs.insert(addMonths);funs.insert(checklessthan); funs.insert(setDay);funs.insert(ScaDate); funs.insert(GetYearFrac);funs.insert(DaysToDate); @@ -316,7 +316,7 @@ void OpMDuration::GenSlidingWindowFunction(outputstream& ss, GenerateArg( 4, vSubArguments, ss ); GenerateArg( 5, vSubArguments, ss ); ss << "int nNullDate = 693594;\n"; -ss << "tmp = GetDuration_new( nNullDate, (int)arg0, (int)arg1, arg2,"; +ss << "tmp = GetDuration( nNullDate, (int)arg0, (int)arg1, arg2,"; ss << " arg3, (int)arg4, (int)arg5);\n"; ss << "tmp = tmp * pow(1.0 + arg3 * pow((int)arg4, -1.0), -1);\n"; ss << "return tmp;\n"; @@ -712,10 +712,10 @@ void OpAccrintm::GenSlidingWindowFunction( ss << "}"; } - void OpYield::BinInlineFun(std::set& decls, +void OpYield::BinInlineFun(std::set& decls, std::set& funs) { -decls.insert(getYield_Decl);decls.insert(getPrice_Decl); +decls.insert(getYield_Decl);decls.insert(getPriceDecl);
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx | 213 +++--- sc/source/core/opencl/op_math.cxx | 30 +++- sc/source/core/opencl/op_math.hxx | 12 + sc/source/core/opencl/op_math_helpers.hxx | 16 ++ sc/source/core/opencl/opbase.cxx | 78 ++ sc/source/core/opencl/opbase.hxx | 26 ++- 6 files changed, 256 insertions(+), 119 deletions(-) New commits: commit 78c6e9efa8572fb8a681f562d057db8bef35c571 Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:27 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:06:13 2022 +0200 fix handling of string arguments in opencl As one of the code comments said the code used string hashes to represent strings and this was a broken idea. But the basic idea of that is actually valid, so just implement that properly and use it only for comparing strings. See the code comment in opbase.cxx for technical details. Change-Id: I113d6b4d5e1e78bbe2c05aafc0572605e2595ad8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140395 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 4f274749484b..967f52c4ce43 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -299,73 +299,8 @@ size_t VectorRef::Marshal( cl_kernel k, int argno, int, cl_program ) return 1; } -/// Arguments that are actually compile-time constant string -/// Currently, only the hash is passed. -/// TBD(IJSUNG): pass also length and the actual string if there is a -/// hash function collision - -/// FIXME: This idea of passing of hashes of uppercased strings into OpenCL code is fairly potent -/// crack. It is hopefully not used at all any more, but noticing that there are string arguments -/// automatically disables use of OpenCL for a formula group. If at some point there are resources -/// to drain the OpenCL swamp, this should go away. - namespace { -class ConstStringArgument : public DynamicKernelArgument -{ -public: -ConstStringArgument( const ScCalcConfig& config, const std::string& s, -const FormulaTreeNodeRef& ft ) : -DynamicKernelArgument(config, s, ft) { } -/// Generate declaration -virtual void GenDecl( outputstream& ss ) const override -{ -ss << "unsigned " << mSymName; -} -virtual void GenDeclRef( outputstream& ss ) const override -{ -ss << GenSlidingWindowDeclRef(); -} -virtual void GenSlidingWindowDecl( outputstream& ss ) const override -{ -GenDecl(ss); -} -virtual std::string GenSlidingWindowDeclRef( bool = false ) const override -{ -outputstream ss; -if (GetFormulaToken()->GetType() != formula::svString) -throw Unhandled(__FILE__, __LINE__); -FormulaToken* Tok = GetFormulaToken(); -ss << Tok->GetString().getString().toAsciiUpperCase().hashCode() << "U"; -return ss.str(); -} -virtual size_t GetWindowSize() const override -{ -return 1; -} -/// Pass the 32-bit hash of the string to the kernel -virtual size_t Marshal( cl_kernel k, int argno, int, cl_program ) override -{ -OpenCLZone zone; -FormulaToken* ref = mFormulaTree->GetFormulaToken(); -cl_uint hashCode = 0; -if (ref->GetType() != formula::svString) -{ -throw Unhandled(__FILE__, __LINE__); -} - -const OUString s = ref->GetString().getString().toAsciiUpperCase(); -hashCode = s.hashCode(); - -// Pass the scalar result back to the rest of the formula kernel -SAL_INFO("sc.opencl", "Kernel " << k << " arg " << argno << ": cl_uint: " << hashCode << "(" << DebugPeekData(ref) << ")" ); -cl_int err = clSetKernelArg(k, argno, sizeof(cl_uint), static_cast()); -if (CL_SUCCESS != err) -throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__); -return 1; -} -}; - class DynamicKernelPiArgument : public DynamicKernelArgument { public: @@ -773,9 +708,65 @@ threefry2x32 (threefry2x32_ctr_t in, threefry2x32_key_t k)\n\ } }; -} +// Arguments that are actually compile-time constant string +class ConstStringArgument : public DynamicKernelArgument +{ +public: +ConstStringArgument( const ScCalcConfig& config, const std::string& s, +const FormulaTreeNodeRef& ft ) : +DynamicKernelArgument(config, s, ft) { } +/// Generate declaration +virtual void GenDecl( outputstream& ss ) const override +{ +ss << "double " << mSymName; +} +virtual void GenDeclRef( outputstream& ss ) const override +{ +ss << GenSlidingWindowDeclRef(); +} +virtual void GenSlidingWindowDecl( outputstream& ss ) const override +{ +GenDecl(ss); +} +virtual std::string GenSlidingWindowDeclRef( bool = false ) const
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math.cxx | 13 +++-- 1 file changed, 3 insertions(+), 10 deletions(-) New commits: commit 87e4520fdb661309da732c25a7ad58c7efd52a90 Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:22 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:01:17 2022 +0200 fix and simplify ocInt in opencl This is what core does, it also extends the range (the casting to int variant limited to the range of the int, which the core variant doesn't). Change-Id: Ib93bc57b38c0927f9732742d116d0f40700a0abb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140394 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 481e5d14c6a4..1bf3e231b4a2 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -222,20 +222,13 @@ void OpInt::BinInlineFun(std::set& decls, { decls.insert(is_representable_integerDecl); funs.insert(is_representable_integer); -decls.insert(approx_equalDecl); -funs.insert(approx_equal); +decls.insert(value_approxDecl); +funs.insert(value_approx); } void OpInt::GenerateCode( outputstream& ss ) const { -ss << "int intTmp = (int)arg0;\n"; -// check whether rounding error caused the float to be just less than the int value -ss << "if( arg0 >=0 && approx_equal( intTmp + 1, arg0 ))\n"; -ss << "++intTmp;\n"; -// negative values are rounded down -ss << "if( arg0 < 0 && !approx_equal( intTmp, arg0 ))\n"; -ss << "--intTmp;\n"; -ss << "return intTmp;\n"; +ss << "return floor( value_approx( arg0 ));\n"; } void OpNegSub::GenerateCode( outputstream& ss ) const
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math.cxx | 27 --- sc/source/core/opencl/op_math.hxx | 14 +- 2 files changed, 5 insertions(+), 36 deletions(-) New commits: commit 799bde0490f2bcd0562e2c9a8d08709b472417b2 Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:18 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:00:51 2022 +0200 make ocTrunc and ocRoundDown the same in opencl It's that way in core too. Change-Id: Ic1100ed637a310b8073256b95a261023b32df827 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140373 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 5e88f8f67a8e..481e5d14c6a4 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1169,33 +1169,6 @@ void OpSumIf::GenSlidingWindowFunction(outputstream , ss << "}"; } -void OpTrunc::GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) -{ -CHECK_PARAMETER_COUNT( 1, 2 ); -GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n"; -ss << "int gid0=get_global_id(0);\n"; -GenerateArg( "arg0", 0, vSubArguments, ss ); -GenerateArgWithDefault( "arg1", 1, 0, vSubArguments, ss ); -ss << "double argm = arg0;\n"; -ss << "int n = (int)arg1;\n"; -ss << "double nn = 1.0f;\n"; -ss << "for(int i = 0; i < n; ++i)\n"; -ss << "{\n"; -ss << "argm = argm * 10;\n"; -ss << "nn = nn * 10;\n"; -ss << "}\n"; -ss << "for(int i = 0; i > n; --i)\n"; -ss << "{\n"; -ss << "argm = argm / 10;\n"; -ss << "nn = nn / 10;\n"; -ss << "}\n"; -ss << "modf(argm, );\n"; -ss << "return argm / nn;\n"; -ss << "}\n"; -} - void OpFloor::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index a5adec2cb8aa..8ffe1ee779e5 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -177,15 +177,6 @@ public: virtual void GenerateCode( outputstream& ss ) const override; }; -class OpTrunc: public Normal -{ -public: -virtual void GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) override; - -virtual std::string BinFuncName() const override { return "Trunc"; } -}; - class OpArcTan2 : public OpMathTwoArguments { public: @@ -272,6 +263,11 @@ public: const std::string , SubArguments ) override; virtual std::string BinFuncName() const override { return "RoundDown"; } }; +class OpTrunc: public OpRoundDown +{ +public: +virtual std::string BinFuncName() const override { return "Trunc"; } +}; class OpInt: public OpMathOneArgument { public:
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/compiler.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 1c1195a09e62d37ad5cd93709d7e2b72466c22b3 Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:12 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:00:35 2022 +0200 ocAnd/ocOr are not actually binary operators They are listed in the SC_OPCODE_START_BIN_OP group, but AND(A1:A30) is fine. Change-Id: I397d1f8dc6bff450116dd46b6b1da7ffe447efb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140372 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index fc97ae0a6bf7..e310794d1297 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -6185,7 +6185,8 @@ bool ScCompiler::HandleIIOpCodeInternal(FormulaToken* token, FormulaToken*** ppp mPendingImplicitIntersectionOptimizations.emplace_back( pppToken[0], token ); return true; } -else if ((nOpCode >= SC_OPCODE_START_BIN_OP && nOpCode < SC_OPCODE_STOP_BIN_OP) +else if ((nOpCode >= SC_OPCODE_START_BIN_OP && nOpCode < SC_OPCODE_STOP_BIN_OP +&& nOpCode != ocAnd && nOpCode != ocOr) || nOpCode == ocRound || nOpCode == ocRoundUp || nOpCode == ocRoundDown) { if (nNumParams != 2)
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 9f884bc933be1bffd25ba9c7b3a3343f942ff5dc Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:09 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 18:00:16 2022 +0200 add SAL_INFO about which formula group will be interpreter by opencl It's actually not said anywhere in the otherwise extensive opencl debug output. Change-Id: I978239d045436c05457b1c0e3e00b672889b9279 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140371 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 90066abb3ff3..4f274749484b 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -3605,6 +3605,7 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc, const ScAddress& rTopPos, ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) { +SAL_INFO("sc.opencl", "Interpret cell group " << rTopPos); MergeCalcConfig(rDoc); genRPNTokens(rDoc, rTopPos, rCode);
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math.cxx | 34 +- sc/source/core/opencl/op_math.hxx |1 sc/source/core/opencl/op_math_helpers.hxx | 26 ++ 3 files changed, 47 insertions(+), 14 deletions(-) New commits: commit af5aaddee5e752fcb38cf1550d8152089443196e Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:05 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 17:59:53 2022 +0200 fix opencl ocMod Basically copied from core. Change-Id: Ic46e6ed77d1e75fcd4dfb8c641a8f592d577cab0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140370 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index cd2f2f8b5396..5e88f8f67a8e 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -391,23 +391,29 @@ void OpCombin::GenerateCode( outputstream& ss ) const ss << "return result;\n"; } +void OpMod::BinInlineFun(std::set& decls,std::set& funs) +{ +decls.insert(is_representable_integerDecl); +funs.insert(is_representable_integer); +decls.insert(approx_equalDecl); +funs.insert(approx_equal); +decls.insert(fsub_approxDecl); +funs.insert(fsub_approx); +decls.insert(value_approxDecl); +funs.insert(value_approx); +} + void OpMod::GenerateCode( outputstream& ss ) const { -ss << "if(isnan(arg0)||arg0 == 0)\n"; -ss << "return 0;\n"; -ss << "if(isnan(arg1) || arg1 ==0)\n"; +ss << "double fNum = arg0;\n"; +ss << "double fDenom = arg1;\n"; +ss << "if(fDenom == 0)\n"; ss << "return CreateDoubleError(DivisionByZero);\n"; -ss << "double tem;\n"; -ss << "if(arg0 < 0 && arg1 > 0)\n"; -ss << "while(arg0 < 0)\n"; -ss << "arg0 += arg1;\n"; -ss << "else if (arg0 > 0 && arg1 < 0)\n"; -ss << "while(arg0 > 0)\n"; -ss << "arg0 += arg1;\n"; -ss << "tem = fmod(arg0,arg1);\n"; -ss << "if(arg1 < 0 && tem > 0)\n"; -ss << "tem = -tem;\n"; -ss << "return tem;\n"; +ss << "double fRes = fsub_approx( fNum, floor( value_approx( fNum / fDenom )) * fDenom );\n"; +ss << "if ( ( fDenom > 0 && fRes >= 0 && fRes < fDenom ) ||\n"; +ss << " ( fDenom < 0 && fRes <= 0 && fRes > fDenom ) )\n"; +ss << "return fRes;\n"; +ss << "return CreateDoubleError(NoValue);\n"; } void OpPower::GenerateCode( outputstream& ss ) const diff --git a/sc/source/core/opencl/op_math.hxx b/sc/source/core/opencl/op_math.hxx index 9ff5253d0ad5..a5adec2cb8aa 100644 --- a/sc/source/core/opencl/op_math.hxx +++ b/sc/source/core/opencl/op_math.hxx @@ -405,6 +405,7 @@ class OpMod: public OpMathTwoArguments public: virtual std::string BinFuncName() const override { return "Mod"; } virtual void GenerateCode( outputstream& ss ) const override; +virtual void BinInlineFun(std::set& ,std::set& ) override; }; class OpProduct: public Normal diff --git a/sc/source/core/opencl/op_math_helpers.hxx b/sc/source/core/opencl/op_math_helpers.hxx index 015afcf547fb..6a751dd9c35b 100644 --- a/sc/source/core/opencl/op_math_helpers.hxx +++ b/sc/source/core/opencl/op_math_helpers.hxx @@ -163,4 +163,30 @@ const char fsub_approx[] = "return a - b;\n" "}\n"; +const char value_approxDecl[] = "double value_approx( double fValue );\n"; +const char value_approx[] = +"double value_approx( double fValue )\n" +"{\n" +"const double fBigInt = 219902322.0;\n" +"if (fValue == 0.0 || fValue == HUGE_VAL || !isfinite(fValue))\n" +"return fValue;\n" +"double fOrigValue = fValue;\n" +"fValue = fabs(fValue);\n" +"if (fValue > fBigInt)\n" +"return fOrigValue;\n" +"if (is_representable_integer(fValue))\n" // TODO? || getBitsInFracPart(fValue) <= 11)\n" +"return fOrigValue;\n" +"int nExp = (int)(floor(log10(fValue)));\n" +"nExp = 14 - nExp;\n" +"double fExpValue = pow(10.0,nExp);\n" +"fValue *= fExpValue;\n" +"if (!isfinite(fValue))\n" +"return fOrigValue;\n" +"fValue = round(fValue);\n" +"fValue /= fExpValue;\n" +"if (!isfinite(fValue))\n" +"return fOrigValue;\n" +"return copysign(fValue, fOrigValue);\n" +"}\n"; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math_helpers.hxx |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 43f2cdb3b41ff4f5e99500f0c0082d4bfa4bc97c Author: Luboš Luňák AuthorDate: Thu Sep 22 09:55:00 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 17:59:36 2022 +0200 fix incorrect as_double usage in opencl as_double interprets the binary representation, it is not a cast. Change-Id: I3034a36b84fbf458b8818af1e2255b532d21d229 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140369 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math_helpers.hxx b/sc/source/core/opencl/op_math_helpers.hxx index 81fb8f5a8541..015afcf547fb 100644 --- a/sc/source/core/opencl/op_math_helpers.hxx +++ b/sc/source/core/opencl/op_math_helpers.hxx @@ -117,12 +117,12 @@ const char is_representable_integerDecl[] = "int is_representable_integer(doubl const char is_representable_integer[] = "int is_representable_integer(double a) {\n" "long kMaxInt = (1L << 53) - 1;\n" -"if (a <= as_double(kMaxInt))\n" +"if (a <= (double)kMaxInt)\n" "{\n" -"long nInt = as_long(a);\n" +"long nInt = (long)a;\n" "double fInt;\n" "return (nInt <= kMaxInt &&\n" -"(!((fInt = as_double(nInt)) < a) && !(fInt > a)));\n" +"(!((fInt = (double)nInt) < a) && !(fInt > a)));\n" "}\n" "return 0;\n" "}\n";
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/formulagroupcl.cxx |6 - sc/source/core/opencl/op_financial_helpers.hxx | 27 - sc/source/core/opencl/op_math.cxx | 125 +++-- sc/source/core/opencl/op_math.hxx |7 - sc/source/core/opencl/op_math_helpers.hxx | 27 + sc/source/core/opencl/op_statistical.cxx | 72 +++--- 6 files changed, 132 insertions(+), 132 deletions(-) New commits: commit 64426b95bd6c9f1fe7a40c2f2bfabb43b1ce658c Author: Luboš Luňák AuthorDate: Thu Sep 22 09:54:56 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 17:58:57 2022 +0200 fix opencl round(), roundup() and rounddown() These are quite tricky due to rounding errors, the pown() used to "shift" the decimal point left-right increases the rounding error, so this must be compensated for. The round adjustment is based on rtl_math_round(), the up/down variants check for valid 12 places. Change-Id: I940f11f4e913665a5248463cf826ab5e5dcbe797 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140368 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_financial_helpers.hxx b/sc/source/core/opencl/op_financial_helpers.hxx index 060ed6813566..da2314ecc20f 100644 --- a/sc/source/core/opencl/op_financial_helpers.hxx +++ b/sc/source/core/opencl/op_financial_helpers.hxx @@ -9,36 +9,9 @@ #pragma once -const char nCorrValDecl[] ="double constant nCorrVal[]" -"= {0, 9e-1, 9e-2, 9e-3, 9e-4, 9e-5, 9e-6, 9e-7, " -"9e-8,9e-9, 9e-10, 9e-11, 9e-12, 9e-13, 9e-14, 9e-15};\n"; - const char SCdEpsilonDecl[] = "constant double SCdEpsilon = 1.0E-7;\n"; -const char RoundDecl[] = "double Round(double fValue);\n"; - -const char Round[] = -"double Round(double fValue)\n" -"{\n" -"if ( fValue == 0.0 )\n" -"return fValue;\n" -"\n" -"double fFac = 0;\n" -"int nExp;\n" -"if ( fValue > 0.0 )\n" -"nExp = ( floor( log10( fValue ) ) );\n" -"else\n" -"nExp = 0;\n" -"int nIndex = 15 - nExp;\n" -"if ( nIndex > 15 )\n" -"nIndex = 15;\n" -"else if ( nIndex <= 1 )\n" -"nIndex = 0;\n" -"fValue = floor( fValue + 0.5 + nCorrVal[nIndex] );\n" -"return fValue;\n" -"}\n"; - const char GetPMTDecl[] = "double GetPMT( double fRate, double fNper, double fPv, double fFv, bool bPayInAdvance);\n"; diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 430f8734f5f0..cd2f2f8b5396 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -861,6 +861,13 @@ void OpAverageIfs::GenSlidingWindowFunction(outputstream , ss << "}"; } +void OpRound::BinInlineFun(std::set& decls,std::set& funs) +{ +decls.insert(nCorrValDecl); +decls.insert(RoundDecl); +funs.insert(Round); +} + void OpRound::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { @@ -868,25 +875,24 @@ void OpRound::GenSlidingWindowFunction(outputstream , GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "int gid0=get_global_id(0);\n"; -ss << "int singleIndex = gid0;\n"; -GenTmpVariables(ss,vSubArguments); -CheckAllSubArgumentIsNan(ss,vSubArguments); -if(vSubArguments.size() ==2) -{ -ss << "for(int i=0;itmp1;i--)\n"; -ss << "tmp0 = tmp0 / 10;\n"; -} -ss << "double tmp=round(tmp0);\n"; -if(vSubArguments.size() ==2) +GenerateArg( "value", 0, vSubArguments, ss ); +if(vSubArguments.size() ==1) +ss << "return round(value);\n"; +else { -ss << "for(int i=0;itmp1;i--)\n"; -ss << "tmp = tmp * 10;\n"; +GenerateArg( "fDec", 1, vSubArguments, ss ); +ss << "int dec = floor( fDec );\n"; +ss << "if( dec < -20 || dec > 20 )\n"; +ss << "return CreateDoubleError( IllegalArgument );\n"; +ss << "if( dec == 0 )\n"; +ss << "return round(value);\n"; +ss << "double orig_value = value;\n"; +ss << "value = fabs(value);\n"; +ss << "double multiply = pown(10.0, dec);\n"; +ss << "double tmp = value*multiply;\n"; +ss << "tmp = Round( tmp );\n"; +ss << "return copysign(tmp/multiply, orig_value);\n"; } -ss << "return tmp;\n"; ss << "}"; } @@ -897,32 +903,24 @@ void OpRoundUp::GenSlidingWindowFunction(outputstream , GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "int gid0=get_global_id(0);\n"; -ss << "int singleIndex = gid0;\n"; -ss << "int intTmp;\n"; -ss << "double tmp;\n"; -GenTmpVariables(ss,vSubArguments); -CheckAllSubArgumentIsNan(ss,vSubArguments); -if( vSubArguments.size() == 1 ) -ss << "double tmp1 = 0;\n"; -ss << "int shift = (int)tmp1;\n";
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx |2 sc/source/core/opencl/op_financial.cxx | 132 +++-- sc/source/core/opencl/op_financial.hxx |6 - sc/source/core/opencl/op_financial_helpers.hxx | 91 + 4 files changed, 133 insertions(+), 98 deletions(-) New commits: commit be36394708abf11a70be2be7591811b4fa6e81a6 Author: Luboš Luňák AuthorDate: Thu Sep 22 09:54:43 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 22 17:58:12 2022 +0200 fix opencl RATE() Simply copy the core implementation. Change-Id: Iaba774b6a606d5ed323e2423c1d1261358814ba6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140366 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index a8dc885d1aa0..067262cbd09b 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -2217,7 +2217,7 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; case ocRate: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); +mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; case ocRRI: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 67326251f9d0..c3b5861a5fcf 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -1555,113 +1555,61 @@ void OpTbillprice::GenSlidingWindowFunction( ss << "}\n"; } -void RATE::BinInlineFun(std::set& decls, +void OpRate::BinInlineFun(std::set& decls, std::set& funs) { -decls.insert(nCorrValDecl); -decls.insert(SCdEpsilonDecl);decls.insert(RoundDecl); -funs.insert(Round); +decls.insert(RateIterationDecl); +funs.insert(RateIteration); } -void RATE::GenSlidingWindowFunction( +void OpRate::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { -CHECK_PARAMETER_COUNT( 6, 6 ); +CHECK_PARAMETER_COUNT( 3, 6 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "int gid0 = get_global_id(0);\n"; -GenerateArg( "arg0", 0, vSubArguments, ss ); -GenerateArg( "arg1", 1, vSubArguments, ss ); -GenerateArg( "arg2", 2, vSubArguments, ss ); -GenerateArgWithDefault( "arg3", 3, 0, vSubArguments, ss ); -GenerateArgWithDefault( "arg4", 4, 0, vSubArguments, ss ); -GenerateArgWithDefault( "arg5", 5, 0.1, vSubArguments, ss ); -ss << "double result;\n"; -ss << "bool bValid = true, bFound = false;\n"; -ss << "double fX, fXnew, fTerm, fTermDerivation;\n"; -ss << "double fGeoSeries, fGeoSeriesDerivation;\n"; -ss << "int nIterationsMax = 150;\n"; -ss << "int nCount = 0;\n"; -ss << "double fEpsilonSmall = 1.0E-14;\n"; -ss << "if( arg0 <= 0 )\n"; +GenerateArg( "fNper", 0, vSubArguments, ss ); +GenerateArg( "fPayment", 1, vSubArguments, ss ); +GenerateArg( "fPv", 2, vSubArguments, ss ); +GenerateArgWithDefault( "fFv", 3, 0, vSubArguments, ss ); +GenerateArgWithDefault( "fPayType", 4, 0, vSubArguments, ss ); +ss << "bool bPayType = fPayType != 0;\n"; +if( vSubArguments.size() == 6 ) +{ +GenerateArgWithDefault( "fGuess", 5, 0.1, vSubArguments, ss ); +ss << "double fOrigGuess = fGuess;\n"; +ss << "bool bDefaultGuess = false;\n"; +} +else +{ +ss << "double fGuess = 0.1, fOrigGuess = 0.1;\n"; +ss << "bool bDefaultGuess = true;\n"; +} +ss << "if( fNper <= 0 )\n"; ss << "return CreateDoubleError(IllegalArgument);\n"; -ss << "arg3 = arg3 - arg1 * arg4;\n"; -ss << "arg2 = arg2 + arg1 * arg4;\n"; -ss << "if (arg0 == Round(arg0)){\n"; -ss << "fX = arg5;\n"; -ss << "double fPowN, fPowNminus1;\n"; -ss << "while (!bFound && nCount < nIterationsMax)\n"; +ss << "bool bValid = RateIteration(fNper, fPayment, fPv, fFv, bPayType, );\n"; +ss << "if (!bValid)\n"; +ss << "{\n"; +ss << "if (bDefaultGuess)\n"; ss << "{\n"; -ss << "fPowNminus1 = pow( 1.0+fX, arg0-1.0);\n"; -ss << "fPowN = fPowNminus1 * (1.0+fX);\n"; -ss << "if (fX == 0.0)\n"; +ss << "double fX = fOrigGuess;\n"; +ss << "for (int nStep = 2; nStep <= 10 && !bValid; ++nStep)\n"; ss
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/formulagroupcl.cxx | 66 -- sc/source/core/opencl/op_statistical.cxx | 194 +-- sc/source/core/opencl/op_statistical.hxx |4 3 files changed, 38 insertions(+), 226 deletions(-) New commits: commit bdb576ea889d944b2aa9d3dfaa8fbd7c07415c82 Author: Luboš Luňák AuthorDate: Tue Sep 20 18:08:42 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 21 10:24:26 2022 +0200 fix/simplify opencl GEOMEAN() I don't quite see why this one would need such a special handling, when most other functions (e.g. the very similar HARMEAN()) can do with just generic handling. Change-Id: I31f3772ffdf9540178a42f11ae4e376023ad2413 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140257 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index af81125e9c99..a8dc885d1aa0 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1642,66 +1642,6 @@ public: { i += rxSubArgument->Marshal(k, argno + i, nVectorWidth, pProgram); } -if (dynamic_cast(mpCodeGen.get())) -{ -openclwrapper::KernelEnv kEnv; -openclwrapper::setKernelEnv(); -cl_int err; -cl_mem pClmem2; - -std::vector vclmem; -for (const auto& rxSubArgument : mvSubArguments) -{ -if (VectorRef* VR = dynamic_cast(rxSubArgument.get())) -vclmem.push_back(VR->GetCLBuffer()); -else -vclmem.push_back(nullptr); -} -pClmem2 = clCreateBuffer(kEnv.mpkContext, CL_MEM_READ_WRITE, -sizeof(double) * nVectorWidth, nullptr, ); -if (CL_SUCCESS != err) -throw OpenCLError("clCreateBuffer", err, __FILE__, __LINE__); -SAL_INFO("sc.opencl", "Created buffer " << pClmem2 << " size " << sizeof(double) << "*" << nVectorWidth << "=" << (sizeof(double)*nVectorWidth)); - -std::string kernelName = "GeoMean_reduction"; -cl_kernel redKernel = clCreateKernel(pProgram, kernelName.c_str(), ); -if (err != CL_SUCCESS) -throw OpenCLError("clCreateKernel", err, __FILE__, __LINE__); -SAL_INFO("sc.opencl", "Created kernel " << redKernel << " with name " << kernelName << " in program " << pProgram); - -// set kernel arg of reduction kernel -for (size_t j = 0; j < vclmem.size(); j++) -{ -SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << j << ": " << (vclmem[j] ? "cl_mem" : "double") << ": " << vclmem[j]); -err = clSetKernelArg(redKernel, j, -vclmem[j] ? sizeof(cl_mem) : sizeof(double), -static_cast([j])); -if (CL_SUCCESS != err) -throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__); -} -SAL_INFO("sc.opencl", "Kernel " << redKernel << " arg " << vclmem.size() << ": cl_mem: " << pClmem2); -err = clSetKernelArg(redKernel, vclmem.size(), sizeof(cl_mem), static_cast()); -if (CL_SUCCESS != err) -throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__); - -// set work group size and execute -size_t global_work_size[] = { 256, static_cast(nVectorWidth) }; -size_t const local_work_size[] = { 256, 1 }; -SAL_INFO("sc.opencl", "Enqueuing kernel " << redKernel); -err = clEnqueueNDRangeKernel(kEnv.mpkCmdQueue, redKernel, 2, nullptr, -global_work_size, local_work_size, 0, nullptr, nullptr); -if (CL_SUCCESS != err) -throw OpenCLError("clEnqueueNDRangeKernel", err, __FILE__, __LINE__); -err = clFinish(kEnv.mpkCmdQueue); -if (CL_SUCCESS != err) -throw OpenCLError("clFinish", err, __FILE__, __LINE__); - -// Pass pClmem2 to the "real" kernel -SAL_INFO("sc.opencl", "Kernel " << k << " arg " << argno << ": cl_mem: " << pClmem2); -err = clSetKernelArg(k, argno, sizeof(cl_mem), static_cast()); -if (CL_SUCCESS != err) -throw OpenCLError("clSetKernelArg", err, __FILE__, __LINE__); -} if (OpSumIfs* OpSumCodeGen = dynamic_cast(mpCodeGen.get())) { openclwrapper::KernelEnv kEnv; @@ -2303,9 +2243,9 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, case ocGauss: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocGeoMean: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i],
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_statistical.cxx | 345 --- sc/source/core/opencl/op_statistical.hxx | 125 ++- 2 files changed, 203 insertions(+), 267 deletions(-) New commits: commit ebc0db7acee7a470c4e41cddbb97274343899ce0 Author: Luboš Luňák AuthorDate: Tue Sep 20 18:08:35 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 21 10:23:49 2022 +0200 fix and simplify opencl functions that calculate difference from mean ocVar, ocStDev etc. Besides the copy reductions, these also need to use fsub_approx() otherwise they can fail with large numbers. Change-Id: Ic96caaa0d5711d811a27b0e2034db357a71b9fa1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140255 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 1fbc80e2e00e..6441f8343daa 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -15,59 +15,9 @@ using namespace formula; -namespace sc::opencl { -void OpVar::GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) -{ -CHECK_PARAMETER_COUNT( 1, 30 ); -GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n"; -ss << "int gid0 = get_global_id(0);\n"; -ss << "double fSum = 0.0;\n"; -ss << "double fMean = 0.0;\n"; -ss << "double vSum = 0.0;\n"; -ss << "double fCount = 0.0;\n"; -GenerateRangeArgs( vSubArguments, ss, SkipEmpty, -"fSum += arg;\n" -"fCount += 1.0;\n" -); -ss << "fMean = fSum / fCount;\n"; -GenerateRangeArgs( vSubArguments, ss, SkipEmpty, -"vSum += (arg - fMean) * (arg - fMean);\n" -); -ss << "if (fCount <= 1.0)\n"; -ss << "return CreateDoubleError(DivisionByZero);\n"; -ss << "else\n"; -ss << "return vSum / (fCount - 1.0);\n"; -ss << "}\n"; -} +#include "op_math_helpers.hxx" -void OpVarP::GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) -{ -CHECK_PARAMETER_COUNT( 1, 30 ); -GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n"; -ss << "int gid0 = get_global_id(0);\n"; -ss << "double fSum = 0.0;\n"; -ss << "double fMean = 0.0;\n"; -ss << "double vSum = 0.0;\n"; -ss << "double fCount = 0.0;\n"; -ss << "double arg = 0.0;\n"; -GenerateRangeArgs( vSubArguments, ss, SkipEmpty, -"fSum += arg;\n" -"fCount += 1.0;\n" -); -ss << "fMean = fSum / fCount;\n"; -GenerateRangeArgs( vSubArguments, ss, SkipEmpty, -"vSum += (arg - fMean) * (arg - fMean);\n" -); -ss << "if (fCount == 0.0)\n"; -ss << "return CreateDoubleError(DivisionByZero);\n"; -ss << "else\n"; -ss << "return vSum / fCount;\n"; -ss << "}\n"; -} +namespace sc::opencl { void OpZTest::BinInlineFun(std::set& decls, std::set& funs) @@ -371,77 +321,6 @@ void OpWeibull::GenSlidingWindowFunction(outputstream , ss << "}\n"; } -void OpSkew::GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) -{ -CHECK_PARAMETER_COUNT( 1, 30 ); -GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n"; -ss << "int gid0 = get_global_id(0);\n"; -ss << "double fSum = 0.0;\n"; -ss << "double fMean = 0.0;\n"; -ss << "double vSum = 0.0;\n"; -ss << "double fCount = 0.0;\n"; -GenerateRangeArgs( vSubArguments, ss, SkipEmpty, -"fSum += arg;\n" -"fCount += 1.0;\n" -); -ss << "if(fCount <= 2.0)\n"; -ss << "return CreateDoubleError(DivisionByZero);\n"; -ss << "else\n"; -ss << "fMean = fSum / fCount;\n"; -GenerateRangeArgs( vSubArguments, ss, SkipEmpty, -"vSum += (arg - fMean) * (arg - fMean);\n" -); -ss << "double fStdDev = sqrt(vSum / (fCount - 1.0));\n"; -ss << "double dx = 0.0;\n"; -ss << "double xcube = 0.0;\n"; -ss << "if(fStdDev == 0.0)\n"; -ss << "return CreateDoubleError(IllegalArgument);\n"; -GenerateRangeArgs( vSubArguments, ss, SkipEmpty, -"dx = (arg - fMean) / fStdDev;\n" -"xcube = xcube + dx * dx * dx;\n" -); -ss << "return ((xcube * fCount) / (fCount - 1.0))"; -ss << " / (fCount - 2.0);\n"; -ss << "}\n"; -} - -void OpSkewp::GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) -{ -CHECK_PARAMETER_COUNT( 1, 3 ); -GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n"; -ss << "int gid0 = get_global_id(0);\n"; -ss << "double fSum = 0.0;\n"; -ss << "double fMean = 0.0;\n";
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/formulagroupcl.cxx | 72 - sc/source/core/opencl/op_financial.cxx | 65 -- sc/source/core/opencl/op_financial.hxx | 22 +++ sc/source/core/opencl/op_financial_helpers.hxx | 65 +++--- sc/source/core/opencl/op_statistical.cxx | 52 +- 5 files changed, 132 insertions(+), 144 deletions(-) New commits: commit 380b42bd1b8be39d774245f93651515b45df150b Author: Luboš Luňák AuthorDate: Tue Sep 20 18:08:31 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 21 10:23:36 2022 +0200 fix and enable some disabled opencl functions Change-Id: Ic7bd01edcc7297317b390567590821ce00e5ef22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140254 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 75485b47dc21..af81125e9c99 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -2523,10 +2523,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocGammaDist: +case ocGammaDist: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i], std::make_sharedChildren[i], std::make_shared(), nResultSize)); +break; case ocLn: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); @@ -2551,10 +2551,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocChiDist: +case ocChiDist: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i],std::make_sharedChildren[i],std::make_shared(), nResultSize)); +break; case ocPow: case ocPower: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, @@ -2564,26 +2564,26 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocChiSqDist: +case ocChiSqDist: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i],std::make_sharedChildren[i],std::make_shared(), nResultSize)); break; case ocChiSqInv: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i],std::make_sharedChildren[i],std::make_shared(), nResultSize)); break; case ocGammaInv: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i], std::make_sharedChildren[i], std::make_shared(), nResultSize)); +break; case ocFloor: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocFInv: +case ocFInv: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i], std::make_sharedChildren[i], std::make_shared(), nResultSize)); +break; case ocFTest: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); @@ -2664,10 +2664,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocChiInv: +case ocChiInv: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, - ft->Children[i],std::make_sharedChildren[i],std::make_shared(), nResultSize)); +break; case ocPoissonDist: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); @@ -2742,10 +2742,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts,
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_financial.cxx |7 --- sc/source/core/opencl/op_financial.hxx |3 - sc/source/core/opencl/op_math.cxx|2 sc/source/core/opencl/op_statistical.cxx | 66 ++- 4 files changed, 45 insertions(+), 33 deletions(-) New commits: commit 2e983926e868bcb2182c84348b60ad7085588b96 Author: Luboš Luňák AuthorDate: Tue Sep 20 18:08:23 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 21 10:23:03 2022 +0200 various small opencl code fixes and error checking Change-Id: I9f1d109887faf11a86be83da050983292e99da49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140252 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 4e248902dbc6..c80f58cf72d1 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -845,12 +845,7 @@ void OpNPV::GenSlidingWindowFunction(outputstream , ss << "int nCount = 1;\n"; GenerateArg( 0, vSubArguments, ss ); GenerateRangeArgs( 1, vSubArguments.size() - 1, vSubArguments, ss, SkipEmpty, -"double temp1=1.0;\n" -"for(int i=1;i arg0)\n"; +ss << "return CreateDoubleError(IllegalArgument);\n"; ss << "double tem;\n"; ss << "if(arg0 >= arg1 && arg0 > 0 && arg1 > 0)\n"; ss << "tem = bik(arg0+arg1-1,arg1);\n"; diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 68b1e447c039..03e81c4dd034 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -337,8 +337,8 @@ void OpStandard::GenSlidingWindowFunction(outputstream , ss << "{\n"; ss << "int gid0 = get_global_id(0);\n"; GenerateArg( "x", 0, vSubArguments, ss ); -GenerateArg( "mu", 0, vSubArguments, ss ); -GenerateArg( "sigma", 0, vSubArguments, ss ); +GenerateArg( "mu", 1, vSubArguments, ss ); +GenerateArg( "sigma", 2, vSubArguments, ss ); ss << "if(sigma < 0.0)\n"; ss << "return CreateDoubleError(IllegalArgument);\n"; ss << "else if(sigma == 0.0)\n"; @@ -590,19 +590,20 @@ void OpNegbinomdist::GenSlidingWindowFunction( { CHECK_PARAMETER_COUNT( 3, 3 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n\t"; -ss << " int gid0=get_global_id(0);\n"; +ss << "{\n"; +ss << "int gid0=get_global_id(0);\n"; GenerateArg( "f", 0, vSubArguments, ss ); -GenerateArg( "s", 0, vSubArguments, ss ); -GenerateArg( "p", 0, vSubArguments, ss ); -ss << " double q = 1.0 - p;\n\t"; -ss << " double fFactor = pow(p,s);\n\t"; -ss << " for(int i=0; i 1.0)\n"; +ss << "return CreateDoubleError(IllegalArgument);\n"; +ss << "double q = 1.0 - p;\n"; +ss << "double fFactor = pow(p,s);\n"; +ss << "for(int i=0; i= 1.0"; ss << "|| rn < 1.0)\n"; @@ -867,9 +870,13 @@ void OpCritBinom::GenSlidingWindowFunction(outputstream& ss, GenerateArg( "p", 1, vSubArguments, ss ); GenerateArg( "alpha", 2, vSubArguments, ss ); ss << "double rn = floor(n);\n"; -ss << "if (rn < 0.0 || alpha <= 0.0 || alpha >= 1.0 || p < 0.0"; +ss << "if (rn < 0.0 || alpha < 0.0 || alpha > 1.0 || p < 0.0"; ss << " || p > 1.0)\n"; ss << "return CreateDoubleError(IllegalArgument);\n"; +ss << "else if ( alpha == 0 )\n"; +ss << "return 0;\n"; +ss << "else if ( alpha == 1 )\n"; +ss << "return p == 0 ? 0 : rn;\n"; ss << "else\n"; ss << "{\n"; ss << "double rq = (0.5 - p) + 0.5;\n"; @@ -1166,6 +1173,8 @@ void OpKurt:: GenSlidingWindowFunction(outputstream , "fSum += arg;\n" "totallength +=1;\n" ); +ss << "if( totallength < 4 )\n"; +ss << "return CreateDoubleError(DivisionByZero);\n"; ss << "double fMean = fSum / totallength;\n"; GenerateRangeArgs( vSubArguments, ss, SkipEmpty, "vSum += (arg-fMean)*(arg-fMean);\n" @@ -1217,22 +1226,27 @@ void OpLogNormDist::GenSlidingWindowFunction(outputstream , GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "int gid0=get_global_id(0);\n"; -GenerateArg( 0, vSubArguments, ss ); -GenerateArgWithDefault( "arg1", 1, 0, vSubArguments, ss ); -GenerateArgWithDefault( "arg2", 2, 1, vSubArguments, ss ); -GenerateArgWithDefault( "arg3", 3, 1, vSubArguments, ss ); +GenerateArg( "x", 0, vSubArguments, ss ); +GenerateArgWithDefault( "mue", 1, 0, vSubArguments, ss ); +GenerateArgWithDefault( "sigma", 2, 1, vSubArguments, ss ); +GenerateArgWithDefault( "fCumulative", 3, 1, vSubArguments, ss ); +ss << "if (sigma <= 0.0)\n"; +ss << "return CreateDoubleError(IllegalArgument);\n"; ss
[Libreoffice-commits] core.git: 2 commits - sc/Library_sc.mk sc/source
sc/Library_sc.mk |1 sc/source/core/opencl/formulagroupcl.cxx | 53 sc/source/core/opencl/op_database.cxx | 1565 - sc/source/core/opencl/op_database.hxx | 107 - sc/source/core/opencl/op_financial.cxx | 220 +-- sc/source/core/opencl/op_financial.hxx |1 sc/source/core/opencl/op_financial_helpers.hxx | 92 - 7 files changed, 156 insertions(+), 1883 deletions(-) New commits: commit b79796ced86c232154801a3084df0cec3c022af8 Author: Luboš Luňák AuthorDate: Tue Sep 20 18:08:20 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 21 10:22:50 2022 +0200 fix some opencl financial functions (PMT, IPMT, etc.) These are mostly copy from ScInterpreter and adapted. Change-Id: Ib05021556a34b2eb35d0e51673636f50f150732f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140251 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 6ab513210e43..09fce6abb75a 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -2411,10 +2411,10 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; -/*case ocNper: -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, -ft->Children[i], std::make_sharedChildren[i], std::make_shared(), nResultSize)); + break; case ocNormDist: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 1d4efa00a9f3..4e248902dbc6 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -188,50 +188,34 @@ void OpIPMT::BinInlineFun(std::set& decls, { decls.insert(GetFVDecl); funs.insert(GetFV); +decls.insert(GetPMTDecl); +funs.insert(GetPMT); +decls.insert(GetIpmtDecl); +funs.insert(GetIpmt); } void OpIPMT::GenSlidingWindowFunction(outputstream& ss, const std::string , SubArguments& vSubArguments) { -CHECK_PARAMETER_COUNT( 6, 6 ); +CHECK_PARAMETER_COUNT( 4, 6 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "double tmp = " << GetBottom() << ";\n"; ss << "int gid0 = get_global_id(0);\n"; -GenerateArg( 0, vSubArguments, ss ); -GenerateArg( 1, vSubArguments, ss ); -GenerateArg( 2, vSubArguments, ss ); -GenerateArg( 3, vSubArguments, ss ); -GenerateArg( 4, vSubArguments, ss ); -GenerateArg( 5, vSubArguments, ss ); -ss << "double pmt ;\n"; -ss << "if(arg0 == 0.0)\n"; -ss << "return 0;\n"; -ss << "double temp1 = 0;\n"; -ss << "double abl = pow(1.0 + arg0, arg2);\n"; -ss << "temp1 -= arg4;\n"; -ss << "temp1 -= arg3 * abl;\n"; -ss << "pmt = temp1 / (1.0 + arg0 * arg5) /"; -ss << " ( (abl - 1.0) / arg0);\n"; -ss << "double temp = pow( 1 + arg0, arg1 - 2);\n"; -ss << "if(arg1 == 1.0)\n"; -ss << "{\n"; -ss << "if(arg5 > 0.0)\n"; -ss << "tmp = 0.0;\n"; -ss << "else\n"; -ss << "tmp = -arg3;\n"; -ss << "}\n"; +GenerateArg( "fRate", 0, vSubArguments, ss ); +GenerateArg( "fPer", 1, vSubArguments, ss ); +GenerateArg( "fNper", 2, vSubArguments, ss ); +GenerateArg( "fPv", 3, vSubArguments, ss ); +GenerateArgWithDefault( "fFv", 4, 0, vSubArguments, ss ); +GenerateArgWithDefault( "fPayInAdvance", 5, 0, vSubArguments, ss ); +ss << "if (fPer < 1.0 || fPer > fNper)\n"; +ss << "return CreateDoubleError(IllegalArgument);\n"; ss << "else\n"; ss << "{\n"; -ss << "if(arg5 > 0.0)\n"; -ss << "tmp = GetFV(arg0, arg1 - 2.0, pmt, arg3, 1.0)"; -ss << " - pmt;\n"; -ss << "else\n"; -ss << "tmp = GetFV(arg0, arg1 - 1.0, pmt, arg3, 0.0);\n"; -ss << "}\n"; -ss << "tmp = tmp * arg0;\n"; -ss << "return tmp;\n"; -ss << "}"; +ss << "double fPmt;\n"; +ss << "return GetIpmt(fRate, fPer, fNper, fPv, fFv, fPayInAdvance != 0, );\n"; +ss << " }\n"; +ss << "}\n"; } void OpISPMT::GenSlidingWindowFunction(outputstream& ss, const std::string , SubArguments& vSubArguments) @@ -357,8 +341,8 @@ void Fvschedule::GenSlidingWindowFunction( void Cumipmt::BinInlineFun(std::set& decls, std::set& funs) { -decls.insert(GetPMT_newDecl); decls.insert(GetFV_newDecl); -
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_array.cxx | 15 - sc/source/core/opencl/op_financial.cxx | 83 +++- sc/source/core/opencl/op_logical.cxx | 22 ++ sc/source/core/opencl/op_logical.hxx | 10 - sc/source/core/opencl/op_math.cxx| 23 -- sc/source/core/opencl/op_statistical.cxx | 308 +++ sc/source/core/opencl/opbase.cxx | 137 +++-- sc/source/core/opencl/opbase.hxx | 44 ++-- 8 files changed, 317 insertions(+), 325 deletions(-) New commits: commit 33f242266138d5179a58f2601ea15be4b6570835 Author: Luboš Luňák AuthorDate: Tue Sep 20 18:08:08 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 21 10:22:16 2022 +0200 rework handling of empty cells in opencl code Some of the code handling ranges of cells wants empty cells to be zero, some wants to skip them, and few want special handling. So just make three generic cases that handle these, which somewhat simplifies this while still allowing flexibility where needed. Also handle better Test::testFuncSUMXMY2, which works on a pair of ranges, sets a cell in one to a value and another is empty, in this case it is necessary to iterate over this pair with SkipEmpty even if for the second one it's beyond GetArrayLength(). Change-Id: I6c8edaaadb02ffe2a6a7a9399347909008ea188e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140249 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_array.cxx b/sc/source/core/opencl/op_array.cxx index 7369c1ed44bf..47ae15218588 100644 --- a/sc/source/core/opencl/op_array.cxx +++ b/sc/source/core/opencl/op_array.cxx @@ -26,9 +26,8 @@ void OpSumX2MY2::GenSlidingWindowFunction(outputstream , ss << "{\n"; ss << "int gid0=get_global_id(0);\n"; ss << "double tmp =0;\n"; -GenerateRangeArgPair( 0, 1, vSubArguments, ss, -"if( !isnan(arg1) && !isnan(arg2))\n" -"tmp +=pow(arg1,2) - pow(arg2,2);\n" +GenerateRangeArgPair( 0, 1, vSubArguments, ss, EmptyIsZero, +"tmp +=pow(arg1,2) - pow(arg2,2);\n" ); ss << "return tmp;\n"; ss << "}\n"; @@ -44,9 +43,8 @@ void OpSumX2PY2::GenSlidingWindowFunction(outputstream , ss << "{\n"; ss << "int gid0=get_global_id(0);\n"; ss << "double tmp =0;\n"; -GenerateRangeArgPair( 0, 1, vSubArguments, ss, -"if( !isnan(arg1) && !isnan(arg2))\n" -"tmp +=pow(arg1,2) + pow(arg2,2);\n" +GenerateRangeArgPair( 0, 1, vSubArguments, ss, EmptyIsZero, +"tmp +=pow(arg1,2) + pow(arg2,2);\n" ); ss << "return tmp;\n"; ss << "}\n"; @@ -62,9 +60,8 @@ void OpSumXMY2::GenSlidingWindowFunction(outputstream , ss << "{\n"; ss << "int gid0=get_global_id(0);\n"; ss << "double tmp =0;\n"; -GenerateRangeArgPair( 0, 1, vSubArguments, ss, -"if( !isnan(arg1) && !isnan(arg2))\n" -"tmp +=pow((arg1-arg2),2);\n" +GenerateRangeArgPair( 0, 1, vSubArguments, ss, EmptyIsZero, +"tmp +=pow((arg1-arg2),2);\n" ); ss << "return tmp;\n"; ss << "}\n"; diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 92263d78abb4..1d4efa00a9f3 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -347,9 +347,8 @@ void Fvschedule::GenSlidingWindowFunction( ss << "int gid0 = get_global_id(0);\n"; GenerateArg( 0, vSubArguments, ss ); ss << "\t"; -GenerateRangeArg( 1, vSubArguments, ss, -"if(!isnan(arg))\n" -"tmp *= arg + 1;\n" +GenerateRangeArg( 1, vSubArguments, ss, SkipEmpty, +"tmp *= arg + 1;\n" ); ss << "\t"; ss << "return (double)tmp * arg0"; @@ -420,13 +419,10 @@ void OpIRR::GenSlidingWindowFunction(outputstream , ss << "while (fEps > Epsilon && nItCount < 20)\n"; ss << "{\n"; ss << "nCount = 0.0; fNumerator = 0.0; fDenominator = 0.0;\n"; -GenerateRangeArg( 0, vSubArguments, ss, -"if (!isnan(arg))\n" -"{\n" -"fNumerator += arg / pow(1.0 + x, nCount);\n" -"fDenominator+=-1*nCount*arg/pow(1.0+x,nCount+1.0);\n" -"nCount += 1;\n" -"}\n" +GenerateRangeArg( 0, vSubArguments, ss, SkipEmpty, +"fNumerator += arg / pow(1.0 + x, nCount);\n" +"fDenominator+=-1*nCount*arg/pow(1.0+x,nCount+1.0);\n" +"nCount += 1;\n" ); ss << "xNew = x - fNumerator / fDenominator;\n"; ss << "fEps = fabs(xNew - x);\n"; @@ -453,10 +449,9 @@ void XNPV::GenSlidingWindowFunction( ss << "double result = 0.0;\n"; ss << "int gid0 = get_global_id(0);\n";
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx | 198 +- sc/source/core/opencl/op_math.cxx| 114 - sc/source/core/opencl/op_math.hxx| 90 - sc/source/core/opencl/op_math_helpers.hxx| 26 sc/source/core/opencl/op_statistical.cxx | 2006 --- sc/source/core/opencl/op_statistical.hxx | 132 - sc/source/core/opencl/op_statistical_helpers.hxx | 23 sc/source/core/opencl/opbase.cxx | 124 + sc/source/core/opencl/opbase.hxx | 107 + 9 files changed, 450 insertions(+), 2370 deletions(-) New commits: commit 424595a5997d1cbbf5ab0e3601e329efac9c2fd0 Author: Luboš Luňák AuthorDate: Tue Sep 20 09:57:45 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 17:54:03 2022 +0200 fix and simplify openCL *A functions (COUNTA,MINA, etc.) These work just like their non-A counterparts, they just also accept strings and treat them as zeros. So instead of having a duplicated function for everything, use the basic functions, detect that string arguments should be treated this way and then convert them in the input data. This as a side-effect also makes the ScCalcConfig::StringConversion::ZERO part work (no idea if that's even been used). Change-Id: I3385b5363c15b0ae45ff191df00ac357e80bd3c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140226 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 87c34f53ef1c..46e40d357464 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -108,6 +108,7 @@ OUString LimitedString( const OUString& str ) return OUString::Concat("\"") + str.subView( 0, 20 ) + "\"..."; } +const int MAX_PEEK_ELEMENTS = 5; // Returns formatted contents of the data (possibly shortened), to be used in debug output. std::string DebugPeekData(const FormulaToken* ref, int doubleRefIndex = 0) { @@ -117,16 +118,19 @@ std::string DebugPeekData(const FormulaToken* ref, int doubleRefIndex = 0) static_cast(ref); outputstream buf; buf << "SingleRef {"; -for( size_t i = 0; i < std::min< size_t >( 4, pSVR->GetArrayLength()); ++i ) +for( size_t i = 0; i < std::min< size_t >( MAX_PEEK_ELEMENTS, pSVR->GetArrayLength()); ++i ) { if( i != 0 ) buf << ","; -if( pSVR->GetArray().mpNumericArray != nullptr ) -buf << pSVR->GetArray().mpNumericArray[ i ]; -else if( pSVR->GetArray().mpStringArray != nullptr ) +if( pSVR->GetArray().mpStringArray != nullptr +&& pSVR->GetArray().mpStringArray[ i ] != nullptr ) +{ buf << LimitedString( OUString( pSVR->GetArray().mpStringArray[ i ] )); +} +else if( pSVR->GetArray().mpNumericArray != nullptr ) +buf << pSVR->GetArray().mpNumericArray[ i ]; } -if( pSVR->GetArrayLength() > 4 ) +if( pSVR->GetArrayLength() > MAX_PEEK_ELEMENTS ) buf << ",..."; buf << "}"; return buf.str(); @@ -137,16 +141,19 @@ std::string DebugPeekData(const FormulaToken* ref, int doubleRefIndex = 0) static_cast(ref); outputstream buf; buf << "DoubleRef {"; -for( size_t i = 0; i < std::min< size_t >( 4, pDVR->GetArrayLength()); ++i ) +for( size_t i = 0; i < std::min< size_t >( MAX_PEEK_ELEMENTS, pDVR->GetArrayLength()); ++i ) { if( i != 0 ) buf << ","; -if( pDVR->GetArrays()[doubleRefIndex].mpNumericArray != nullptr ) -buf << pDVR->GetArrays()[doubleRefIndex].mpNumericArray[ i ]; -else if( pDVR->GetArrays()[doubleRefIndex].mpStringArray != nullptr ) +if( pDVR->GetArrays()[doubleRefIndex].mpStringArray != nullptr +&& pDVR->GetArrays()[doubleRefIndex].mpStringArray[ i ] != nullptr ) +{ buf << LimitedString( OUString( pDVR->GetArrays()[doubleRefIndex].mpStringArray[ i ] )); +} +else if( pDVR->GetArrays()[doubleRefIndex].mpNumericArray != nullptr ) +buf << pDVR->GetArrays()[doubleRefIndex].mpNumericArray[ i ]; } -if( pDVR->GetArrayLength() > 4 ) +if( pDVR->GetArrayLength() > MAX_PEEK_ELEMENTS ) buf << ",..."; buf << "}"; return buf.str(); @@ -172,13 +179,13 @@ std::string DebugPeekDoubles(const double* data, int size) { outputstream buf; buf << "{"; -for( int i = 0; i < std::min( 4, size ); ++i ) +for( int i = 0; i < std::min( MAX_PEEK_ELEMENTS, size ); ++i ) { if( i != 0 ) buf << ","; buf << data[ i ]; } -if( size > 4 ) +if( size > MAX_PEEK_ELEMENTS )
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_statistical.cxx | 523 +-- sc/source/core/opencl/op_statistical.hxx |7 sc/source/core/opencl/op_statistical_helpers.hxx | 15 3 files changed, 53 insertions(+), 492 deletions(-) New commits: commit 68ae0798078cbc9daa8ea951e0f5e7de55042f70 Author: Luboš Luňák AuthorDate: Tue Sep 20 09:57:41 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 17:53:47 2022 +0200 reduce opencl copy (gaussinv) Change-Id: I44e5c74c903bab46a54b5b855f2665d924ac91fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140225 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index f2d32c7eefa1..459057f80e8f 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -1089,6 +1089,13 @@ void OpPhi::GenSlidingWindowFunction( ss << "}\n"; } +void OpNorminv::BinInlineFun(std::set& decls, +std::set& funs) +{ +decls.insert(gaussinvDecl); +funs.insert(gaussinv); +} + void OpNorminv::GenSlidingWindowFunction( outputstream ,const std::string , SubArguments ) @@ -1096,168 +1103,25 @@ void OpNorminv::GenSlidingWindowFunction( CHECK_PARAMETER_COUNT( 3, 3 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; -ss <<"double q,t,z;\n"; +ss << "int gid0=get_global_id(0);\n"; GenerateArg( "x", 0, vSubArguments, ss ); GenerateArg( "mue", 1, vSubArguments, ss ); GenerateArg( "sigma", 2, vSubArguments, ss ); -ss <<"q = x -0.5;\n"; -ss <<"if(fabs(q)<=.425)\n"; -ss <<" {\n"; -ss <<"t=0.180625-pow(q,2);\n"; -ss <<"z=\n" -"q*\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"t*2509.0809287301226727"; -ss <<"+33430.575583588128105\n" -")\n" -"*t+67265.770927008700853\n" -")\n" -"*t+45921.953931549871457\n" -")\n" -"*t+13731.693765509461125\n" -")\n" -"*t+1971.5909503065514427\n" -")\n" -"*t+133.14166789178437745\n" -")\n" -"*t+3.387132872796366608\n" -")\n" -"/\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"t*5226.495278852854561"; -ss <<"+28729.085735721942674\n" -")\n" -"*t+39307.89580009271061\n" -")\n" -"*t+21213.794301586595867\n" -")\n" -"*t+5394.1960214247511077\n" -")\n" -"*t+687.1870074920579083\n" -")\n" -"*t+42.313330701600911252\n" -")\n" -"*t+1.0\n" -");\n"; -ss <<"}\nelse\n{\n"; -ss <<" if(q>0)\nt=1-x;\n"; -ss <<"else\nt=x;\n"; -ss <<"t=sqrt(-log(t));\n"; -ss <<"if(t<=5.0)\n{\n"; -ss <<"t+=-1.6;\n"; -ss <<"z=\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" - "(\n" - "(\n" -"t*7.7454501427834140764e-4"; -ss <<"+0.0227238449892691845833\n" -")\n" -"*t+0.24178072517745061177\n" -")\n" -"*t+1.27045825245236838258\n" -")\n" -"*t+3.64784832476320460504\n" -")\n" -"*t+5.7694972214606914055\n" -")\n" -"*t+4.6303378461565452959\n" -")\n" -"*t+1.42343711074968357734\n" -")\n" -"/\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"(\n" -"t*1.05075007164441684324e-9"; -ss <<"+5.475938084995344946e-4\n" -")\n" -"*t+0.0151986665636164571966\n" -")\n" -"*t+0.14810397642748007459\n"
[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods |2 - sc/source/core/opencl/op_logical.hxx |3 + sc/source/core/opencl/op_statistical.cxx | 24 ++- sc/source/core/opencl/opbase.cxx |4 +- sc/source/core/opencl/opbase.hxx | 12 --- 5 files changed, 29 insertions(+), 16 deletions(-) New commits: commit 7dc92d60166a99e0539ce83ecf45bb40fd30d784 Author: Luboš Luňák AuthorDate: Tue Sep 20 09:57:38 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 17:53:32 2022 +0200 fix opencl AND() to treat empty cell in svSingleVectorRef as core does Functions_Excel_2016.fods incorrectly used "=AND(Sheet2.C22;C33)" instead of the correct "=AND(Sheet2.C22:C33)" (colon vs semicolon), and C33 is an empty cell. The return however was true because empty cells get special treatment because of Excel compatibility. Change-Id: I6d0b28280059fd6fc945e77c7b5d714b5e4727a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140224 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods b/sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods index f5c2aedd3abe..b4a6ea11500d 100644 --- a/sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods +++ b/sc/qa/unit/data/functions/fods/Functions_Excel_2016.fods @@ -856,7 +856,7 @@ 1 - + WAAR diff --git a/sc/source/core/opencl/op_logical.hxx b/sc/source/core/opencl/op_logical.hxx index f4c6b7a952ef..a52d1db0cf86 100644 --- a/sc/source/core/opencl/op_logical.hxx +++ b/sc/source/core/opencl/op_logical.hxx @@ -32,6 +32,9 @@ public: virtual std::string BinFuncName() const override { return "And"; } virtual const char* openclOperator() const override { return "&&"; }; virtual const char* defaultOpenclValue() const override { return "true"; } +// AND() with a svSingleVectorRef pointing to an empty cell skips that cell. +// See ScInterpreter::ScAnd(). +virtual const char* rangeEmptyCellValue() const override { return "1.0"; }; }; class OpOr: public OpLogicalBinaryOperator diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index 2cb51e47d080..fe98b4c09dd3 100644 --- a/sc/source/core/opencl/opbase.cxx +++ b/sc/source/core/opencl/opbase.cxx @@ -189,7 +189,7 @@ void SlidingFunctionBase::GenerateArg( const char* name, int arg, SubArguments& static_cast(token); ss << "if (gid0 >= " << svr->GetArrayLength() << " || isnan("; ss << vSubArguments[arg]->GenSlidingWindowDeclRef() << "))\n"; -ss << "" << name << " = 0.0;\n"; +ss << "" << name << " = " << rangeEmptyCellValue() << ";\n"; ss << "else\n"; ss << "" << name << " = "; ss << vSubArguments[arg]->GenSlidingWindowDeclRef() << ";\n"; @@ -345,7 +345,7 @@ void SlidingFunctionBase::GenerateRangeArgElement( const char* name, int arg, co throw Unhandled( __FILE__, __LINE__ ); const formula::DoubleVectorRefToken* pDVR = static_cast(token); -ss << "double " << name << " = NAN;\n"; +ss << "double " << name << " = " << rangeEmptyCellValue() << ";\n"; ss << "{\n"; // GenSlidingWindowDeclRef() may refer to 'i' variable. ss << "int i = 0;\n"; diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index ee55d72c45b6..aa2770cd20aa 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -261,12 +261,12 @@ public: const std::string&, SubArguments& ) = 0; protected: // generate code for "double = ;" from vSubArguments, svDoubleVectorRef is not supported -static void GenerateArg( const char* name, int arg, SubArguments& vSubArguments, outputstream& ss ); +void GenerateArg( const char* name, int arg, SubArguments& vSubArguments, outputstream& ss ); // overload, variable will be named "arg" -static void GenerateArg( int arg, SubArguments& vSubArguments, outputstream& ss ); +void GenerateArg( int arg, SubArguments& vSubArguments, outputstream& ss ); // generate code for "double = ;" from vSubArguments, if it exists, // otherwise set to -static void GenerateArgWithDefault( const char* name, int arg, double def, SubArguments& vSubArguments, +void GenerateArgWithDefault( const char* name, int arg, double def, SubArguments& vSubArguments, outputstream& ss ); void GenerateFunctionDeclaration( const std::string& sSymName, SubArguments& vSubArguments, outputstream& ss ); @@ -282,7 +282,7 @@ protected: // Overload. // Both arguments must be svDoubleRef of the same size. // If 'firstElementDiff' is set, the loop start will be offset by '+ firstElementDiff'. -static
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_array.cxx | 149 ++--- 1 file changed, 27 insertions(+), 122 deletions(-) New commits: commit b2c334d76d5d5e5219d94db90e36d597be654c6c Author: Luboš Luňák AuthorDate: Tue Sep 20 09:57:30 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 17:52:51 2022 +0200 simplify opencl code in op_array.cxx Change-Id: I4379683fa239e6f7c543350b645addffa784ba70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140222 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_array.cxx b/sc/source/core/opencl/op_array.cxx index 65a1caf65fbc..7369c1ed44bf 100644 --- a/sc/source/core/opencl/op_array.cxx +++ b/sc/source/core/opencl/op_array.cxx @@ -19,150 +19,55 @@ namespace sc::opencl { void OpSumX2MY2::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 2, 2 ); +CHECK_PARAMETER_DOUBLEVECTORREF( 0 ); +CHECK_PARAMETER_DOUBLEVECTORREF( 1 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; -ss <<" int gid0=get_global_id(0);\n"; +ss << "int gid0=get_global_id(0);\n"; ss << "double tmp =0;\n"; -GenTmpVariables(ss,vSubArguments); -if(vSubArguments[0]->GetFormulaToken()->GetType() == -formula::svDoubleVectorRef) -{ -FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken(); -const formula::DoubleVectorRefToken*pCurDVR= static_cast(tmpCur); -size_t nCurWindowSize = pCurDVR->GetArrayLength() < -pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): -pCurDVR->GetRefRowSize() ; -ss << "int i ;\n"; -ss << "for (i = "; -if (!pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed()) { -ss << "gid0; i < "<< nCurWindowSize <<"; i++)\n"; -} else if (pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) { -ss << "0; i < gid0+"<< nCurWindowSize <<"; i++)\n"; -} else { -ss << "0; i < "<< nCurWindowSize <<"; i++)\n"; -} -ss << "{\n"; -if(!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) -{ -ss << "int doubleIndex =i+gid0;\n"; -}else -{ -ss << "int doubleIndex =i;\n"; -} - -CheckSubArgumentIsNan(ss,vSubArguments,0); -CheckSubArgumentIsNan(ss,vSubArguments,1); -ss << " tmp +=pow(tmp0,2) - pow(tmp1,2);\n"; -ss <<"}\n"; -} -else -{ -ss << "int singleIndex =gid0;\n"; -CheckAllSubArgumentIsNan(ss, vSubArguments); -ss << "tmp = pow(tmp0,2) - pow(tmp1,2);\n"; -} -ss << "return tmp;\n"; -ss << "}"; +GenerateRangeArgPair( 0, 1, vSubArguments, ss, +"if( !isnan(arg1) && !isnan(arg2))\n" +"tmp +=pow(arg1,2) - pow(arg2,2);\n" +); +ss << "return tmp;\n"; +ss << "}\n"; } void OpSumX2PY2::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 2, 2 ); +CHECK_PARAMETER_DOUBLEVECTORREF( 0 ); +CHECK_PARAMETER_DOUBLEVECTORREF( 1 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "int gid0=get_global_id(0);\n"; ss << "double tmp =0;\n"; -GenTmpVariables(ss,vSubArguments); -if(vSubArguments[0]->GetFormulaToken()->GetType() == -formula::svDoubleVectorRef) -{ -FormulaToken *tmpCur = vSubArguments[0]->GetFormulaToken(); -const formula::DoubleVectorRefToken*pCurDVR= static_cast(tmpCur); -size_t nCurWindowSize = pCurDVR->GetArrayLength() < -pCurDVR->GetRefRowSize() ? pCurDVR->GetArrayLength(): -pCurDVR->GetRefRowSize() ; -ss << "int i ;\n"; -ss << "for (i = "; -if (!pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed()) { -ss << "gid0; i < "<< nCurWindowSize <<"; i++)\n"; -} else if (pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) { -ss << "0; i < gid0+"<< nCurWindowSize <<"; i++)\n"; -} else { -ss << "0; i < "<< nCurWindowSize <<"; i++)\n"; -} -ss << "{\n"; -if(!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) -{ -ss << "int doubleIndex =i+gid0;\n"; -}else -{ -ss << "int doubleIndex =i;\n"; -} - -CheckSubArgumentIsNan(ss,vSubArguments,0); -CheckSubArgumentIsNan(ss,vSubArguments,1); -ss << " tmp +=pow(tmp0,2) + pow(tmp1,2);\n"; -ss <<"}\n"; -} -else -{ -ss << "int singleIndex =gid0;\n"; -CheckAllSubArgumentIsNan(ss, vSubArguments); -ss << "tmp = pow(tmp0,2) + pow(tmp1,2);\n"; -} +GenerateRangeArgPair( 0, 1, vSubArguments, ss, +"if( !isnan(arg1) && !isnan(arg2))\n" +"
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx |6 sc/source/core/opencl/op_financial.cxx | 402 ++- sc/source/core/opencl/op_financial.hxx | 54 +--- sc/source/core/opencl/op_statistical.cxx |2 sc/source/core/opencl/opbase.cxx | 96 --- sc/source/core/opencl/opbase.hxx | 15 + 6 files changed, 170 insertions(+), 405 deletions(-) New commits: commit e39f5eedc09fb79159bc764f1215d24afa9035e0 Author: Luboš Luňák AuthorDate: Tue Sep 20 09:57:21 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 17:52:27 2022 +0200 fix and simplify opencl IRR(), MIRR(), XIRR() and XNPV() Change-Id: Ie57e43458f7fa5a769806d0fe3054745ec71c99e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140221 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index b4e35e932ba5..87c34f53ef1c 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -3024,11 +3024,11 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); } -/*else if (pChild->GetExternal() == "com.sun.star.sheet.addin.Analysis.getXirr") +else if (pChild->GetExternal() == "com.sun.star.sheet.addin.Analysis.getXirr") { mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], -std::make_shared(), nResultSize)); +} else if (pChild->GetExternal() == "com.sun.star.sheet.addin.Analysis.getOddlprice") { mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 83c9472e6c22..92263d78abb4 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -18,13 +18,13 @@ namespace sc::opencl { // Definitions of inline functions #include "op_financial_helpers.hxx" -void RRI::GenSlidingWindowFunction( +void OpRRI::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { CHECK_PARAMETER_COUNT( 3, 3 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; -ss << "double tmp = " << GetBottom() <<";\n"; +ss << "double tmp;\n"; ss << "int gid0 = get_global_id(0);\n"; GenerateArg( "nper", 0, vSubArguments, ss ); GenerateArg( "pv", 1, vSubArguments, ss ); @@ -402,251 +402,64 @@ vSubArguments) ss <<"}"; } -void IRR::GenSlidingWindowFunction(outputstream , +void OpIRR::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { CHECK_PARAMETER_COUNT( 2, 2 ); +CHECK_PARAMETER_DOUBLEVECTORREF( 0 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "#define Epsilon 1.0E-7\n"; ss << "int gid0 = get_global_id(0);\n"; -FormulaToken* pSur = vSubArguments[1]->GetFormulaToken(); -assert(pSur); -ss << "double fEstimated = "; -ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n"; +GenerateArgWithDefault( "fEstimated", 1, 0.1, vSubArguments, ss ); ss << "double fEps = 1.0;\n"; -ss << "double x = 0.0, xNew = 0.0, fNumerator = 0.0, fDenominator = 0.0;\n"; +ss << "double xNew = 0.0, fNumerator = 0.0, fDenominator = 0.0;\n"; ss << "double nCount = 0.0;\n"; -if (pSur->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken* pSVR = -static_cast< const formula::SingleVectorRefToken* >(pSur); -ss << "if (gid0 >= " << pSVR->GetArrayLength() << ")\n"; -ss << "fEstimated = 0.1;\n"; -ss << "if (isnan(fEstimated))\n"; -ss << "x = 0.1;\n"; -ss << "else\n"; -} -else if (pSur->GetType() == formula::svDouble) -{ -ss << "if (isnan(fEstimated))\n"; -ss << "x = 0.1;\n"; -ss << "else\n"; -} -ss << "x = fEstimated;\n"; ss << "unsigned short nItCount = 0;\n"; -ss << "while (fEps > Epsilon && nItCount < 20){\n"; +ss << "double x = fEstimated;\n"; +ss << "while (fEps > Epsilon && nItCount < 20)\n"; +ss << "{\n"; ss << "nCount = 0.0; fNumerator = 0.0; fDenominator = 0.0;\n"; -ss << "double arg0, arg1;\n"; -ss << "int i = 0;\n"; -FormulaToken* pCur = vSubArguments[0]->GetFormulaToken(); -assert(pCur); -const formula::DoubleVectorRefToken* pDVR = -static_cast(pCur); -size_t nCurWindowSize = pDVR->GetRefRowSize(); -ss << "
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/compiler.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 8615b106366896d944ff16aa8112d8610a0521e9 Author: Luboš Luňák AuthorDate: Mon Sep 19 17:50:42 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 08:46:30 2022 +0200 an implicit intersection requires a svDoubleVectorRef This was claiming e.g. =TTEST(A1:A10,B1:B10,1,2) had implicit intersections because the 3rd and 4th arguments were found to be implicit intersections. Change-Id: I9cba7e63330dd170ef0ea1ab03d33a653000e669 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140189 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index fd18ad624377..fc97ae0a6bf7 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -6245,7 +6245,8 @@ bool ScCompiler::HandleIIOpCodeInternal(FormulaToken* token, FormulaToken*** ppp bool possibleII = false; for( int i = 0; i < nNumParams; ++i ) { -if( ParameterMayBeImplicitIntersection( token, i )) +if( ParameterMayBeImplicitIntersection( token, i ) +&& (*pppToken[i])->GetType() == svDoubleRef) { possibleII = true; break;
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/formulagroupcl.cxx | 16 sc/source/core/opencl/op_statistical.cxx | 1399 --- sc/source/core/opencl/op_statistical.hxx | 158 ++- sc/source/core/opencl/opbase.cxx |7 sc/source/core/opencl/opbase.hxx |6 5 files changed, 326 insertions(+), 1260 deletions(-) New commits: commit 66ad69f5b300060f174fdc6c6e106dbba2b0140a Author: Luboš Luňák AuthorDate: Mon Sep 19 17:51:02 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 08:46:10 2022 +0200 correct handling of 'nested' in opencl vectors The 'nested' arguments means the value is used inside a loop, which already implicitly does range checking. Change-Id: I71ccbded2f9d623f58d11f11316aab28385f1614 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140193 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 564ee9cc6393..b4e35e932ba5 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -915,8 +915,8 @@ public: virtual std::string GenSlidingWindowDeclRef( bool nested ) const override { outputstream ss; -ss << "(!isnan(" << VectorRef::GenSlidingWindowDeclRef(); -ss << ")?" << VectorRef::GenSlidingWindowDeclRef(); +ss << "(!isnan(" << VectorRef::GenSlidingWindowDeclRef(nested); +ss << ")?" << VectorRef::GenSlidingWindowDeclRef(nested); ss << ":" << mStringArgument.GenSlidingWindowDeclRef(nested); ss << ")"; return ss.str(); @@ -977,18 +977,18 @@ std::string DynamicKernelSlidingArgument::GenSlidingWindowDeclRef( bool ne outputstream ss; if (!bIsStartFixed && !bIsEndFixed) { -if (nested) +if (!nested) ss << "((i+gid0) <" << nArrayLength << "?"; ss << Base::GetName() << "[i + gid0]"; -if (nested) +if (!nested) ss << ":NAN)"; } else { -if (nested) +if (!nested) ss << "(i <" << nArrayLength << "?"; ss << Base::GetName() << "[i]"; -if (nested) +if (!nested) ss << ":NAN)"; } return ss.str(); @@ -1146,8 +1146,8 @@ public: virtual std::string GenSlidingWindowDeclRef( bool nested ) const override { outputstream ss; -ss << "(!isnan(" << mDoubleArgument.GenSlidingWindowDeclRef(); -ss << ")?" << mDoubleArgument.GenSlidingWindowDeclRef(); +ss << "(!isnan(" << mDoubleArgument.GenSlidingWindowDeclRef(nested); +ss << ")?" << mDoubleArgument.GenSlidingWindowDeclRef(nested); ss << ":" << mStringArgument.GenSlidingWindowDeclRef(nested); ss << ")"; return ss.str(); commit 4c2b8db7814dead51607935c50c1d0160333d616 Author: Luboš Luňák AuthorDate: Mon Sep 19 17:50:58 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 08:45:48 2022 +0200 reduce opencl copy in op_statistical.cxx (svDoubleVectorRef pair) Change-Id: I92daab29290c9d72f7531b25950c7f52084cc0bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140192 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 29e150de10cd..f4bf77715cde 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -586,293 +586,6 @@ void OpStDevP::GenSlidingWindowFunction(outputstream , ss << "}\n"; } -void OpSlope::GenSlidingWindowFunction(outputstream , -const std::string , SubArguments ) -{ -CHECK_PARAMETER_COUNT(2,2); -GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); -ss << "{\n"; -ss << "int gid0 = get_global_id(0);\n"; -ss << "double fSumX = 0.0;\n"; -ss << "double fSumY = 0.0;\n"; -ss << "double fMeanX = 0.0;\n"; -ss << "double fMeanY = 0.0;\n"; -ss << "double fSumDeltaXDeltaY = 0.0;\n"; -ss << "double fSumSqrDeltaX = 0.0;\n"; -ss << "double fCount = 0.0;\n"; -ss << "double argX = 0.0;\n"; -ss << "double argY = 0.0;\n"; -FormulaToken *pCur = vSubArguments[1]->GetFormulaToken(); -FormulaToken *pCur1 = vSubArguments[0]->GetFormulaToken(); -assert(pCur); -assert(pCur1); -if (pCur->GetType() == formula::svDoubleVectorRef&& -pCur1->GetType() == formula::svDoubleVectorRef) -{ -const formula::DoubleVectorRefToken* pDVR = -static_cast(pCur); -const formula::DoubleVectorRefToken* pDVR1 = -static_cast(pCur1); - -size_t nCurWindowSize = pDVR->GetRefRowSize(); -size_t nCurWindowSize1 = pDVR1->GetRefRowSize(); -size_t arrayLength = pDVR->GetArrayLength()< - pDVR1->GetArrayLength() ? pDVR->GetArrayLength(): -pDVR1->GetArrayLength();
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_statistical.cxx | 382 ++- sc/source/core/opencl/opbase.cxx | 94 ++- sc/source/core/opencl/opbase.hxx | 15 - 3 files changed, 170 insertions(+), 321 deletions(-) New commits: commit 0513d1954c37f62cfb5336a640d3c336d3641e84 Author: Luboš Luňák AuthorDate: Mon Sep 19 17:50:55 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 08:45:30 2022 +0200 reduce opencl copy when handling a pair of svDoubleVectorRef Some functions run one loop iterating two svDoubleVectorRef. Change-Id: I849becd7863a1740277e6da9625bc7daad4b5274 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140191 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 9f14c0bbdd40..29e150de10cd 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -154,311 +154,89 @@ void OpTTest::GenSlidingWindowFunction(outputstream , ss << "double fSumSqr2 = 0.0;\n"; ss << "double fCount1 = 0.0;\n"; ss << "double fCount2 = 0.0;\n"; -ss << "double arg1 = 0.0;\n"; -ss << "double arg2 = 0.0;\n"; -ss << "double mode = 0.0;\n"; -ss << "double type = 0.0;\n"; ss << "double fT = 0.0;\n"; ss << "double fF = 0.0;\n"; -if(vSubArguments.size() != 4) -{ -ss << "return DBL_MAX;\n"; -ss << "}\n"; -return ; -} -if(vSubArguments.size() == 4) -{ -FormulaToken *pCur = vSubArguments[0]->GetFormulaToken(); -FormulaToken *pCur1 = vSubArguments[1]->GetFormulaToken(); -FormulaToken *pCur2 = vSubArguments[2]->GetFormulaToken(); -FormulaToken *pCur3 = vSubArguments[3]->GetFormulaToken(); -assert(pCur); -assert(pCur1); -assert(pCur2); -assert(pCur3); -if(ocPush == vSubArguments[2]->GetFormulaToken()->GetOpCode()) -{ -if(pCur2->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken* pSVR = -static_cast< const formula::SingleVectorRefToken*>(pCur2); -ss << "if (gid0 < " << pSVR->GetArrayLength() << ")\n"; -ss << "{\n"; -ss << "mode = " ; -ss << vSubArguments[2]->GenSlidingWindowDeclRef() << ";\n"; -ss << "if (isnan(mode))\n"; -ss << "mode = 0.0;\n"; -ss << "else\n"; -ss << "mode = floor(mode);\n"; -ss << "}\n"; -} -else if(pCur2->GetType() == formula::svDouble) -{ -ss << "mode = floor(convert_double("; -ss << pCur2->GetDouble() << "));\n"; -} -else -{ -ss << "return DBL_MAX;\n"; -ss << "}\n"; -return ; -} -} -else -{ -ss << "mode = floor(" ; -ss << vSubArguments[2]->GenSlidingWindowDeclRef() << ");\n"; -} -ss << "if(!(mode == 1.0 || mode == 2.0))\n"; -ss << "return DBL_MAX;\n"; -if(ocPush==vSubArguments[3]->GetFormulaToken()->GetOpCode()) -{ -if(pCur3->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken* pSVR = -static_cast< const formula::SingleVectorRefToken*>(pCur3); -assert(pSVR); -ss << "if (gid0 < " << pSVR->GetArrayLength() << ")\n"; -ss << "{\n"; -ss << "if (isnan("; -ss << vSubArguments[3]->GenSlidingWindowDeclRef() << "))\n"; -ss << "type=0.0;\n"; -ss << "else\n"; -ss << "type=floor("; -ss << vSubArguments[3]->GenSlidingWindowDeclRef() << ");\n"; -ss << "}\n"; -} -else if(pCur3->GetType() == formula::svDouble) -{ -ss << "type = floor(convert_double(" << pCur3->GetDouble() << -"));\n"; -} -else -{ -ss << "return DBL_MAX;\n"; -ss << "}\n"; -return ; -} -} -else -{ -ss << "type=floor("; -ss << vSubArguments[3]->GenSlidingWindowDeclRef() << ");\n"; -} -ss << "if(!(type == 1.0||type == 2.0||type == 3.0))\n"; -ss << "return DBL_MAX;\n"; - -if(pCur->GetType() == formula::svDoubleVectorRef && - pCur1->GetType() == formula::svDoubleVectorRef) -{ -const
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_financial.cxx | 318 --- sc/source/core/opencl/op_financial.hxx |5 sc/source/core/opencl/op_math.cxx| 257 -- sc/source/core/opencl/op_math.hxx|2 sc/source/core/opencl/op_statistical.cxx | 2888 --- sc/source/core/opencl/op_statistical.hxx | 31 sc/source/core/opencl/opbase.cxx |6 sc/source/core/opencl/opbase.hxx |2 8 files changed, 508 insertions(+), 3001 deletions(-) New commits: commit 4797becd04ccd8447f933b8aa3de4477c740a273 Author: Luboš Luňák AuthorDate: Mon Sep 19 17:43:22 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 08:44:50 2022 +0200 reduce opencl copy WRT simple loops with svDoubleVectorRef Change-Id: Id68808d5b390c0771e82bf391930a840f423c1e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140188 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 4d80efb53751..3073ba33195a 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -341,31 +341,17 @@ void Fvschedule::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { CHECK_PARAMETER_COUNT( 2, 2 ); -FormulaToken* pCur = vSubArguments[1]->GetFormulaToken(); -assert(pCur); -if(vSubArguments[0]->GetFormulaToken()->GetType() != formula::svDoubleVectorRef) -throw Unhandled( __FILE__, __LINE__ ); -const formula::DoubleVectorRefToken* pCurDVR = -static_cast(pCur); -size_t nCurWindowSize = pCurDVR->GetRefRowSize(); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n\t"; ss << "double tmp = 1.0;\n\t"; -ss << "int gid0 = get_global_id(0);\n\t"; -ss << "double arg0 = " << vSubArguments[0]->GenSlidingWindowDeclRef(); -ss << ";\n\t"; -ss << "if (isnan(arg0))\n\t\t"; -ss << "arg0 = 0;\n\t"; -ss << "double arg1;\n\t"; -ss << "int arrayLength = " << pCurDVR->GetArrayLength() << ";\n\t"; -ss << "for (int i = 0; i + gid0 < arrayLength &&"; -ss << " i < " << nCurWindowSize << "; i++){\n\t\t"; -ss << "arg1 = "; -ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n\t\t\t"; -ss << "if (isnan(arg1))\n\t\t\t\t"; -ss << "arg1 = 0;\n\t\t\t"; -ss << "tmp *= arg1 + 1.0;\n\t\t"; -ss << "}\n\t"; +ss << "int gid0 = get_global_id(0);\n"; +GenerateArg( 0, vSubArguments, ss ); +ss << "\t"; +GenerateRangeArg( 1, vSubArguments, ss, +"if(!isnan(arg))\n" +"tmp *= arg + 1;\n" +); +ss << "\t"; ss << "return (double)tmp * arg0"; ss << ";\n}"; } @@ -727,41 +713,12 @@ void MIRR::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { CHECK_PARAMETER_COUNT( 3, 3 ); -FormulaToken* pCur = vSubArguments[0]->GetFormulaToken(); -assert(pCur); -const formula::DoubleVectorRefToken* pCurDVR = -static_cast(pCur); -size_t nCurWindowSize = pCurDVR->GetRefRowSize(); -FormulaToken* pCur1 = vSubArguments[1]->GetFormulaToken(); -assert(pCur1); -const formula::SingleVectorRefToken* pSVR1 = -static_cast< const formula::SingleVectorRefToken* >(pCur1); -assert(pSVR1); -FormulaToken* pCur2 = vSubArguments[2]->GetFormulaToken(); -assert(pCur2); -const formula::SingleVectorRefToken* pSVR2 = -static_cast< const formula::SingleVectorRefToken* >(pCur2); -assert(pSVR2); - GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n\t"; ss << "double tmp = " << GetBottom() <<";\n\t"; ss << "int gid0 = get_global_id(0);\n\t"; -ss << "double arg0, arg1, arg2;\n\t"; -ss << "arg1 = " << vSubArguments[1]->GenSlidingWindowDeclRef(); -ss << ";\n\t"; -ss << "arg2 = " << vSubArguments[2]->GenSlidingWindowDeclRef(); -ss << ";\n\t"; -ss << "int argLen1 = " << pSVR1->GetArrayLength() << ";\n\t"; -ss << "int argLen2 = " << pSVR2->GetArrayLength() << ";\n\t"; -ss << "if (gid0 >= argLen1)\n\t\t"; -ss << "arg1 = 0.0;\n\t"; -ss << "if (gid0 >= argLen2)\n\t\t"; -ss << "arg2 = 0.0;\n\t"; -ss << "if (isnan(arg1))\n\t\t"; -ss << "arg1 = 0.0;\n\t"; -ss << "if (isnan(arg2))\n\t\t"; -ss << "arg2 = 0.0;\n\t"; +GenerateArg( 1, vSubArguments, ss ); +GenerateArg( 2, vSubArguments, ss ); ss << "double invest = arg1 + 1.0;\n\t"; ss << "double reinvest = arg2 + 1.0;\n\t"; ss << "double NPV_invest = 0.0;\n\t"; @@ -769,21 +726,18 @@ void MIRR::GenSlidingWindowFunction( ss << "double NPV_reinvest = 0.0;\n\t"; ss << "double Pow_reinvest = 1.0;\n\t"; ss << "int nCount = 0;\n\t"; -ss << "int arrayLength = " << pCurDVR->GetArrayLength() << ";\n\t"; -ss << "for (int i = 0; i + gid0 < arrayLength &&"; -ss << " i < " << nCurWindowSize << "; i++){\n\t\t"; -ss << "arg0 = "
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/op_statistical.cxx | 1410 +++ sc/source/core/opencl/opbase.cxx | 85 + sc/source/core/opencl/opbase.hxx |9 3 files changed, 231 insertions(+), 1273 deletions(-) New commits: commit f0466cabc2d33877d5aaa86fcf71db753f400873 Author: Luboš Luňák AuthorDate: Mon Sep 19 17:43:19 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 08:44:30 2022 +0200 reduce opencl copy also when handling svDoubleVectorRef This is for when a simple loop is enough to handle the ranges. Change-Id: Ia2fa3b6944573f30fafea614a9ec51a21c7e8226 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140187 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index cdbfe8b10679..aedabb4fc14c 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -19,6 +19,7 @@ namespace sc::opencl { void OpVar::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 1, 30 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "int gid0 = get_global_id(0);\n"; @@ -26,160 +27,18 @@ void OpVar::GenSlidingWindowFunction(outputstream , ss << "double fMean = 0.0;\n"; ss << "double vSum = 0.0;\n"; ss << "double fCount = 0.0;\n"; -ss << "double arg = 0.0;\n"; -unsigned i = vSubArguments.size(); -while (i--) -{ -FormulaToken *pCur = vSubArguments[i]->GetFormulaToken(); -assert(pCur); -if(ocPush == vSubArguments[i]->GetFormulaToken()->GetOpCode()) -{ -if (pCur->GetType() == formula::svDoubleVectorRef) -{ -const formula::DoubleVectorRefToken* pDVR = -static_cast(pCur); -size_t nCurWindowSize = pDVR->GetRefRowSize(); -ss << "for (int i = "; -if (!pDVR->IsStartFixed() && pDVR->IsEndFixed()) -{ -ss << "gid0; i < " << pDVR->GetArrayLength(); -ss << " && i < " << nCurWindowSize << "; i++)\n"; -ss << "{\n"; -} -else if (pDVR->IsStartFixed() && !pDVR->IsEndFixed()) -{ -ss << "0; i < " << pDVR->GetArrayLength(); -ss << " && i < gid0+" << nCurWindowSize << "; i++)\n"; -ss << "{\n"; -} -else if (!pDVR->IsStartFixed() && !pDVR->IsEndFixed()) -{ -ss << "0; i + gid0 < " << pDVR->GetArrayLength(); -ss << " && i < " << nCurWindowSize << "; i++)\n"; -ss << "{\n"; -} -else -{ -ss << "0; i < " << pDVR->GetArrayLength() << "; i++)\n"; -ss << "{\n"; -} -ss << "arg = "; -ss << vSubArguments[i]->GenSlidingWindowDeclRef(); -ss << ";\n"; -ss << "if (isnan(arg))\n"; -ss << "continue;\n"; -ss << "fSum += arg;\n"; -ss << "fCount += 1.0;\n"; -ss << "}\n"; -} -else if (pCur->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken* pSVR = -static_cast< const formula::SingleVectorRefToken*>(pCur); -ss << "if (gid0 < " << pSVR->GetArrayLength() << ")\n"; -ss << "{\n"; -ss << "arg = "; -ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n"; -ss << "if (!isnan(arg))\n"; -ss << "{\n"; -ss << "fSum += arg;\n"; -ss << "fCount += 1.0;\n"; -ss << "}\n"; -ss << "}\n"; -} -else -{ -ss << "arg = " << pCur->GetDouble() << ";\n"; -ss << "fSum += arg;\n"; -ss << "fCount += 1.0;\n"; -} -} -else -{ -ss << "arg = "; -ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n"; -ss << "fSum += arg;\n"; -ss << "fCount += 1.0;\n"; -} -if (i == 0) -{ -ss << "fMean = fSum / fCount;\n"; -} -} -i = vSubArguments.size(); -while (i--) -{ -FormulaToken *pCur = vSubArguments[i]->GetFormulaToken(); -assert(pCur); -if(ocPush == vSubArguments[i]->GetFormulaToken()->GetOpCode()) -{ -
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_financial.cxx | 3070 + 1 file changed, 514 insertions(+), 2556 deletions(-) New commits: commit c443a02ec9db419527566b6f80f413c45dea3be5 Author: Luboš Luňák AuthorDate: Mon Sep 19 17:43:07 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 20 08:43:37 2022 +0200 reduce opencl copy and fix in op_financial.cxx Change-Id: Ia1cd64f68b75f445c15ec5f8088e9202fa39768e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140185 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 863fa2552cab..4d80efb53751 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -26,103 +26,26 @@ void RRI::GenSlidingWindowFunction( ss << "{\n"; ss << "double tmp = " << GetBottom() <<";\n"; ss << "int gid0 = get_global_id(0);\n"; -ss << "double fv;\n"; -ss << "double pv;\n"; -ss << "double nper;\n"; -FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken(); -const formula::SingleVectorRefToken*tmpCurDVR0= static_cast(tmpCur0); - -FormulaToken *tmpCur1 = vSubArguments[1]->GetFormulaToken(); -const formula::SingleVectorRefToken*tmpCurDVR1= static_cast(tmpCur1); - -FormulaToken *tmpCur2 = vSubArguments[2]->GetFormulaToken(); -const formula::SingleVectorRefToken*tmpCurDVR2= static_cast(tmpCur2); - -ss<< "int buffer_nper_len = "; -ss<< tmpCurDVR0->GetArrayLength(); -ss << ";\n"; - -ss<< "int buffer_pv_len = "; -ss<< tmpCurDVR1->GetArrayLength(); -ss << ";\n"; - -ss<< "int buffer_fv_len = "; -ss<< tmpCurDVR2->GetArrayLength(); -ss << ";\n"; - -ss<<"if(gid0>=buffer_nper_len || isnan("; -ss << vSubArguments[0]->GenSlidingWindowDeclRef(); -ss<<"))\n"; -ss<<"nper = 0;\n\telse \n"; -ss<<"nper = "; -ss << vSubArguments[0]->GenSlidingWindowDeclRef(); -ss<<";\n"; - -ss<<"if(gid0>=buffer_pv_len || isnan("; -ss << vSubArguments[1]->GenSlidingWindowDeclRef(); -ss<<"))\n"; -ss<<"pv = 0;\n\telse \n"; -ss<<"pv = "; -ss << vSubArguments[1]->GenSlidingWindowDeclRef(); -ss<<";\n"; - -ss<<"if(gid0>=buffer_pv_len || isnan("; -ss << vSubArguments[2]->GenSlidingWindowDeclRef(); -ss<<"))\n"; -ss<<"fv = 0;\n\telse \n"; -ss<<"fv = "; -ss << vSubArguments[2]->GenSlidingWindowDeclRef(); -ss<<";\n"; +GenerateArg( "nper", 0, vSubArguments, ss ); +GenerateArg( "pv", 1, vSubArguments, ss ); +GenerateArg( "fv", 2, vSubArguments, ss ); +ss << "if ( nper <= 0.0 || pv == 0 )\n"; +ss << " return CreateDoubleError(IllegalArgument);\n"; ss << "tmp = pow(fv/pv,1.0/nper)-1;\n"; ss << "return tmp;\n"; ss << "}"; } void OpNominal::GenSlidingWindowFunction( -outputstream , const std::string , SubArguments & -vSubArguments) +outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 2, 2 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n\t"; -ss << "double tmp = 0;\n\t"; -ss << "double temp = 0;\n\t"; ss << "int gid0 = get_global_id(0);\n\t"; -ss << "double tmp0=0,tmp1=0;\n"; -for (size_t i = 0; i < vSubArguments.size(); i++) -{ -FormulaToken *pCur = vSubArguments[i]->GetFormulaToken(); -assert(pCur); -if (pCur->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken* pSVR = -static_cast< const formula::SingleVectorRefToken* >(pCur); -ss << "if (gid0 < " << pSVR->GetArrayLength() << "){\n"; -} -else if (pCur->GetType() == formula::svDouble) -{ -ss << "{\n"; -} - -if(ocPush==vSubArguments[i]->GetFormulaToken()->GetOpCode()) -{ -ss <<"temp="GetFormulaToken(); -const formula::SingleVectorRefToken*tmpCurDVR1= static_cast(tmpCur1); -ss<< "int buffer_dollar_len = "; -ss<< tmpCurDVR0->GetArrayLength(); -ss << ";\n\t"; -ss<< "int buffer_frac_len = "; -ss<< tmpCurDVR1->GetArrayLength(); -ss << ";\n\t"; -ss<<"if((gid0)>=buffer_dollar_len || isnan("; -ss << vSubArguments[0]->GenSlidingWindowDeclRef(); -ss<<"))\n\t\t"; -ss<<"dollar = 0;\n\telse \n\t\t"; -ss<<"dollar = "; -ss << vSubArguments[0]->GenSlidingWindowDeclRef(); -ss<<";\n\t"; -ss<<"if((gid0)>=buffer_frac_len || isnan("; -ss << vSubArguments[1]->GenSlidingWindowDeclRef(); -ss<<"))\n\t\t"; -
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx | 1088 +- sc/source/core/opencl/op_math.cxx | 399 +++ sc/source/core/opencl/op_math.hxx | 253 ++ sc/source/core/opencl/op_math_helpers.hxx | 76 ++ sc/source/core/opencl/opbase.hxx | 100 ++ 5 files changed, 1008 insertions(+), 908 deletions(-) New commits: commit bbc07c964ef9a4698b3867ff554259adcf81bc58 Author: Luboš Luňák AuthorDate: Thu Sep 15 09:57:16 2022 +0200 Commit: Luboš Luňák CommitDate: Mon Sep 19 17:29:58 2022 +0200 move code out of formulagroupcl.cxx to op_math* and opbase* formulagroupcl.cxx is already large enough, move away code that implements some operations and also move some type declarations to a header. Change-Id: I28fe59275f4fb89c3e530d77b08e7f2fcad02781 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139971 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 28b4c87fdb07..564ee9cc6393 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -34,14 +33,6 @@ #include -// FIXME: The idea that somebody would bother to (now and then? once a year? once a month?) manually -// edit a source file and change the value of some #defined constant and run some ill-defined -// "correctness test" is of course ludicrous. Either things are checked in normal unit tests, in -// every 'make check', or not at all. The below comments are ridiculous. - -#define REDUCE_THRESHOLD 201 // set to 4 for correctness testing. priority 1 -#define UNROLLING_FACTOR 16 // set to 4 for correctness testing (if no reduce) - const char* const publicFunc = "\n" "#define IllegalArgument 502\n" @@ -61,76 +52,8 @@ const char* const publicFunc = // "return nan(nErr);\n" "}\n" "\n" - "uint GetDoubleErrorValue(double fVal)\n" - "{\n" - "if (isfinite(fVal))\n" - "return 0;\n" - "if (isinf(fVal))\n" - "return IllegalFPOperation; // normal INF\n" - "if (as_ulong(fVal) & 0Xu)\n" - "return NoValue;// just a normal NAN\n" - "return (as_ulong(fVal) & 0X); // any other error\n" - "}\n" - "\n" - "double fsum_count(double a, double b, __private int *p) {\n" - "bool t = isnan(a);\n" - "(*p) += t?0:1;\n" - "return t?b:a+b;\n" - "}\n" - "double fmin_count(double a, double b, __private int *p) {\n" - "double result = fmin(a, b);\n" - "bool t = isnan(result);\n" - "(*p) += t?0:1;\n" - "return result;\n" - "}\n" - "double fmax_count(double a, double b, __private int *p) {\n" - "double result = fmax(a, b);\n" - "bool t = isnan(result);\n" - "(*p) += t?0:1;\n" - "return result;\n" - "}\n" "double fsum(double a, double b) { return isnan(a)?b:a+b; }\n" "double legalize(double a, double b) { return isnan(a)?b:a;}\n" - "double fsub(double a, double b) { return a-b; }\n" - "double fdiv(double a, double b) { return a/b; }\n" - "int is_representable_integer(double a) {\n" - "long kMaxInt = (1L << 53) - 1;\n" - "if (a <= as_double(kMaxInt))\n" - "{\n" - "long nInt = as_long(a);\n" - "double fInt;\n" - "return (nInt <= kMaxInt &&\n" - "(!((fInt = as_double(nInt)) < a) && !(fInt > a)));\n" - "}\n" - "return 0;\n" - "}\n" - "int approx_equal(double a, double b) {\n" - "double e48 = 1.0 / (16777216.0 * 16777216.0);\n" - "double e44 = e48 * 16.0;\n" - "if (a == b)\n" - "return 1;\n" - "if (a == 0.0 || b == 0.0)\n" - "return 0;\n" - "double d = fabs(a - b);\n" - "if (!isfinite(d))\n" - "return 0; // Nan or Inf involved\n" - "if (d > ((a = fabs(a)) * e44) || d > ((b = fabs(b)) * e44))\n" - "return 0;\n" - "if (is_representable_integer(d) && is_representable_integer(a) && is_representable_integer(b))\n" - "return 0; // special case for representable integers.\n" - "return (d < a * e48 && d < b * e48);\n" - "}\n" - "double fsum_approx(double a, double b) {\n" - "if ( ((a < 0.0 && b > 0.0) || (b < 0.0 && a > 0.0))\n" - " && approx_equal( a, -b ) )\n" - "return 0.0;\n" - "return a + b;\n" - "}\n" - "double fsub_approx(double a, double b) {\n" - "if ( ((a < 0.0 && b < 0.0) || (a > 0.0 && b > 0.0)) && approx_equal( a, b ) )\n" - "return 0.0;\n" - "return a - b;\n" - "}\n" ; #include @@ -868,27 +791,6 @@ threefry2x32 (threefry2x32_ctr_t in, threefry2x32_key_t k)\n\ } }; -/// A vector of strings -class DynamicKernelStringArgument : public VectorRef -{ -public: -DynamicKernelStringArgument( const ScCalcConfig& config, const std::string& s, -const FormulaTreeNodeRef& ft, int index = 0 ) : -VectorRef(config, s, ft, index) {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/source
sc/source/core/data/fillinfo.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit b2a5fa061c7e254a39b08523f2c6988baf699938 Author: Luboš Luňák AuthorDate: Wed Sep 14 08:02:13 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Sep 15 10:09:08 2022 +0200 fix off-by-one in Calc shadow handling (tdf#150931) A mistake from d48e68407931fc33044aa7f3fc9e971897fac610, the number is off as can be seen when compared to the bRightDiff part above. Change-Id: Id87d69c45cd3336ab8a122a2cae505a16848cdf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139902 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 308174945174bfd67f0444ef0c29634a4ecd961b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139844 Reviewed-by: Xisco Fauli diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index e76ef808b8b6..a6fa1b3183e9 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -807,8 +807,8 @@ void ScDocument::FillInfo( } if (bBottomDiff && bRightDiff) { - pRowInfo[nArrRow+1].cellInfo(nCol).pHShadowOrigin = pThisAttr; - pRowInfo[nArrRow+1].cellInfo(nCol).eHShadowPart = SC_SHADOW_CORNER; + pRowInfo[nArrRow+1].cellInfo(nCol+1).pHShadowOrigin = pThisAttr; + pRowInfo[nArrRow+1].cellInfo(nCol+1).eHShadowPart = SC_SHADOW_CORNER; } break;
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/fillinfo.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 308174945174bfd67f0444ef0c29634a4ecd961b Author: Luboš Luňák AuthorDate: Wed Sep 14 08:02:13 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 14 12:21:23 2022 +0200 fix off-by-one in Calc shadow handling (tdf#150931) A mistake from d48e68407931fc33044aa7f3fc9e971897fac610, the number is off as can be seen when compared to the bRightDiff part above. Change-Id: Id87d69c45cd3336ab8a122a2cae505a16848cdf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139902 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index b1b3fcad209f..7d5605607579 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -807,8 +807,8 @@ void ScDocument::FillInfo( } if (bBottomDiff && bRightDiff) { - pRowInfo[nArrRow+1].cellInfo(nCol).pHShadowOrigin = pThisAttr; - pRowInfo[nArrRow+1].cellInfo(nCol).eHShadowPart = SC_SHADOW_CORNER; + pRowInfo[nArrRow+1].cellInfo(nCol+1).pHShadowOrigin = pThisAttr; + pRowInfo[nArrRow+1].cellInfo(nCol+1).eHShadowPart = SC_SHADOW_CORNER; } break;
[Libreoffice-commits] core.git: vcl/inc vcl/skia
vcl/inc/skia/salbmp.hxx |2 +- vcl/skia/salbmp.cxx | 30 +++--- 2 files changed, 20 insertions(+), 12 deletions(-) New commits: commit 20de4e3ca38e177ea61e818b32d82008758b8caa Author: Luboš Luňák AuthorDate: Tue Sep 13 18:15:17 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Sep 14 08:05:18 2022 +0200 do not check and refcount Info access to Skia bitmaps (tdf#150817) VclCanvasBitmap keeps one around for no good reason, and I don't feel like digging into it. Since there's no pixel data involved in that case, let's assume the reader knows that the info about the bitmap will not change. Making this difference is actually what I suggested in 0e5b473a63409da2cdae4f4c60a91fcc93755ba5. Change-Id: I302a9c2c63c8b9474a541a963928933e223f4b45 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139873 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx index 05e489643f88..e79fb1cc101d 100644 --- a/vcl/inc/skia/salbmp.hxx +++ b/vcl/inc/skia/salbmp.hxx @@ -211,7 +211,7 @@ private: // Erase() is delayed, just sets these two instead of filling the buffer. bool mEraseColorSet = false; Color mEraseColor; -int mAnyAccessCount = 0; // number of any kind of AcquireAccess() that have not been released +int mReadAccessCount = 0; // number of read AcquireAccess() that have not been released #ifdef DBG_UTIL int mWriteAccessCount = 0; // number of write AcquireAccess() that have not been released #endif diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx index df3536b4de91..57cea14316c5 100644 --- a/vcl/skia/salbmp.cxx +++ b/vcl/skia/salbmp.cxx @@ -68,7 +68,7 @@ SkiaSalBitmap::SkiaSalBitmap(const sk_sp& image) #endif mSize = mPixelsSize = Size(image->width(), image->height()); ComputeScanlineSize(); -mAnyAccessCount = 0; +mReadAccessCount = 0; #ifdef DBG_UTIL mWriteAccessCount = 0; #endif @@ -78,7 +78,7 @@ SkiaSalBitmap::SkiaSalBitmap(const sk_sp& image) bool SkiaSalBitmap::Create(const Size& rSize, vcl::PixelFormat ePixelFormat, const BitmapPalette& rPal) { -assert(mAnyAccessCount == 0); +assert(mReadAccessCount == 0); ResetAllData(); if (ePixelFormat == vcl::PixelFormat::INVALID) return false; @@ -157,7 +157,7 @@ bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, vcl::PixelFormat eNewPixelFormat) { -assert(mAnyAccessCount == 0); +assert(mReadAccessCount == 0); assert( != this); ResetAllData(); const SkiaSalBitmap& src = static_cast(rSalBmp); @@ -195,7 +195,7 @@ void SkiaSalBitmap::Destroy() #ifdef DBG_UTIL assert(mWriteAccessCount == 0); #endif -assert(mAnyAccessCount == 0); +assert(mReadAccessCount == 0); ResetAllData(); } @@ -274,7 +274,12 @@ BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode) abort(); } buffer->mnFormat |= ScanlineFormat::TopDown; -++mAnyAccessCount; +// Refcount all read/write accesses, to catch problems with existing accesses while +// a bitmap changes, and also to detect when we can free mBuffer if wanted. +// Write mode implies also reading. It would be probably a good idea to count even +// Info accesses, but VclCanvasBitmap keeps one around pointlessly, causing tdf#150817. +if (nMode == BitmapAccessMode::Read || nMode == BitmapAccessMode::Write) +++mReadAccessCount; #ifdef DBG_UTIL if (nMode == BitmapAccessMode::Write) ++mWriteAccessCount; @@ -300,8 +305,11 @@ void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode, ResetToBuffer(); DataChanged(); } -assert(mAnyAccessCount > 0); ---mAnyAccessCount; +if (nMode == BitmapAccessMode::Read || nMode == BitmapAccessMode::Write) +{ +assert(mReadAccessCount > 0); +--mReadAccessCount; +} // Are there any more ground movements underneath us ? assert(pBuffer->mnWidth == mSize.Width()); assert(pBuffer->mnHeight == mSize.Height()); @@ -812,7 +820,7 @@ const sk_sp& SkiaSalBitmap::GetSkImage(DirectImage direct) const thisPtr->mImage = image; // The data is now stored both in the SkImage and in our mBuffer, so drop the buffer // if conserving memory. It'll be converted back by EnsureBitmapData() if needed. -if (ConserveMemory() && mAnyAccessCount == 0) +if (ConserveMemory() && mReadAccessCount == 0) { SAL_INFO("vcl.skia.trace", "getskimage(" << this << "): dropping buffer"); thisPtr->ResetToSkImage(mImage); @@ -968,7 +976,7 @@ const sk_sp& SkiaSalBitmap::GetAlphaSkImage(DirectImage direct) const // The data is now stored both in the SkImage and in our mBuffer, so drop the buffer // if conserving memory and the conversion back
[Libreoffice-commits] core.git: vcl/source
vcl/source/outdev/bitmap.cxx |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit f28087140a79949b7ba38cd9a724438ea92a44e8 Author: Luboš Luňák AuthorDate: Tue Sep 13 10:47:06 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 13 17:17:29 2022 +0200 do not assert on "failed" Skia call because of empty size (tdf#150821) There's no problem if the output size is actually empty. Change-Id: I680766919c65fcaad6687f09af28f6e95575c228 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139830 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 53a9f774b71d..f489efd7a038 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -347,7 +347,11 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r } // we need to make sure Skia never reaches this slow code path -assert(!SkiaHelper::isVCLSkiaEnabled()); +// (but do not fail in no-op cases) +assert(!SkiaHelper::isVCLSkiaEnabled() +|| tools::Rectangle(Point(), rBmp.GetSizePixel()) +.Intersection(tools::Rectangle(rSrcPtPixel, rSrcSizePixel)).IsEmpty() +|| mpAlphaVDev->LogicToPixel(mpAlphaVDev->GetOutputSizePixel()).IsEmpty()); } tools::Rectangle aBmpRect(Point(), rBmp.GetSizePixel());
[Libreoffice-commits] core.git: 2 commits - sc/source solenv/clang-format
sc/source/core/opencl/op_financial.cxx |2 sc/source/core/opencl/op_financial_helpers.hxx | 245 +- sc/source/core/opencl/op_math.cxx| 2429 ++- sc/source/core/opencl/op_math.hxx| 351 +-- sc/source/core/opencl/op_math_helpers.hxx| 39 sc/source/core/opencl/op_statistical.cxx |2 sc/source/core/opencl/op_statistical_helpers.hxx | 153 - sc/source/core/opencl/opbase.cxx |9 sc/source/core/opencl/opbase.hxx |4 sc/source/core/opencl/utils.hxx |5 solenv/clang-format/excludelist |6 11 files changed, 1066 insertions(+), 2179 deletions(-) New commits: commit aa0d6cb52979e29830596ec5a4e8e625500d6cb9 Author: Luboš Luňák AuthorDate: Tue Sep 6 12:38:00 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 13 09:05:34 2022 +0200 clean up opencl helper functions It seems a bit wasteful to use std::string for const strings. Change-Id: I31bb38f5cdcd0210f6f91144b3c37abae9301333 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139487 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 0840c334f7df..863fa2552cab 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -16,7 +16,7 @@ using namespace formula; namespace sc::opencl { // Definitions of inline functions -#include "opinlinefun_finacial.cxx" +#include "op_financial_helpers.hxx" void RRI::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) diff --git a/sc/source/core/opencl/opinlinefun_finacial.cxx b/sc/source/core/opencl/op_financial_helpers.hxx similarity index 94% rename from sc/source/core/opencl/opinlinefun_finacial.cxx rename to sc/source/core/opencl/op_financial_helpers.hxx index dd12767cf93a..eaf688af91c1 100644 --- a/sc/source/core/opencl/opinlinefun_finacial.cxx +++ b/sc/source/core/opencl/op_financial_helpers.hxx @@ -7,19 +7,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef SC_OPENCL_OPINLINFUN_finacial -#define SC_OPENCL_OPINLINFUN_finacial +#pragma once -std::string nCorrValDecl ="double constant nCorrVal[]" +const char nCorrValDecl[] ="double constant nCorrVal[]" "= {0, 9e-1, 9e-2, 9e-3, 9e-4, 9e-5, 9e-6, 9e-7, " "9e-8,9e-9, 9e-10, 9e-11, 9e-12, 9e-13, 9e-14, 9e-15};\n"; -std::string SCdEpsilonDecl = +const char SCdEpsilonDecl[] = "constant double SCdEpsilon = 1.0E-7;\n"; -std::string RoundDecl = "double Round(double fValue);\n"; +const char RoundDecl[] = "double Round(double fValue);\n"; -std::string Round = +const char Round[] = "double Round(double fValue)\n" "{\n" "if ( fValue == 0.0 )\n" @@ -40,10 +39,10 @@ std::string Round = "return fValue;\n" "}\n"; -std::string GetPMT_newDecl = +const char GetPMT_newDecl[] = "double GetPMT_new( double fRate, double fNper, double fPv, double fFv," "int nPayType );\n"; -std::string GetPMT_new= +const char GetPMT_new[] = "double GetPMT_new( double fRate, double fNper, double fPv, double fFv," "int nPayType)\n" "{\n" @@ -57,11 +56,11 @@ std::string GetPMT_new= "1.0 - 1.0 / fTerm);\n" "return -fPmt;\n" "}\n"; -std::string GetFVDecl = +const char GetFVDecl[] = "double GetFV( double fRate, double fNper, double fPmt," "double fPv, int nPayType );\n"; -std::string GetFV = +const char GetFV[] = "double GetFV( double fRate, double fNper, double fPmt," "double fPv, int nPayType )\n" "{\n" @@ -80,11 +79,11 @@ std::string GetFV = "return -fFv;\n" "}\n"; -std::string GetFV_newDecl = +const char GetFV_newDecl[] = "double GetFV_new( double fRate, double fNper, double fPmt," "double fPv, int nPayType );\n"; -std::string GetFV_new = +const char GetFV_new[] = "double GetFV_new( double fRate, double fNper, double fPmt," "double fPv, int nPayType )\n" "{\n" @@ -98,20 +97,20 @@ std::string GetFV_new = "return -fFv;\n" "}\n"; -std::string IsLeapYearDecl = +const char IsLeapYearDecl[] = "bool IsLeapYear( int n );\n"; -std::string IsLeapYear = +const char IsLeapYear[] = "bool IsLeapYear( int n )\n" "{\n" "return ( (( ( n % 4 ) == 0 ) && ( ( n % 100 ) != 0)) || ( ( n % 400 ) == " "0 ) );\n" "}\n"; -std::string DaysInMonthDecl= +const char DaysInMonthDecl[] = "int DaysInMonth( int nMonth, int nYear );\n"; -std::string DaysInMonth = +const char DaysInMonth[] = "int DaysInMonth( int nMonth, int nYear )\n" "{\n" "int aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,\n" @@ -127,10 +126,10 @@ std::string DaysInMonth = "return aDaysInMonth[nMonth-1];\n" "}\n" "}\n"; -std::string DaysInMonth_newDecl= +const char DaysInMonth_newDecl[] = "int DaysInMonth( int nMonth, int nYear );\n"; -std::string DaysInMonth_new = +const char DaysInMonth_new[] = "int DaysInMonth( int nMonth, int nYear )\n" "{\n" "
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/formulagroupcl.cxx | 32 - sc/source/core/opencl/op_addin.cxx | 124 - sc/source/core/opencl/op_array.cxx | 33 - sc/source/core/opencl/op_database.cxx| 121 - sc/source/core/opencl/op_financial.cxx | 586 - sc/source/core/opencl/op_logical.cxx | 346 +- sc/source/core/opencl/op_logical.hxx | 34 - sc/source/core/opencl/op_math.cxx| 657 sc/source/core/opencl/op_spreadsheet.cxx | 11 sc/source/core/opencl/op_statistical.cxx | 724 +-- sc/source/core/opencl/opbase.cxx | 45 + sc/source/core/opencl/opbase.hxx |6 12 files changed, 466 insertions(+), 2253 deletions(-) New commits: commit 7ed959dfe96f3a4edc0ee00f23473aac28734e1f Author: Luboš Luňák AuthorDate: Tue Sep 6 12:37:50 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 13 09:05:06 2022 +0200 reduce opencl copy in op_addin.cxx and op_logical.cxx The svDoubleVectorRef stuff in OpAnd etc. didn't make sense, those operators are required to do implicit intersection (which can be done in sc core in ScCompiler::HandleIIOpCodeInternal()). Change-Id: Ic970c8e649a651f6a804b5ed265fe2e08ff29681 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139485 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_addin.cxx b/sc/source/core/opencl/op_addin.cxx index a9c2f9508ac8..602ed2dfb36d 100644 --- a/sc/source/core/opencl/op_addin.cxx +++ b/sc/source/core/opencl/op_addin.cxx @@ -23,69 +23,8 @@ void OpBesselj::GenSlidingWindowFunction(outputstream , GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; ss << "int gid0 = get_global_id(0);\n"; -ss << "double x = 0.0;\n"; -ss << "double N = 0.0;\n"; -FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken(); -assert(tmpCur0); -if(ocPush == vSubArguments[0]->GetFormulaToken()->GetOpCode()) -{ -if(tmpCur0->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken*tmpCurSVR0 = -static_cast(tmpCur0); -ss << "if (gid0 < " << tmpCurSVR0->GetArrayLength() << ")\n"; -ss << "{\n"; -ss << "x = "; -ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n"; -ss << "if (isnan(x))\n"; -ss << "x = 0.0;\n"; -ss << "}\n"; -} -else if(tmpCur0->GetType() == formula::svDouble) -{ -ss << "x = " << tmpCur0->GetDouble() << ";\n"; -} -else -{ -throw Unhandled(__FILE__, __LINE__); -} -} -else -{ -ss << "x = "; -ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n"; -} - -FormulaToken *tmpCur1 = vSubArguments[1]->GetFormulaToken(); -assert(tmpCur1); -if(ocPush == vSubArguments[1]->GetFormulaToken()->GetOpCode()) -{ -if(tmpCur1->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken*tmpCurSVR1 = -static_cast(tmpCur1); -ss << "if (gid0 < " << tmpCurSVR1->GetArrayLength() << ")\n"; -ss << "{\n"; -ss << "N = "; -ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n"; -ss << "if (isnan(N))\n"; -ss << "N = 0.0;\n"; -ss << "}\n"; -} -else if(tmpCur1->GetType() == formula::svDouble) -{ -ss << "N = " << tmpCur1->GetDouble() << ";\n"; -} -else -{ -throw Unhandled(__FILE__, __LINE__); -} -} -else -{ -ss << "N = "; -ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n"; -} +GenerateArg( "x", 0, vSubArguments, ss ); +GenerateArg( "N", 1, vSubArguments, ss ); ss << "double f_2_DIV_PI = 2.0 / M_PI;\n"; ss << "if( N < 0.0 )\n"; ss << "return CreateDoubleError(IllegalArgument);\n"; @@ -170,44 +109,14 @@ void OpGestep::GenSlidingWindowFunction( outputstream ,const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 2, 2 ); GenerateFunctionDeclaration( sSymName, vSubArguments, ss ); ss << "{\n"; -ss << "double tmp=0,tmp0 =0,tmp1 = 0;\n"; +ss << "double tmp=0;\n"; ss << "int gid0=get_global_id(0);\n"; ss <<"\n"; -for (size_t i = 0; i < vSubArguments.size(); i++) -{ -FormulaToken *pCur = vSubArguments[i]->GetFormulaToken(); -assert(pCur); -if (pCur->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken& rSVR = -dynamic_cast< const formula::SingleVectorRefToken& >(*pCur); -ss <<
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-1' - sc/inc sc/source
sc/inc/column.hxx |2 - sc/inc/document.hxx|4 ++- sc/inc/formulacell.hxx |2 + sc/inc/rangecache.hxx |2 - sc/inc/table.hxx |2 - sc/source/core/data/column3.cxx| 44 + sc/source/core/data/documen2.cxx | 11 ++--- sc/source/core/data/document.cxx | 13 +++--- sc/source/core/data/table1.cxx |7 - sc/source/core/tool/rangecache.cxx |6 - 10 files changed, 65 insertions(+), 28 deletions(-) New commits: commit fc6cd5b1e214f6688dbfb5ffa70332b6bece8763 Author: Luboš Luňák AuthorDate: Tue Aug 23 19:47:50 2022 +0200 Commit: Xisco Fauli CommitDate: Fri Sep 9 19:16:28 2022 +0200 try harder to ensure InterpretCellsIfNeeded() interprets (tdf#150499) ScFormulaCell::Interpret() tries to interpret the whole formula group (or the given range of it), but it's not guaranteed, and possibly just the called cell will be interpreted. So if a specific range really needs to be interpreted, handle that case. Change-Id: I7fb563ae471eefd49e5bb6c92b6aff98c42a440e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138741 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit e1f02b8d00272be9cbf17cb8c351445a08a4c5f4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138814 Reviewed-by: Xisco Fauli (cherry picked from commit 92ad0da73f23376d65b5367b44dd0ac9f7c59a12) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138820 Reviewed-by: Christian Lohmaier Tested-by: Xisco Fauli diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index e4b7eb148d9a..aa5a5c689c01 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -721,7 +721,7 @@ public: bool IsDrawObjectsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ); -void InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 ); +bool InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 ); static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 959960e15e03..b4552e792000 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1363,7 +1363,9 @@ public: void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp void InterpretDirtyCells( const ScRangeList& rRanges ); // Interprets cells that have NeedsInterpret(), i.e. the same like calling MaybeInterpret() on them. -void InterpretCellsIfNeeded( const ScRangeList& rRanges ); +// Returns false if some couldn't be interpreted (i.e. they still have NeedsInterpret()). +// Useful to ensure that the given cells will not need interpreting. +bool InterpretCellsIfNeeded( const ScRangeList& rRanges ); SC_DLLPUBLIC void CalcAll(); SC_DLLPUBLIC void CalcAfterLoad( bool bStartListening = true ); void CompileAll(); diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 013a0058ba5d..789353efce9f 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -261,6 +261,8 @@ public: void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); // compile temporary string tokens void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ); boolMarkUsedExternalReferences(); +// Returns true if the cell was interpreted as part of the formula group. +// The parameters may limit which subset of the formula group should be interepreted, if possible. bool Interpret(SCROW nStartOffset = -1, SCROW nEndOffset = -1); bool IsIterCell() const { return bIsIterCell; } sal_uInt16 GetSeenInIteration() const { return nSeenInIteration; } diff --git a/sc/inc/rangecache.hxx b/sc/inc/rangecache.hxx index 7490a570f20a..c65e8653a458 100644 --- a/sc/inc/rangecache.hxx +++ b/sc/inc/rangecache.hxx @@ -46,7 +46,7 @@ class ScSortedRangeCache final : public SvtListener public: /// MUST be new'd because Notify() deletes. ScSortedRangeCache(ScDocument* pDoc, const ScRange& rRange, const ScQueryParam& param, - ScInterpreterContext* context); + ScInterpreterContext* context, bool invalid = false); /// Returns if the cache is usable. bool isValid() const { return mValid; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0a3bc6c67956..35388b54ea1f 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1057,7 +1057,7 @@ public: void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool* pPool ) const; void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); -void InterpretCellsIfNeeded( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4-1' - sc/source
sc/source/core/tool/interpr1.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 276037edb6f98ec1fa64e8740958668a1b30cef2 Author: Luboš Luňák AuthorDate: Fri Aug 26 16:10:38 2022 +0200 Commit: Christian Lohmaier CommitDate: Fri Sep 9 15:37:11 2022 +0200 fix undoing range reducing to apply only to COUNTIFS (tdf#150618) Before 7674399aac661eb503d7badc53b9a4d68bd9839d the code tried to range-reduce all operations except for COUNTIFS, the commit added handling also COUNTIFS and then later undo the rare cases when it shouldn't be done, but the undo wasn't specific to COUNTIFS even though it should have. Change-Id: Ibdb6516a1ac7bc7d34f16f8a99781859e9fc7b60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138880 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 5367616819e232e7ef2405c614bbfa3ca0d2aecf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138974 Reviewed-by: Caolán McNamara (cherry picked from commit e20d52afe5a33ae9490e238e7b5833d3df68f004) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139416 Reviewed-by: Xisco Fauli Reviewed-by: Eike Rathke Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index cc485e383038..0fd78f8b1a99 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -6092,9 +6092,10 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf rParam.eSearchType = DetectSearchType(rItem.maString.getString(), mrDoc); } -// Undo bRangeReduce if asked to match empty cells (which should be rare). +// Undo bRangeReduce if asked to match empty cells for COUNTIFS (which should be rare). assert(rEntry.GetQueryItems().size() == 1); -if((rEntry.IsQueryByEmpty() || rItem.mbMatchEmpty) && bRangeReduce) +const bool isCountIfs = (nParamCount % 2) == 0; +if(isCountIfs && (rEntry.IsQueryByEmpty() || rItem.mbMatchEmpty) && bRangeReduce) { bRangeReduce = false; // All criteria ranges are svDoubleRef's, so only vConditions needs adjusting.
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math.cxx | 44 +- sc/source/core/opencl/opbase.cxx | 30 + sc/source/core/opencl/opbase.hxx |3 ++ 3 files changed, 39 insertions(+), 38 deletions(-) New commits: commit 6778f8ec5a3fed427ef97293d8e71333c511b613 Author: Luboš Luňák AuthorDate: Thu Sep 1 14:02:11 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 13:03:42 2022 +0200 fix and simplify opencl COMBIN() Change-Id: I7568e3bb55cab31eb6e9b8644019a465333e8091 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139200 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index bd058a26a48b..4dec63ac654f 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -2615,45 +2615,13 @@ void OpCombin::GenSlidingWindowFunction(outputstream , } ss << ") {\n"; ss << "int gid0 = get_global_id(0);\n"; -ss << "double num = " << GetBottom() << ";\n"; -ss << "double num_chosen = " << GetBottom() << ";\n"; ss << "double result = -1.0;\n"; -FormulaToken *iNum = vSubArguments[0]->GetFormulaToken(); -FormulaToken *iNumChosen = vSubArguments[1]->GetFormulaToken(); - -assert(iNum); -if(ocPush == vSubArguments[0]->GetFormulaToken()->GetOpCode()) -{ -if(iNum->GetType() == formula::svSingleVectorRef && -iNumChosen->GetType() == formula::svSingleVectorRef) -{ -ss << "if(isnan("; -ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n"; -ss << "num = 0.0;\n"; -ss << "else\n"; -ss << "num = floor("; -ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ");\n"; -ss << "if(isnan("; -ss << vSubArguments[1]->GenSlidingWindowDeclRef() << "))\n"; -ss << "num_chosen = 0.0;\n"; -ss << "else\n"; -ss << "num_chosen = floor("; -ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ");\n"; -} -else if(iNum->GetType() == formula::svDouble && -iNumChosen->GetType() == formula::svDouble) -{ -ss << "num = floor(" << iNum->GetDouble() << ");\n"; -ss << "num_chosen = floor("<< iNumChosen->GetDouble()<< ");\n"; -} -} -else -{ -ss << "num = floor("; -ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ");\n"; -ss << "num_chosen = floor("; -ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ");\n"; -} +GenerateArg( 0, vSubArguments, ss ); +GenerateArg( 1, vSubArguments, ss ); +ss << "double num = floor( arg0 );\n"; +ss << "double num_chosen = floor( arg1 );\n"; +ss << "if(num < 0 || num_chosen < 0 || num < num_chosen )\n"; +ss << "return CreateDoubleError(IllegalArgument);\n"; ss << "result = select(result, 0.0, (ulong)(num < num_chosen));\n"; ss << "result = select(result, 1.0, (ulong)(num_chosen == 0.0));\n"; ss << "if(result == 0 || result ==1)\n"; diff --git a/sc/source/core/opencl/opbase.cxx b/sc/source/core/opencl/opbase.cxx index 1726b37a9699..9cc69854ca9b 100644 --- a/sc/source/core/opencl/opbase.cxx +++ b/sc/source/core/opencl/opbase.cxx @@ -174,6 +174,36 @@ bool VectorRef::NeedParallelReduction() const return false; } +void SlidingFunctionBase::GenerateArg( int num, SubArguments& vSubArguments, outputstream& ss ) +{ +CHECK_PARAMETER_COUNT_MIN( num ); +FormulaToken *token = vSubArguments[num]->GetFormulaToken(); +if( token == nullptr ) +throw Unhandled( __FILE__, __LINE__ ); +ss << "double arg" << num << ";\n"; +if(token->GetOpCode() == ocPush) +{ +if(token->GetType() == formula::svSingleVectorRef) +{ +ss << "if(isnan("; +ss << vSubArguments[num]->GenSlidingWindowDeclRef() << "))\n"; +ss << "arg" << num << " = 0.0;\n"; +ss << "else\n"; +ss << "arg" << num << " = "; +ss << vSubArguments[num]->GenSlidingWindowDeclRef() << ";\n"; +} +else if(token->GetType() == formula::svDouble) +ss << "arg" << num << " = " << token->GetDouble() << ";\n"; +else +throw Unhandled( __FILE__, __LINE__ ); +} +else +{ +ss << "arg" << num << " = "; +ss << vSubArguments[num]->GenSlidingWindowDeclRef() << ";\n"; +} +} + void Normal::GenSlidingWindowFunction( outputstream& ss, const std::string& sSymName, SubArguments& vSubArguments ) { diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index c56c02c855a3..ea1c7402ab23 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -224,6
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit c3fdac32fee3b342bb1d881a443748140af510b5 Author: Luboš Luňák AuthorDate: Thu Sep 1 14:02:07 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 12:04:46 2022 +0200 opencl MOD() fixes Change-Id: I72c588f714a49ef6ed33657dc30b41ee10ecd5d6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139199 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 109d17ade5f6..bd058a26a48b 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -389,6 +389,7 @@ void OpEven::GenSlidingWindowFunction(outputstream , void OpMod::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 2, 2 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -406,7 +407,7 @@ void OpMod::GenSlidingWindowFunction(outputstream , ss << "if(isnan(arg0)||arg0 == 0)\n"; ss << "return 0;\n"; ss << "if(isnan(arg1) || arg1 ==0)\n"; -ss << "return NAN;\n"; +ss << "return CreateDoubleError(DivisionByZero);\n"; ss << "double tem;\n"; ss << "if(arg0 < 0 && arg1 > 0)\n"; ss << "while(arg0 < 0)\n";
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math.cxx | 78 +++--- 1 file changed, 41 insertions(+), 37 deletions(-) New commits: commit 8d687f4399ba2aa03126f00788664e9cd185147c Author: Luboš Luňák AuthorDate: Thu Sep 1 14:01:59 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 12:04:20 2022 +0200 fix opencl FACT() implementation Change-Id: I5b4525268c574c9edff2f4e8361b2b6d234c50f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139198 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index edcc2b940bd6..109d17ade5f6 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -2982,6 +2982,7 @@ void OpDeg::GenSlidingWindowFunction(outputstream , void OpFact::GenSlidingWindowFunction(outputstream& ss, const std::string , SubArguments& vSubArguments) { +CHECK_PARAMETER_COUNT( 1, 1 ); ss << "\ndouble " << sSymName; ss << "_" << BinFuncName() << "("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -2996,48 +2997,51 @@ void OpFact::GenSlidingWindowFunction(outputstream& ss, ss << "double arg0 = " << GetBottom() << ";\n"; FormulaToken* pCur = vSubArguments[0]->GetFormulaToken(); assert(pCur); -if (pCur->GetType() == formula::svSingleVectorRef) -{ -const formula::SingleVectorRefToken* pSVR = -static_cast< const formula::SingleVectorRefToken* >(pCur); -ss << "if (gid0 < " << pSVR->GetArrayLength() << "){\n"; -} -else if (pCur->GetType() == formula::svDouble) -{ -ss << "{\n"; -} -if(ocPush==vSubArguments[0]->GetFormulaToken()->GetOpCode()) +if(ocPush == vSubArguments[0]->GetFormulaToken()->GetOpCode()) { -ss << "if (isnan("; -ss << vSubArguments[0]->GenSlidingWindowDeclRef(); -ss << "))\n"; -ss << "arg0 = 0;\n"; -ss << "else\n"; -ss << "arg0 = "; -ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n"; -ss << "arg0 = floor(arg0);\n"; -ss << "if (arg0 < 0.0)\n"; -ss << "return 0.0;\n"; -ss << "else if (arg0 == 0.0)\n"; -ss << "return 1.0;\n"; -ss << "else if (arg0 <= 170.0)\n"; -ss << "{\n"; -ss << "double fTemp = arg0;\n"; -ss << "while (fTemp > 2.0)\n"; -ss << "{\n"; -ss << "fTemp = fTemp - 1;\n"; -ss << "arg0 = arg0 * fTemp;\n"; -ss << "}\n"; -ss << "}\n"; -ss << "else\n"; -ss << "return -DBL_MAX;\n"; -ss << "}\n"; +if(pCur->GetType() == formula::svSingleVectorRef) +{ +const formula::SingleVectorRefToken*pCurDVR= +static_cast +(pCur); +ss << "arg0 = "; +ss << vSubArguments[0]->GenSlidingWindowDeclRef(); +ss << ";\n"; +ss << "if(isnan("; +ss << vSubArguments[0]->GenSlidingWindowDeclRef(); +ss << ")||(gid0>="; +ss << pCurDVR->GetArrayLength(); +ss << "))\n"; +ss << "{ arg0 = 0.0f; }\n"; +} +else if(pCur->GetType() == formula::svDouble) +{ +ss << "arg0="; +ss << pCur->GetDouble() << ";\n"; +} } else { -ss << "arg0 = "; -ss << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n"; +ss << "arg0 = "; +ss << vSubArguments[0]->GenSlidingWindowDeclRef(); +ss << ";\n"; } +ss << "arg0 = floor(arg0);\n"; +ss << "if (arg0 < 0.0)\n"; +ss << "return CreateDoubleError(IllegalArgument);\n"; +ss << "else if (arg0 == 0.0)\n"; +ss << "return 1.0;\n"; +ss << "else if (arg0 <= 170.0)\n"; +ss << "{\n"; +ss << "double fTemp = arg0;\n"; +ss << "while (fTemp > 2.0)\n"; +ss << "{\n"; +ss << "fTemp = fTemp - 1;\n"; +ss << "arg0 = arg0 * fTemp;\n"; +ss << "}\n"; +ss << "}\n"; +ss << "else\n"; +ss << "return CreateDoubleError(NoValue);\n"; ss << "return arg0;\n"; ss << "}"; }
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/op_logical.cxx |5 +++ sc/source/core/opencl/op_math.cxx| 55 +++ sc/source/core/opencl/opbase.hxx | 10 +- 3 files changed, 50 insertions(+), 20 deletions(-) New commits: commit 20caaffa82f701ef52900f4504227f88320d227f Author: Luboš Luňák AuthorDate: Thu Sep 1 14:01:53 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 12:04:06 2022 +0200 check parameter count in opencl logical functions Change-Id: If77bd146bd9eafd54afa1b82203d378ab9cd26d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139197 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_logical.cxx b/sc/source/core/opencl/op_logical.cxx index 969b63d0ee7b..1fa21e8250e6 100644 --- a/sc/source/core/opencl/op_logical.cxx +++ b/sc/source/core/opencl/op_logical.cxx @@ -18,6 +18,7 @@ namespace sc::opencl { void OpAnd::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT_MIN( 1 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -103,6 +104,7 @@ void OpAnd::GenSlidingWindowFunction(outputstream , void OpOr::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT_MIN( 1 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -182,6 +184,7 @@ void OpOr::GenSlidingWindowFunction(outputstream , void OpNot::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 1, 1 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -219,6 +222,7 @@ void OpNot::GenSlidingWindowFunction(outputstream , void OpXor::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT_MIN( 1 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -298,6 +302,7 @@ void OpXor::GenSlidingWindowFunction(outputstream , void OpIf::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 1, 3 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) diff --git a/sc/source/core/opencl/opbase.hxx b/sc/source/core/opencl/opbase.hxx index 4262da8c35da..c56c02c855a3 100644 --- a/sc/source/core/opencl/opbase.hxx +++ b/sc/source/core/opencl/opbase.hxx @@ -70,14 +70,20 @@ public: int const mLineNumber; }; -// Helper macro to be used in code emitting OpenCL code for Calc functions. -// Requires the vSubArguments parameter. +// Helper macros to be used in code emitting OpenCL code for Calc functions. +// Require the vSubArguments parameter. #define CHECK_PARAMETER_COUNT(min, max) \ do { \ const int count = vSubArguments.size(); \ if( count < ( min ) || count > ( max )) \ throw InvalidParameterCount( count, __FILE__, __LINE__ ); \ } while( false ) +#define CHECK_PARAMETER_COUNT_MIN(min) \ +do { \ +const int count = vSubArguments.size(); \ +if( count < ( min )) \ +throw InvalidParameterCount( count, __FILE__, __LINE__ ); \ +} while( false ) typedef std::shared_ptr FormulaTreeNodeRef; commit 08b0c3b848b8f2bd667fad00068f3c828c709ef5 Author: Luboš Luňák AuthorDate: Thu Sep 1 13:59:50 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 12:03:50 2022 +0200 fixes to opencl rounding functions Change-Id: I5cd99116a7230b8070051cbf6969a1fdd2f7fe62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139196 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 7cb632050aa4..edcc2b940bd6 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1670,27 +1670,28 @@ void OpRoundUp::GenSlidingWindowFunction(outputstream , ss << "int gid0=get_global_id(0);\n"; ss << "int singleIndex = gid0;\n"; ss << "int intTmp;\n"; -ss << "double doubleTmp;\n"; ss << "double tmp;\n"; GenTmpVariables(ss,vSubArguments); CheckAllSubArgumentIsNan(ss,vSubArguments); if( vSubArguments.size() == 1 ) ss << "double tmp1 = 0;\n"; -ss << "if(tmp1 >20 || tmp1 < -20)"; +ss << "int shift = (int)tmp1;\n"; +ss << "if(shift >20 || shift < -20)"; ss << "{\n"; ss << "tmp = NAN;\n"; ss << "}else\n"; ss << "{\n"; -ss << "for(int i=0;ishift;i--)\n"; +ss << "multiply /= 10;\n"; +ss << "intTmp = (int)(tmp0*multiply);\n"; +ss << "
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx |2 +- sc/source/core/opencl/op_addin.cxx|7 ++- sc/source/core/opencl/op_math.cxx |5 ++--- sc/source/core/opencl/op_statistical.cxx |7 +++ sc/source/core/opencl/opinlinefun_statistical.cxx |1 - 5 files changed, 8 insertions(+), 14 deletions(-) New commits: commit 65a082168ef5c2ff002f20a615b622816c3f4d3a Author: Luboš Luňák AuthorDate: Thu Sep 1 13:59:43 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 12:03:18 2022 +0200 use opencl's built-in PI values instead of hardcoded ones Fixes a sc_subsequent_filters_test error because of =ACOT(-1)/PI() getting slightly miscalculated. Change-Id: I3846553cae55f463c34fba13663cad72c0e60b34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139195 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 8d959cc42dbe..9838e9adaef2 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -474,7 +474,7 @@ public: } virtual void GenDeclRef( outputstream& ss ) const override { -ss << "3.14159265358979"; +ss << "M_PI"; } virtual void GenSlidingWindowDecl( outputstream& ss ) const override { diff --git a/sc/source/core/opencl/op_addin.cxx b/sc/source/core/opencl/op_addin.cxx index 78a98a9bf9db..5e4dc04a2b0b 100644 --- a/sc/source/core/opencl/op_addin.cxx +++ b/sc/source/core/opencl/op_addin.cxx @@ -93,10 +93,7 @@ void OpBesselj::GenSlidingWindowFunction(outputstream , ss << "N = "; ss << vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n"; } -ss << "double f_PI = 3.1415926535897932385;\n"; -ss << "double f_2_DIV_PI = 2.0 / f_PI;\n"; -ss << "double f_PI_DIV_2 = f_PI / 2.0;\n"; -ss << "double f_PI_DIV_4 = f_PI / 4.0;\n"; +ss << "double f_2_DIV_PI = 2.0 / M_PI;\n"; ss << "if( N < 0.0 )\n"; ss << "return CreateDoubleError(IllegalArgument);\n"; ss << "if (x == 0.0)\n"; @@ -110,7 +107,7 @@ void OpBesselj::GenSlidingWindowFunction(outputstream , ss << "{\n"; ss << "if (bAsymptoticPossible)\n"; ss << "return fSign * sqrt(f_2_DIV_PI/fX)"; -ss << "* cos(fX-N*f_PI_DIV_2-f_PI_DIV_4);\n"; +ss << "* cos(fX-N*M_PI_2-M_PI_4);\n"; ss << "else\n"; ss << "return CreateDoubleError(NoConvergence);\n"; ss << "}\n"; diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 744c360a75bc..7cb632050aa4 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1791,7 +1791,7 @@ void OpRadians::GenSlidingWindowFunction(outputstream , ss << "double tmp;\n"; GenTmpVariables(ss,vSubArguments); CheckAllSubArgumentIsNan(ss,vSubArguments); -ss << "tmp = tmp0 * 3.14159265358979 / 180.0;\n"; +ss << "tmp = tmp0 * M_PI / 180.0;\n"; ss << "return tmp;\n"; ss << "}"; } @@ -2519,8 +2519,7 @@ void OpSqrtPi::GenSlidingWindowFunction(outputstream , ss << vSubArguments[0]->GenSlidingWindowDeclRef(); ss << ";\n"; } -ss << "return (double)sqrt(arg0 *"; -ss << " 3.1415926535897932);\n"; +ss << "return (double)sqrt(arg0 * M_PI);\n"; ss << "}"; } void OpCeil::GenSlidingWindowFunction(outputstream , diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 5acd3c2508fc..bad9626a0717 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -5915,7 +5915,7 @@ void OpChiSqDist::BinInlineFun(std::set& decls, decls.insert(fMaxGammaArgumentDecl);decls.insert(GetChiSqDistCDFDecl); decls.insert(GetChiSqDistPDFDecl);decls.insert(GetLowRegIGammaDecl); decls.insert(GetGammaContFractionDecl);decls.insert(GetGammaSeriesDecl); -decls.insert(fHalfMachEpsDecl);decls.insert(F_PIDecl); +decls.insert(fHalfMachEpsDecl); decls.insert(fBigInvDecl); funs.insert(GetGammaContFraction);funs.insert(GetChiSqDistCDF); @@ -6005,7 +6005,7 @@ vSubArguments) decls.insert(fMaxGammaArgumentDecl);decls.insert(GetChiSqDistCDFDecl); decls.insert(GetLowRegIGammaDecl);decls.insert(lcl_IterateInverseChiSQInvDecl); decls.insert(GetGammaContFractionDecl);decls.insert(GetGammaSeriesDecl); -decls.insert(fHalfMachEpsDecl);decls.insert(F_PIDecl); +decls.insert(fHalfMachEpsDecl); decls.insert(fBigInvDecl);decls.insert(lcl_HasChangeOfSignDecl); decls.insert(fMachEpsDecl); @@ -7603,7 +7603,6 @@ void OpHypGeomDist::GenSlidingWindowFunction(outputstream , "double n1=floor(arg1);\n" "double x1=floor(arg0);\n" "double num[9];\n" -"double PI =
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/mathematical/fods/atan2.fods | 16 sc/source/core/opencl/op_math.cxx |2 ++ sc/source/core/opencl/opinlinefun_math.hxx |2 +- 3 files changed, 15 insertions(+), 5 deletions(-) New commits: commit 218b288d0ca32e4372f546b143fa71542f75dcd0 Author: Luboš Luňák AuthorDate: Thu Sep 1 13:53:19 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 12:02:50 2022 +0200 fix opencl trigonometric functions Change-Id: Iacdae9fceff2feb198bd722e7e58e5e6dff5facc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139194 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/data/functions/mathematical/fods/atan2.fods b/sc/qa/unit/data/functions/mathematical/fods/atan2.fods index 4e11319cd652..b78437d3ed93 100644 --- a/sc/qa/unit/data/functions/mathematical/fods/atan2.fods +++ b/sc/qa/unit/data/functions/mathematical/fods/atan2.fods @@ -1925,10 +1925,18 @@ - - - - + + 0 + + + 0 + + + TRUE + + + =ATAN2(0;0) + diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index dd70241c5f41..744c360a75bc 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1094,6 +1094,8 @@ void OpArcCosHyp::GenSlidingWindowFunction(outputstream , ss << ";\n"; } +ss << "if( tmp < 1 )\n"; +ss << "return CreateDoubleError(IllegalArgument);\n"; ss << "return log( tmp + pow( (pown(tmp, 2) - 1.0), 0.5));\n"; ss << "}"; } diff --git a/sc/source/core/opencl/opinlinefun_math.hxx b/sc/source/core/opencl/opinlinefun_math.hxx index dc962b4635f1..0160671ed164 100644 --- a/sc/source/core/opencl/opinlinefun_math.hxx +++ b/sc/source/core/opencl/opinlinefun_math.hxx @@ -62,7 +62,7 @@ std::string atan2Content = "double arctan2(double y, double x)\n" "{\n" "if(y==0.0)\n" -"return 0.0;\n" +"return x >= 0 ? 0.0 : M_PI;\n" "double a,num,den,tmpPi;\n" "int flag;\n" "tmpPi = 0;\n"
[Libreoffice-commits] core.git: sc/qa
sc/qa/unit/data/ods/opencl/compiler/precision.ods |binary 1 file changed New commits: commit 5aad29e382658aa93191ea4a4ff6cc9094ae12d4 Author: Luboš Luňák AuthorDate: Tue Sep 6 11:14:19 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Sep 6 12:02:22 2022 +0200 add missing Calc test file opencl/compiler/precision.ods Should have been included in 35ed13eba1ceb6ddab8a9a72c5ef46ab3af . Change-Id: I3cf1a6b38e9893b5ec4ec4d6ffdfc4bf0ddba065 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139477 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/data/ods/opencl/compiler/precision.ods b/sc/qa/unit/data/ods/opencl/compiler/precision.ods new file mode 100644 index ..669ccf7bbf4d Binary files /dev/null and b/sc/qa/unit/data/ods/opencl/compiler/precision.ods differ
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/formulacell.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 372c7b231c2d75f6d9bade63cd1b980a84391d4f Author: Luboš Luňák AuthorDate: Thu Sep 1 13:52:26 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 16:22:23 2022 +0200 use forced Calc calculation type even for single rows It's for testing/debugging, so this should not get optimized. Change-Id: Ib72eaa8ddb2c49ceee051856d977e2393bbb6966 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139173 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index 7e0400514122..0bad3e6b73d1 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -4664,7 +4664,7 @@ bool ScFormulaCell::InterpretFormulaGroup(SCROW nStartOffset, SCROW nEndOffset) nEndOffset = nMaxOffset; } -if (nEndOffset == nStartOffset) +if (nEndOffset == nStartOffset && forceType == ForceCalculationNone) return false; // Do not use threads for a single row. // Guard against endless recursion of Interpret() calls, for this to work
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/utils.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 2dc0e72f413677ac650fbc21a98f70d5a00ceca6 Author: Luboš Luňák AuthorDate: Thu Sep 1 13:21:12 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 16:16:33 2022 +0200 improve inheriting from std::num_put These function in the base class are protected, and apparently some GCC versions warn about other overloads being hidden. Change-Id: I9d2e674b4fc9eedc97f586bbe4e4f21a6954b8a7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139161 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/utils.cxx b/sc/source/core/opencl/utils.cxx index 8ffec3dc9b7f..0d43d8c3edb2 100644 --- a/sc/source/core/opencl/utils.cxx +++ b/sc/source/core/opencl/utils.cxx @@ -24,7 +24,7 @@ namespace #ifdef SAL_LOG_INFO class outputstream_num_put : public std::num_put { -public: +protected: virtual iter_type do_put(iter_type s, std::ios_base&, char_type, double v) const override { std::string str = preciseFloat(v); @@ -34,6 +34,7 @@ public: { abort(); // we do not use these } +using std::num_put::do_put; }; #endif } // namespace
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - drawinglayer/source include/drawinglayer
drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |6 -- include/drawinglayer/geometry/viewinformation2d.hxx |2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) New commits: commit 6a57652cfc2e46a271091246cd867804c39f845c Author: Luboš Luňák AuthorDate: Wed Aug 31 17:22:08 2022 +0200 Commit: Caolán McNamara CommitDate: Thu Sep 1 13:17:19 2022 +0200 fix limiting drawing of softedge effect (tdf#141981) Apparently an empty viewport actually means everything should be drawn. Change-Id: I55ae453a8f264d48222ade48a2953ab7d97c7f79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138991 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 087f6bcedb37..9eb5a00410ac 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -1072,7 +1072,8 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv // Limit the bitmap size to the visible area. basegfx::B2DRange bitmapRange(aRange); -bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); +if (!aExpandedViewInfo.getDiscreteViewport().isEmpty()) +bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); if (!bitmapRange.isEmpty()) { const tools::Rectangle aRect( @@ -1133,7 +1134,8 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D( // Limit the bitmap size to the visible area. basegfx::B2DRange bitmapRange(aRange); -bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); +if (!aExpandedViewInfo.getDiscreteViewport().isEmpty()) +bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); if (!bitmapRange.isEmpty()) { const tools::Rectangle aRect( diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx index 41d2365cc628..800015f26157 100644 --- a/include/drawinglayer/geometry/viewinformation2d.hxx +++ b/include/drawinglayer/geometry/viewinformation2d.hxx @@ -121,6 +121,7 @@ public: /// data access const basegfx::B2DHomMatrix& getObjectTransformation() const; const basegfx::B2DHomMatrix& getViewTransformation() const; +/// Empty viewport means everything is visible. const basegfx::B2DRange& getViewport() const; double getViewTime() const; const css::uno::Reference& getVisualizedPage() const; @@ -130,6 +131,7 @@ public: const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const; /// On-demand prepared Viewport in discrete units for convenience +/// Empty viewport means everything is visible. const basegfx::B2DRange& getDiscreteViewport() const; /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - drawinglayer/source include/drawinglayer
drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |6 -- include/drawinglayer/geometry/viewinformation2d.hxx |2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) New commits: commit 89b7f3b1e72aa5bc3cf7c6af499e9e6d00cac831 Author: Luboš Luňák AuthorDate: Wed Aug 31 17:22:08 2022 +0200 Commit: Caolán McNamara CommitDate: Thu Sep 1 13:13:02 2022 +0200 fix limiting drawing of softedge effect (tdf#141981) Apparently an empty viewport actually means everything should be drawn. Change-Id: I55ae453a8f264d48222ade48a2953ab7d97c7f79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139126 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index acb0870a245d..9291c1830bda 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -1071,7 +1071,8 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const primitive2d::GlowPrimitiv // Limit the bitmap size to the visible area. basegfx::B2DRange bitmapRange(aRange); -bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); +if (!aExpandedViewInfo.getDiscreteViewport().isEmpty()) +bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); if (!bitmapRange.isEmpty()) { const tools::Rectangle aRect( @@ -1132,7 +1133,8 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D( // Limit the bitmap size to the visible area. basegfx::B2DRange bitmapRange(aRange); -bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); +if (!aExpandedViewInfo.getDiscreteViewport().isEmpty()) +bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); if (!bitmapRange.isEmpty()) { const tools::Rectangle aRect( diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx index bf594e8755cf..2957b7daf709 100644 --- a/include/drawinglayer/geometry/viewinformation2d.hxx +++ b/include/drawinglayer/geometry/viewinformation2d.hxx @@ -121,6 +121,7 @@ public: /// data access const basegfx::B2DHomMatrix& getObjectTransformation() const; const basegfx::B2DHomMatrix& getViewTransformation() const; +/// Empty viewport means everything is visible. const basegfx::B2DRange& getViewport() const; double getViewTime() const; const css::uno::Reference& getVisualizedPage() const; @@ -130,6 +131,7 @@ public: const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const; /// On-demand prepared Viewport in discrete units for convenience +/// Empty viewport means everything is visible. const basegfx::B2DRange& getDiscreteViewport() const; /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/source
sc/source/core/tool/interpr1.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit e20d52afe5a33ae9490e238e7b5833d3df68f004 Author: Luboš Luňák AuthorDate: Fri Aug 26 16:10:38 2022 +0200 Commit: Caolán McNamara CommitDate: Thu Sep 1 13:11:03 2022 +0200 fix undoing range reducing to apply only to COUNTIFS (tdf#150618) Before 7674399aac661eb503d7badc53b9a4d68bd9839d the code tried to range-reduce all operations except for COUNTIFS, the commit added handling also COUNTIFS and then later undo the rare cases when it shouldn't be done, but the undo wasn't specific to COUNTIFS even though it should have. Change-Id: Ibdb6516a1ac7bc7d34f16f8a99781859e9fc7b60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138880 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 5367616819e232e7ef2405c614bbfa3ca0d2aecf) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138974 Reviewed-by: Caolán McNamara diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index cc485e383038..0fd78f8b1a99 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -6092,9 +6092,10 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf rParam.eSearchType = DetectSearchType(rItem.maString.getString(), mrDoc); } -// Undo bRangeReduce if asked to match empty cells (which should be rare). +// Undo bRangeReduce if asked to match empty cells for COUNTIFS (which should be rare). assert(rEntry.GetQueryItems().size() == 1); -if((rEntry.IsQueryByEmpty() || rItem.mbMatchEmpty) && bRangeReduce) +const bool isCountIfs = (nParamCount % 2) == 0; +if(isCountIfs && (rEntry.IsQueryByEmpty() || rItem.mbMatchEmpty) && bRangeReduce) { bRangeReduce = false; // All criteria ranges are svDoubleRef's, so only vConditions needs adjusting.
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/op_financial.cxx | 18 ++ sc/source/core/opencl/op_math.cxx| 25 + sc/source/core/opencl/op_statistical.cxx |2 ++ 3 files changed, 45 insertions(+) New commits: commit 256086fc9b3a00181c7022294712226cd920b2e1 Author: Luboš Luňák AuthorDate: Wed Aug 31 16:43:37 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 12:21:53 2022 +0200 check parameter count in various opencl functions Change-Id: I896331287ac5f7705f9fdfdb8e0786a894bc6eb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139077 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index e3362ed08441..12acbb435081 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -21,6 +21,7 @@ namespace sc::opencl { void RRI::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 3, 3 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -148,6 +149,7 @@ vSubArguments) void OpDollarde::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 2, 2 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -512,6 +514,7 @@ void OpIPMT::GenSlidingWindowFunction(outputstream& ss, void OpISPMT::GenSlidingWindowFunction(outputstream& ss, const std::string , SubArguments& vSubArguments) { +CHECK_PARAMETER_COUNT( 4, 4 ); ss << "\ndouble " << sSymName; ss << "_" << BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -796,6 +799,7 @@ void Cumipmt::GenSlidingWindowFunction( outputstream , const std::string , SubArguments & vSubArguments) { +CHECK_PARAMETER_COUNT( 6, 6 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -910,6 +914,7 @@ vSubArguments) void IRR::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 2, 2 ); ss << "\ndouble " << sSymName; ss << "_" << BinFuncName() << "("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -1181,6 +1186,7 @@ void XNPV::GenSlidingWindowFunction( void PriceMat::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 6, 6 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -1375,6 +1381,7 @@ void OpSYD::GenSlidingWindowFunction(outputstream , void MIRR::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 3, 3 ); FormulaToken* pCur = vSubArguments[0]->GetFormulaToken(); assert(pCur); const formula::DoubleVectorRefToken* pCurDVR = @@ -1591,6 +1598,7 @@ void OpCumprinc::BinInlineFun(std::set& decls, void OpCumprinc::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 6, 6 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -1717,6 +1725,7 @@ void OpAccrint::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 7, 7 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -1831,6 +1840,7 @@ void OpAccrintm::BinInlineFun(std::set& decls, void OpAccrintm::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 5, 5 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -1958,6 +1968,7 @@ void OpAccrintm::GenSlidingWindowFunction( void OpYield::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 7, 7 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -2174,6 +2185,7 @@ void OpSLN::GenSlidingWindowFunction(outputstream , void OpYieldmat::GenSlidingWindowFunction( outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 6, 6 ); ss << "\ndouble " << sSymName; ss << "_"<< BinFuncName() <<"("; for (size_t i = 0; i < vSubArguments.size(); i++) @@ -3525,6 +3537,7 @@ void OpAmordegrc::BinInlineFun(std::set& decls, void OpAmordegrc::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT( 6, 7 ); ss << "\ndouble " <<
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/op_statistical.cxx |9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) New commits: commit 1e3cf15e2d090671f0735faa83d8c57bea0a37d6 Author: Luboš Luňák AuthorDate: Wed Aug 31 16:43:29 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 12:21:24 2022 +0200 do not return "random" values from opencl FTEST if it can't handle something Change-Id: I539d184b015b79ce0511656ab5140bce8698397d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139075 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index b325a68ca41c..1225306b69fb 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -6529,13 +6529,9 @@ void OpFTest::GenSlidingWindowFunction(outputstream , ss << "}\n"; } else if (pCurSub->GetType() == formula::svSingleVectorRef) -{ -ss << "return HUGE_VAL"; -} +throw Unhandled(__FILE__, __LINE__); else if (pCurSub->GetType() == formula::svDouble) -{ -ss << "return HUGE_VAL"; -} +throw Unhandled(__FILE__, __LINE__); } ss << "double fS1 = (fSumSqr1-fSum1*fSum1/length0)/(length0-1.0);\n" "double fS2 = (fSumSqr2-fSum2*fSum2/length1)/(length1-1.0);\n" commit e306e86ac70e6d47d779f0b63ea76b3a72645b5a Author: Luboš Luňák AuthorDate: Wed Aug 31 16:43:23 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 12:21:05 2022 +0200 opencl LogNormDist cannot handle less than 4 arguments Change-Id: I0669aed4b0cac5fc2165becb9bc8861a688272c0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139074 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index d5dd0618e4ca..b325a68ca41c 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -5447,6 +5447,7 @@ void OpForecast::GenSlidingWindowFunction(outputstream , void OpLogNormDist::GenSlidingWindowFunction(outputstream , const std::string , SubArguments ) { +CHECK_PARAMETER_COUNT(4,4); FormulaToken *tmpCur0 = vSubArguments[0]->GetFormulaToken(); const formula::SingleVectorRefToken*tmpCurDVR0= static_cast(tmpCur0);
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_math.cxx | 42 +++--- sc/source/core/opencl/opbase.hxx |3 ++ 2 files changed, 24 insertions(+), 21 deletions(-) New commits: commit ea6ce6cb6ad5a69c5bc59d0290a6beedb882ea0c Author: Luboš Luňák AuthorDate: Wed Aug 31 16:44:50 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 12:04:25 2022 +0200 opencl, don't use GetBottom() as value for empty cells I'm not quite sure what this GetBottom() thing is, but e.g. acosh() treating empty cell as 1 is not right. Change-Id: Id86ab979598603c12cec99ec5758c27a99589107 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139078 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 21bc24eee2c1..2cb75d5c3d58 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -1014,7 +1014,7 @@ void OpAbs::GenSlidingWindowFunction(outputstream , ss << "if((gid0)>=buffer_len || isnan("; ss << vSubArguments[0]->GenSlidingWindowDeclRef(); ss << "))\n"; -ss << "tmp = " << GetBottom() << ";\nelse \n"; +ss << "tmp = 0.0;\nelse \n"; ss << "tmp = "; ss << vSubArguments[0]->GenSlidingWindowDeclRef(); ss << ";\n"; @@ -1046,7 +1046,7 @@ void OpArcCos::GenSlidingWindowFunction(outputstream , ss << "int buffer_len = "<< tmpCurDVR0->GetArrayLength()<< ";\n"; ss << "if((gid0)>=buffer_len || isnan("; ss << vSubArguments[0]->GenSlidingWindowDeclRef()<< "))\n"; -ss << "tmp = " << GetBottom() << ";\n"; +ss << "tmp = 0.0;\n"; ss << "else \n"; ss << "tmp = "; ss << vSubArguments[0]->GenSlidingWindowDeclRef()<< ";\n"; @@ -1077,7 +1077,7 @@ void OpArcCosHyp::GenSlidingWindowFunction(outputstream , ss << "int buffer_len = "=buffer_len || isnan("; ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n"; -ss << "tmp = " << GetBottom() << ";\n"; +ss << "tmp = 0.0;\n"; ss << "else \n"; ss << "tmp = " << vSubArguments[0]->GenSlidingWindowDeclRef(); ss << ";\n"; @@ -1313,7 +1313,7 @@ void OpArcCot::GenSlidingWindowFunction(outputstream , ss << "int buffer_len = " << tmpCurDVR0->GetArrayLength()<< ";\n"; ss << "if((gid0)>=buffer_len || isnan("; ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n"; -ss << "tmp = " << GetBottom() << ";\n"; +ss << "tmp = 0.0;\n"; ss << "else \n"; ss << "tmp = " << vSubArguments[0]->GenSlidingWindowDeclRef() <<";\n"; ss << "return M_PI_2 - atan(tmp);\n"; @@ -1392,7 +1392,7 @@ void OpArcSin::GenSlidingWindowFunction(outputstream , ss << "int buffer_len = " << tmpCurDVR0->GetArrayLength() << ";\n"; ss << "if((gid0)>=buffer_len || isnan("; ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n"; -ss << "tmp = " << GetBottom() << ";\n"; +ss << "tmp = 0.0;\n"; ss << "else \n"; ss << "tmp = " << vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n"; ss << "return arctan2(tmp, sqrt(1.0 - pow(tmp, 2)));\n"; @@ -1422,7 +1422,7 @@ void OpArcSinHyp::GenSlidingWindowFunction(outputstream , ss << "int buffer_len = " =buffer_len || isnan("; ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n"; -ss << "tmp = " << GetBottom() << ";\n"; +ss << "tmp = 0.0;\n"; ss << "else \n"; ss << "tmp = " << vSubArguments[0]->GenSlidingWindowDeclRef(); ss << ";\n"; @@ -1470,12 +1470,12 @@ void OpArcTan2::GenSlidingWindowFunction(outputstream , ss << "int buffer_y_len = " << tmpCurDVRY->GetArrayLength() << ";\n"; ss << "if((gid0)>=buffer_x_len || isnan("; ss << vSubArguments[0]->GenSlidingWindowDeclRef() << "))\n"; -ss << "x_num = " << GetBottom() << ";\n"; +ss << "x_num = 0.0;\n"; ss << "else \n"; ss << "x_num = "<< vSubArguments[0]->GenSlidingWindowDeclRef() << ";\n"; ss << "if((gid0)>=buffer_y_len || isnan("; ss << vSubArguments[1]->GenSlidingWindowDeclRef() << "))\n"; -ss << "y_num = " << GetBottom() << ";\n"; +ss << "y_num = 0.0;\n"; ss << "else \n"; ss << "y_num = "<< vSubArguments[1]->GenSlidingWindowDeclRef() << ";\n"; ss << "return arctan2(y_num, x_num);\n"; @@ -1547,7 +1547,7 @@ void OpArcTanH::GenSlidingWindowFunction(outputstream , ss << "int buffer_len = " << tmpCurDVR0->GetArrayLength() << ";\n"; ss << "if((gid0)>=buffer_len || isnan(";
[Libreoffice-commits] core.git: sc/Library_sc.mk sc/qa sc/source
sc/Library_sc.mk |1 sc/qa/unit/opencl-test.cxx | 29 sc/source/core/opencl/formulagroupcl.cxx | 193 +++ sc/source/core/opencl/op_addin.cxx |4 sc/source/core/opencl/op_addin.hxx |5 sc/source/core/opencl/op_array.cxx |6 sc/source/core/opencl/op_array.hxx |7 - sc/source/core/opencl/op_database.cxx| 22 +-- sc/source/core/opencl/op_database.hxx| 23 +-- sc/source/core/opencl/op_financial.cxx | 106 - sc/source/core/opencl/op_financial.hxx | 107 - sc/source/core/opencl/op_logical.cxx | 10 - sc/source/core/opencl/op_logical.hxx | 11 - sc/source/core/opencl/op_math.cxx| 130 ++-- sc/source/core/opencl/op_math.hxx| 127 ++-- sc/source/core/opencl/op_spreadsheet.cxx |2 sc/source/core/opencl/op_spreadsheet.hxx |3 sc/source/core/opencl/op_statistical.cxx | 134 ++--- sc/source/core/opencl/op_statistical.hxx | 135 ++--- sc/source/core/opencl/opbase.cxx | 28 ++-- sc/source/core/opencl/opbase.hxx | 31 ++-- sc/source/core/opencl/utils.cxx | 87 + sc/source/core/opencl/utils.hxx | 51 23 files changed, 717 insertions(+), 535 deletions(-) New commits: commit 35ed13eba1ceb6ddab8a9a72c5ef46ab3aff8224 Author: Luboš Luňák AuthorDate: Wed Aug 31 16:45:34 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 12:03:33 2022 +0200 make sure opencl generated code doesn't lose numbers precision The default precision of both iostreams and stdio is 6 decimal places. This means that e.g. =POWER(1.001,2) becomes 1, since buf << number will write that first number simply as '1'. Moroever some generated code actually doesn't compile because ambiguous overloads, because '1' is an integer and not a double, thus floor(1) is ambiguous, as there are only floating point overloads (and C/C++ are stupid about these conversions). So force using a wrapper class that forces a higher precision and the decimal separator. For debug builds, also avoid excessive precision. Apparently, neither iostreams nor stdio are capable of simply printing a reasonable floating point representation that wouldn't be too precise or imprecise. Change-Id: Ifa045712d90e6a6bbe5781ac3c805c989673dc8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139073 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index f8e097d538a3..4fcae3e5f408 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -725,6 +725,7 @@ $(call gb_Library_add_exception_objects,sc,\ sc/source/core/opencl/op_array \ sc/source/core/opencl/op_logical \ sc/source/core/opencl/op_spreadsheet \ +sc/source/core/opencl/utils \ ))) ifeq ($(OS),LINUX) diff --git a/sc/qa/unit/opencl-test.cxx b/sc/qa/unit/opencl-test.cxx index 7260a9221962..71275ec2d6cf 100644 --- a/sc/qa/unit/opencl-test.cxx +++ b/sc/qa/unit/opencl-test.cxx @@ -33,6 +33,7 @@ public: * loaded and before performing formula calculation. */ void enableOpenCL(); +void disableOpenCL(); virtual void setUp() override; virtual void tearDown() override; @@ -67,6 +68,7 @@ public: void testFinacialDollardeFormula(); void testCompilerString(); void testCompilerInEq(); +void testCompilerPrecision(); void testFinacialDollarfrFormula(); void testFinacialSYDFormula(); void testStatisticalFormulaCorrel(); @@ -295,6 +297,7 @@ public: CPPUNIT_TEST(testFinacialDollardeFormula); CPPUNIT_TEST(testCompilerString); CPPUNIT_TEST(testCompilerInEq); +CPPUNIT_TEST(testCompilerPrecision); CPPUNIT_TEST(testFinacialDollarfrFormula); CPPUNIT_TEST(testFinacialSYDFormula); CPPUNIT_TEST(testStatisticalFormulaCorrel); @@ -535,6 +538,11 @@ void ScOpenCLTest::enableOpenCL() sc::FormulaGroupInterpreter::enableOpenCL_UnitTestsOnly(); } +void ScOpenCLTest::disableOpenCL() +{ +sc::FormulaGroupInterpreter::disableOpenCL_UnitTestsOnly(); +} + void ScOpenCLTest::testCompilerHorizontal() { if(!initTestEnv(u"opencl/compiler/horizontal.", FORMAT_ODS, false)) @@ -613,6 +621,27 @@ void ScOpenCLTest::testCompilerInEq() } } +void ScOpenCLTest::testCompilerPrecision() +{ +if(!initTestEnv(u"opencl/compiler/precision.", FORMAT_ODS, false)) +return; +ScDocument& rDoc = xDocSh->GetDocument(); +ScDocument& rDocRes = xDocShRes->GetDocument(); +// Check that values with and without opencl are the same/similar enough. +enableOpenCL(); +rDoc.CalcAll(); +disableOpenCL(); +rDoc.CalcAll(); + +// Check the results of formula cells in the shared formula range. +for (SCROW i = 1; i < 3; ++i) +{ +double fOpenCL =
[Libreoffice-commits] core.git: drawinglayer/source
drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 0b6520c4acbfbb656f00d0fab11289899614494f Author: Luboš Luňák AuthorDate: Wed Aug 31 17:54:34 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 12:01:51 2022 +0200 explicitly use BmpScaleFlag::NearestNeighbor when wanted That is the algorithm that doesn't change colors, BmpScaleFlag::Fast works the same way only because it's mapped to this algorithm (which may not necessarily be the case forever). Change-Id: Ibebfff668eaa1da93963f8e8601fec51cfdfca34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139128 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx index 0cc5be1bd532..da3621aa189c 100644 --- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx +++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx @@ -50,8 +50,8 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double fErodeDilateRadius aSize.setWidth(aSize.Width() / 2); } -// BmpScaleFlag::Fast is important for following color replacement -mask.Scale(fScale, fScale, BmpScaleFlag::Fast); +// BmpScaleFlag::NearestNeighbor is important for following color replacement +mask.Scale(fScale, fScale, BmpScaleFlag::NearestNeighbor); if (fErodeDilateRadius > 0) BitmapFilter::Filter(mask, BitmapDilateFilter(fErodeDilateRadius));
[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer
drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |3 ++- include/drawinglayer/geometry/viewinformation2d.hxx |2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) New commits: commit 0415aa11f66de0c64f1ed524197bfea70fe3c3ca Author: Luboš Luňák AuthorDate: Wed Aug 31 17:22:08 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Sep 1 12:01:07 2022 +0200 fix limiting drawing of softedge effect (tdf#141981) Apparently an empty viewport actually means everything should be drawn. Change-Id: I55ae453a8f264d48222ade48a2953ab7d97c7f79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139125 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index d3184a0e0d7a..f00a38d49374 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -994,7 +994,8 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D( // Limit the bitmap size to the visible area. basegfx::B2DRange bitmapRange(aRange); -bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); +if (!aExpandedViewInfo.getDiscreteViewport().isEmpty()) +bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport()); if (!bitmapRange.isEmpty()) { const tools::Rectangle aRect( diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx b/include/drawinglayer/geometry/viewinformation2d.hxx index bf594e8755cf..2957b7daf709 100644 --- a/include/drawinglayer/geometry/viewinformation2d.hxx +++ b/include/drawinglayer/geometry/viewinformation2d.hxx @@ -121,6 +121,7 @@ public: /// data access const basegfx::B2DHomMatrix& getObjectTransformation() const; const basegfx::B2DHomMatrix& getViewTransformation() const; +/// Empty viewport means everything is visible. const basegfx::B2DRange& getViewport() const; double getViewTime() const; const css::uno::Reference& getVisualizedPage() const; @@ -130,6 +131,7 @@ public: const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const; /// On-demand prepared Viewport in discrete units for convenience +/// Empty viewport means everything is visible. const basegfx::B2DRange& getDiscreteViewport() const; /** support reduced DisplayQuality, PropertyName is 'ReducedDisplayQuality'. This
[Libreoffice-commits] core.git: sc/source
sc/source/core/data/column2.cxx |9 + 1 file changed, 9 insertions(+) New commits: commit fc91d611a231ae6fc498d0ac32944afb72775b95 Author: Luboš Luňák AuthorDate: Wed Aug 31 11:23:05 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Aug 31 16:46:23 2022 +0200 assert when formula group size is not large enough That should never happen, as the size should originally come from the formula group size. Change-Id: Ic429ef498bb56d589c04a07d0fb44d9841deb19f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139090 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 9fa08657e328..08391bd24150 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -3163,8 +3163,11 @@ void ScColumn::SetFormulaResults( SCROW nRow, const double* pResults, size_t nLe size_t nBlockLen = it->size - aPos.second; if (nBlockLen < nLen) +{ // Result array is longer than the length of formula cells. Not good. +assert( false ); return; +} sc::formula_block::iterator itCell = sc::formula_block::begin(*it->data); std::advance(itCell, aPos.second); @@ -3199,8 +3202,11 @@ void ScColumn::CalculateInThread( ScInterpreterContext& rContext, SCROW nRow, si size_t nBlockLen = it->size - aPos.second; if (nBlockLen < nLen) +{ // Length is longer than the length of formula cells. Not good. +assert( false ); return; +} sc::formula_block::iterator itCell = sc::formula_block::begin(*it->data); std::advance(itCell, aPos.second); @@ -3232,8 +3238,11 @@ void ScColumn::HandleStuffAfterParallelCalculation( SCROW nRow, size_t nLen, ScI size_t nBlockLen = it->size - aPos.second; if (nBlockLen < nLen) +{ // Length is longer than the length of formula cells. Not good. +assert( false ); return; +} sc::formula_block::iterator itCell = sc::formula_block::begin(*it->data); std::advance(itCell, aPos.second);
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx |2 sc/source/core/opencl/op_financial.cxx| 69 -- sc/source/core/opencl/op_math.cxx | 18 +- sc/source/core/opencl/op_statistical.cxx | 147 ++ sc/source/core/opencl/opinlinefun_finacial.cxx| 44 +++--- sc/source/core/opencl/opinlinefun_statistical.cxx | 113 6 files changed, 191 insertions(+), 202 deletions(-) New commits: commit 7d3ff55a0d072c825dac843bfbf6659a460103ba Author: Luboš Luňák AuthorDate: Tue Aug 30 15:43:39 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Aug 31 09:14:59 2022 +0200 pow(x,-1) -> 1/x in opencl code Ok, division is somewhat slow, but pow() is hardly going to be faster. Change-Id: I1c0d94243a67d0cd77874eb6b9ee6b4ef9206240 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139049 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 5800ef08c89d..eb2ea2fcc98b 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1513,7 +1513,7 @@ public: "return 0;\n"; ss << "return tmp"; if (isAverage()) -ss << "*pow((double)nCount,-1.0)"; +ss << "/(double)nCount"; ss << ";\n}"; } virtual bool isAverage() const { return false; } diff --git a/sc/source/core/opencl/op_financial.cxx b/sc/source/core/opencl/op_financial.cxx index 30a47cbfbd93..342bd67b2657 100644 --- a/sc/source/core/opencl/op_financial.cxx +++ b/sc/source/core/opencl/op_financial.cxx @@ -82,7 +82,7 @@ void RRI::GenSlidingWindowFunction( ss<<"fv = "; ss << vSubArguments[2]->GenSlidingWindowDeclRef(); ss<<";\n"; -ss << "tmp = pow(fv*pow(pv,-1),1.0*pow(nper,-1))-1;\n"; +ss << "tmp = pow(fv/pv,1.0/nper)-1;\n"; ss << "return tmp;\n"; ss << "}"; } @@ -138,7 +138,7 @@ vSubArguments) } ss<<"if(tmp1==0)\n\t"; ss<<"\treturn 0;\n\t"; -ss<<"tmp=pow( tmp1,-1);\n\t"; +ss<<"tmp= 1.0 / tmp1;\n\t"; ss<<"tmp=( pow( tmp0+ 1.0, tmp ) - 1.0 ) *"; ss<<"tmp1;\n\t"; ss << "return tmp;\n"; @@ -558,7 +558,7 @@ void OpISPMT::GenSlidingWindowFunction(std::stringstream& ss, ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n"; } } -ss << "tmp = arg3 * arg0 * ( arg1 - arg2) * pow(arg2, -1);\n"; +ss << "tmp = arg3 * arg0 * ( arg1 - arg2) / arg2;\n"; ss << "return tmp;\n"; ss << "}"; } @@ -611,7 +611,7 @@ void OpPDuration::GenSlidingWindowFunction(std::stringstream& ss, ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n"; } } -ss << "tmp = log(arg2 * pow( arg1,-1)) / log(arg0 + 1.0);\n"; +ss << "tmp = log(arg2 / arg1) / log(arg0 + 1.0);\n"; ss << "return tmp;\n"; ss << "}"; } @@ -1366,9 +1366,8 @@ void OpSYD::GenSlidingWindowFunction(std::stringstream , ss <<"period = "; ss << vSubArguments[3]->GenSlidingWindowDeclRef(); ss <<";\n"; -ss <<"double tmpvalue = ((life*(life+1))*pow(2.0,-1));\n"; -ss <<"result = ((cost-salvage)*(life-period+1)"; -ss << "*pow(tmpvalue,-1));\n"; +ss <<"double tmpvalue = ((life*(life+1))/2.0);\n"; +ss <<"result = ((cost-salvage)*(life-period+1)/tmpvalue);\n"; ss <<"return result;\n"; ss <<"}\n"; } @@ -1494,7 +1493,7 @@ void OpEffective::GenSlidingWindowFunction(std::stringstream& ss, ss << vSubArguments[i]->GenSlidingWindowDeclRef() << ";\n"; } } -ss << "tmp = pow(1.0 + arg0 * pow(arg1, -1), arg1)-1.0;\n"; +ss << "tmp = pow(1.0 + arg0 / arg1, arg1)-1.0;\n"; ss << "return tmp;\n"; ss << "}"; } @@ -2153,7 +2152,7 @@ void OpSLN::GenSlidingWindowFunction(std::stringstream , ss<<"life = "; ss << vSubArguments[2]->GenSlidingWindowDeclRef(); ss<<";\n"; -ss << "tmp = (cost-salvage)*pow(life,-1);\n"; +ss << "tmp = (cost-salvage)/life;\n"; ss << "return tmp;\n"; ss << "}"; } @@ -2349,8 +2348,8 @@ void OpPMT::GenSlidingWindowFunction(std::stringstream , ss<<"return -(tmp2+tmp3)/tmp1;\n"; ss<<"tmp-=tmp3;\n"; ss<<"tmp=tmp-tmp2*pow(1.0+tmp0,tmp1);\n"; -ss<<"tmp=tmp*pow(( (1.0+tmp0*tmp4)* "; -ss<<"( (pow(1.0+tmp0,tmp1)-1.0)/tmp0)),-1);\n"; +ss<<"tmp=tmp/( (1.0+tmp0*tmp4)* "; +ss<<"( (pow(1.0+tmp0,tmp1)-1.0)/tmp0));\n"; ss<<"return tmp;\n"; ss<<"}"; } @@ -2874,10 +2873,10 @@ void OpNper::GenSlidingWindowFunction(std::stringstream , ss <<"if (tmp0 == 0.0)\n"; ss <<"tmp=(-1*(tmp2 + tmp3)/tmp1);\n"; ss <<"else if (tmp4 > 0.0)\n"; -ss <<"tmp=log(-1*(tmp0*tmp3-tmp1*(1.0+tmp0))*"; -ss
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/op_statistical.cxx | 1044 +++ sc/source/core/opencl/opbase.cxx | 31 2 files changed, 539 insertions(+), 536 deletions(-) New commits: commit 0fe3863a4ef510009bc3191c035f1deafdd2fb6e Author: Luboš Luňák AuthorDate: Tue Aug 30 12:20:11 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Aug 31 09:14:34 2022 +0200 revert 'loplugin:flatten in sc' in sc/source/core/opencl I have patches rewriting this code to be much cleaner, so this won't be necessary and it makes it hard to rebase those patches. Also at least the CheckVariables::CheckSubArgumentIsNan() change actually makes the code worse. Change-Id: I5d63c158c6883200e2c6e03d02e00f6672d6a1af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139048 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_statistical.cxx b/sc/source/core/opencl/op_statistical.cxx index 3de4417fb240..ff7ed1e95bca 100644 --- a/sc/source/core/opencl/op_statistical.cxx +++ b/sc/source/core/opencl/op_statistical.cxx @@ -494,73 +494,167 @@ void OpTTest::GenSlidingWindowFunction(std::stringstream , ss << "}\n"; return ; } -if(vSubArguments.size() != 4) -return; - -FormulaToken *pCur = vSubArguments[0]->GetFormulaToken(); -FormulaToken *pCur1 = vSubArguments[1]->GetFormulaToken(); -FormulaToken *pCur2 = vSubArguments[2]->GetFormulaToken(); -FormulaToken *pCur3 = vSubArguments[3]->GetFormulaToken(); -assert(pCur); -assert(pCur1); -assert(pCur2); -assert(pCur3); -if(ocPush == vSubArguments[2]->GetFormulaToken()->GetOpCode()) +if(vSubArguments.size() == 4) { -if(pCur2->GetType() == formula::svSingleVectorRef) +FormulaToken *pCur = vSubArguments[0]->GetFormulaToken(); +FormulaToken *pCur1 = vSubArguments[1]->GetFormulaToken(); +FormulaToken *pCur2 = vSubArguments[2]->GetFormulaToken(); +FormulaToken *pCur3 = vSubArguments[3]->GetFormulaToken(); +assert(pCur); +assert(pCur1); +assert(pCur2); +assert(pCur3); +if(ocPush == vSubArguments[2]->GetFormulaToken()->GetOpCode()) { -const formula::SingleVectorRefToken* pSVR = -static_cast< const formula::SingleVectorRefToken*>(pCur2); -ss << "if (gid0 < " << pSVR->GetArrayLength() << ")\n"; -ss << "{\n"; -ss << "mode = " ; -ss << vSubArguments[2]->GenSlidingWindowDeclRef() << ";\n"; -ss << "if (isnan(mode))\n"; -ss << "mode = 0.0;\n"; -ss << "else\n"; -ss << "mode = floor(mode);\n"; -ss << "}\n"; +if(pCur2->GetType() == formula::svSingleVectorRef) +{ +const formula::SingleVectorRefToken* pSVR = +static_cast< const formula::SingleVectorRefToken*>(pCur2); +ss << "if (gid0 < " << pSVR->GetArrayLength() << ")\n"; +ss << "{\n"; +ss << "mode = " ; +ss << vSubArguments[2]->GenSlidingWindowDeclRef() << ";\n"; +ss << "if (isnan(mode))\n"; +ss << "mode = 0.0;\n"; +ss << "else\n"; +ss << "mode = floor(mode);\n"; +ss << "}\n"; +} +else if(pCur2->GetType() == formula::svDouble) +{ +ss << "mode = floor(convert_double("; +ss << pCur2->GetDouble() << "));\n"; +} +else +{ +ss << "return DBL_MAX;\n"; +ss << "}\n"; +return ; +} } -else if(pCur2->GetType() == formula::svDouble) +else { -ss << "mode = floor(convert_double("; -ss << pCur2->GetDouble() << "));\n"; +ss << "mode = floor(" ; +ss << vSubArguments[2]->GenSlidingWindowDeclRef() << ");\n"; } -else +ss << "if(!(mode == 1.0 || mode == 2.0))\n"; +ss << "return DBL_MAX;\n"; +if(ocPush==vSubArguments[3]->GetFormulaToken()->GetOpCode()) { -ss << "return DBL_MAX;\n"; -ss << "}\n"; -return ; +if(pCur3->GetType() == formula::svSingleVectorRef) +{ +const formula::SingleVectorRefToken* pSVR = +static_cast< const formula::SingleVectorRefToken*>(pCur3); +assert(pSVR); +ss << "if (gid0 < " << pSVR->GetArrayLength() << ")\n"; +ss << "{\n"; +ss << "if (isnan("; +ss << vSubArguments[3]->GenSlidingWindowDeclRef() << "))\n"; +ss << "
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx | 40 +++ 1 file changed, 36 insertions(+), 4 deletions(-) New commits: commit fd72a87868708569d19cccaab158116107698db5 Author: Luboš Luňák AuthorDate: Tue Aug 30 16:30:12 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Aug 31 09:14:14 2022 +0200 fix opencl implementations of comparison operators The normal core implementations use approximate comparison. Also add the two missing operators. Change-Id: I98f65b4fed70dd40f9087b6d98696b3bb10ea194 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139053 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 9ab5b83057e9..5800ef08c89d 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1786,12 +1786,25 @@ public: virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) const override { std::stringstream ss; -ss << "(" << lhs << " == " << rhs << ")"; +ss << "approx_equal(" << lhs << "," << rhs << ")"; return ss.str(); } virtual std::string BinFuncName() const override { return "eq"; } }; +class OpNotEqual : public Binary +{ +public: +virtual std::string GetBottom() override { return "0"; } +virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) const override +{ +std::stringstream ss; +ss << "!approx_equal(" << lhs << "," << rhs << ")"; +return ss.str(); +} +virtual std::string BinFuncName() const override { return "neq"; } +}; + class OpLessEqual : public Binary { public: @@ -1799,10 +1812,10 @@ public: virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) const override { std::stringstream ss; -ss << "(" << lhs << "<=" << rhs << ")"; +ss << "(approx_equal(" << lhs << "," << rhs << ") || " << lhs << "<=" << rhs << ")"; return ss.str(); } -virtual std::string BinFuncName() const override { return "leq"; } +virtual std::string BinFuncName() const override { return "le"; } }; class OpLess : public Binary @@ -1815,7 +1828,7 @@ public: ss << "(" << lhs << "<" << rhs << ")"; return ss.str(); } -virtual std::string BinFuncName() const override { return "less"; } +virtual std::string BinFuncName() const override { return "lt"; } }; class OpGreater : public Binary @@ -1831,6 +1844,19 @@ public: virtual std::string BinFuncName() const override { return "gt"; } }; +class OpGreaterEqual : public Binary +{ +public: +virtual std::string GetBottom() override { return "0"; } +virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) const override +{ +std::stringstream ss; +ss << "(approx_equal(" << lhs << "," << rhs << ") || " << lhs << ">=" << rhs << ")"; +return ss.str(); +} +virtual std::string BinFuncName() const override { return "ge"; } +}; + class OpSum : public Reduction { public: @@ -3004,9 +3030,15 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, case ocEqual: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; +case ocNotEqual: +mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); +break; case ocGreater: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break; +case ocGreaterEqual: +mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); +break; case ocSYD: mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); break;
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/formulagroupcl.cxx |9 sc/source/core/opencl/op_math.cxx| 66 --- sc/source/core/opencl/op_math.hxx|9 3 files changed, 1 insertion(+), 83 deletions(-) New commits: commit 067610f46ae57f88439a1b7c5a28209d129e641e Author: Luboš Luňák AuthorDate: Tue Aug 30 15:48:56 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Aug 31 09:13:54 2022 +0200 do not accept strings for opencl equal operator This is part of "using string hashes for strings is kind of stupid" removal. And it seems this is never used for all of Calc's tests. Just keep it for numeric comparison. Change-Id: I1c5e3b10c9cacf3d163a675373f14d879a857db8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139052 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 6855434d37b7..9ab5b83057e9 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -93,7 +93,6 @@ const char* const publicFunc = "double legalize(double a, double b) { return isnan(a)?b:a;}\n" "double fsub(double a, double b) { return a-b; }\n" "double fdiv(double a, double b) { return a/b; }\n" - "double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n" "int is_representable_integer(double a) {\n" "long kMaxInt = (1L << 53) - 1;\n" "if (a <= as_double(kMaxInt))\n" @@ -1787,11 +1786,10 @@ public: virtual std::string Gen2( const std::string& lhs, const std::string& rhs ) const override { std::stringstream ss; -ss << "strequal(" << lhs << "," << rhs << ")"; +ss << "(" << lhs << " == " << rhs << ")"; return ss.str(); } virtual std::string BinFuncName() const override { return "eq"; } -virtual bool takeString() const override { return true; } }; class OpLessEqual : public Binary commit 975fa7d700d50d376090de6c370aa00b8b38e8cf Author: Luboš Luňák AuthorDate: Tue Aug 30 15:48:40 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Aug 31 09:13:37 2022 +0200 remove opencl implementation of CONVERT() Part of removal of string handling in opencl (using the hash here is not that bad, a hash collision is unlikely, but still). And the code handles only two conversions (m<->km and sec<->min ? I'm not even sure). And it seems it's not used a single time for all of Calc's checks. It could be added back if there's use for it (possibly with handling the strings better, e.g. by converting them in the C++ code to enumeration values passed to opencl). Change-Id: I65a6ab51d8fb42c09d8a76a1e09f6f5fcbae099a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139051 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index b30fa97f854f..6855434d37b7 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -3771,11 +3771,6 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], std::make_shared(), nResultSize)); } -else if (pChild->GetExternal() == "com.sun.star.sheet.addin.Analysis.getConvert") -{ -mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], -std::make_shared(), nResultSize)); -} else if (pChild->GetExternal() == "com.sun.star.sheet.addin.Analysis.getIseven") { mvSubArguments.push_back(SoPHelper(mCalcConfig, ts, ft->Children[i], diff --git a/sc/source/core/opencl/op_math.cxx b/sc/source/core/opencl/op_math.cxx index 4042e2511177..5914436ffd8e 100644 --- a/sc/source/core/opencl/op_math.cxx +++ b/sc/source/core/opencl/op_math.cxx @@ -2642,72 +2642,6 @@ void OpCombin::GenSlidingWindowFunction(std::stringstream , ss << "return result;\n"; ss << "}\n"; } -void OpConvert::GenSlidingWindowFunction( -std::stringstream , const std::string , -SubArguments ) -{ -// The CONVERT function converts a value from one unit of -// measurement to another. It takes the units of measurements to -// convert between as string arguments. This implementation -// handles just a very small subset of such conversions. - -int arg1=vSubArguments[1]->GetFormulaToken()->GetString(). -getString().toAsciiUpperCase().hashCode(); -int arg2=vSubArguments[2]->GetFormulaToken()->GetString(). -getString().toAsciiUpperCase().hashCode(); - -// Check if the from and to units are those combinations that the -// code below supports. -if( !((arg1==5584&==108)|| -
[Libreoffice-commits] core.git: sc/source
sc/source/core/opencl/formulagroupcl.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 19e64b69fe1327993e8eeec41572d9c258686965 Author: Luboš Luňák AuthorDate: Tue Aug 30 15:44:26 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Aug 31 09:13:13 2022 +0200 do not take strings for opencl <,>,<=,>= operations OpenCL code doesn't actually work on strings themselves, but only on their hashes. And comparing hashes doesn't necessarily have the same result as comparing the strings themselves. This is a part of preparation for removal of string handling in opencl, as the whole idea of handling strings in opencl is probably stupid. Change-Id: I8fa98bca0af14832f0d76135c1e195e1fb24451a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139050 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 67f0da6eb3d6..b30fa97f854f 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1546,7 +1546,7 @@ public: vSubArguments[1]->GenSlidingWindowDeclRef()) << ";\n\t"; ss << "return tmp;\n}"; } -virtual bool takeString() const override { return true; } +virtual bool takeString() const override { return false; } virtual bool takeNumeric() const override { return true; } }; @@ -1791,6 +1791,7 @@ public: return ss.str(); } virtual std::string BinFuncName() const override { return "eq"; } +virtual bool takeString() const override { return true; } }; class OpLessEqual : public Binary
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - desktop/inc desktop/source include/editeng include/sfx2 include/test sfx2/source sw/source test/source
desktop/inc/lib/init.hxx|1 + desktop/source/lib/init.cxx |6 ++ include/editeng/outliner.hxx|1 + include/sfx2/lokcallback.hxx|3 +++ include/sfx2/viewsh.hxx |5 +++-- include/test/lokcallback.hxx|1 + sfx2/source/view/viewsh.cxx | 10 ++ sw/source/core/view/viewimp.cxx |5 - test/source/lokcallback.cxx |6 ++ 9 files changed, 35 insertions(+), 3 deletions(-) New commits: commit fc856cd46ac475222772395c522dc34058bd89b9 Author: Luboš Luňák AuthorDate: Tue Jun 28 09:42:17 2022 +0200 Commit: Miklos Vajna CommitDate: Wed Aug 31 08:37:06 2022 +0200 lok: make sure flushPendingLOKInvalidateTiles() is called SwViewShellImp::AddPendingLOKInvalidation() collects invalidations, but this was relying on something eventually calling flushPendingLOKInvalidateTiles(), which wasn't guaranteed. If e.g. a spellchecker caused an invalidation from in idle callback and nothing else changed, then the LOK callback handling code didn't know there was something pending. So add an explicit call to ensure to notify about these pending invalidations. Change-Id: I0a9cb0d5aba2fdbbac126cd8a4a3412bef1cab25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136533 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index 8b26e117c1fb..6a6f0bd350a3 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -115,6 +115,7 @@ namespace desktop { virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) override; virtual void libreOfficeKitViewUpdatedCallback(int nType) override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) override; +virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; private: struct CallbackData diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 4abe6f2c5166..f22558d6d76e 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1477,6 +1477,12 @@ void CallbackFlushHandler::libreOfficeKitViewUpdatedCallbackPerViewId(int nType, setUpdatedTypePerViewId(nType, nViewId, nSourceViewId, true); } +void CallbackFlushHandler::libreOfficeKitViewAddPendingInvalidateTiles() +{ +// Invoke() will call flushPendingLOKInvalidateTiles(), so just make sure the timer is active. +startTimer(); +} + void CallbackFlushHandler::queue(const int type, const char* data) { CallbackData callbackData(data); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 8cc3e8c23247..e7e9720ad432 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -369,6 +369,7 @@ public: virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0; virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0; +virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual ViewShellId GetViewShellId() const = 0; virtual ViewShellDocId GetDocId() const = 0; /// Wrapper around SfxLokHelper::notifyOtherViews(). diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx index 6f59402d0cec..b1799386d42b 100644 --- a/include/sfx2/lokcallback.hxx +++ b/include/sfx2/lokcallback.hxx @@ -48,6 +48,9 @@ public: virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) = 0; +// There are pending invalidate tiles calls that need to be processed. +// A call to SfxViewShell::flushPendingLOKInvalidateTiles() should be scheduled. +virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 26a2324c7ca0..f2b0bf29080a 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -340,10 +340,11 @@ public: virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override; virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const override; -// Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. -virtual void flushPendingLOKInvalidateTiles(); virtual void libreOfficeKitViewUpdatedCallback(int nType) const override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override; +//
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - desktop/inc desktop/source include/editeng include/sfx2 include/test sfx2/source sw/source test/source
desktop/inc/lib/init.hxx|1 + desktop/source/lib/init.cxx |6 ++ include/editeng/outliner.hxx|1 + include/sfx2/lokcallback.hxx|3 +++ include/sfx2/viewsh.hxx |5 +++-- include/test/lokcallback.hxx|1 + sfx2/source/view/viewsh.cxx | 10 ++ sw/source/core/view/viewimp.cxx |5 - test/source/lokcallback.cxx |6 ++ 9 files changed, 35 insertions(+), 3 deletions(-) New commits: commit 2cc955f9109c0fc8443c9f93c1bf6bd317043cb5 Author: Luboš Luňák AuthorDate: Tue Jun 28 09:42:17 2022 +0200 Commit: Miklos Vajna CommitDate: Wed Aug 31 08:36:19 2022 +0200 lok: make sure flushPendingLOKInvalidateTiles() is called SwViewShellImp::AddPendingLOKInvalidation() collects invalidations, but this was relying on something eventually calling flushPendingLOKInvalidateTiles(), which wasn't guaranteed. If e.g. a spellchecker caused an invalidation from in idle callback and nothing else changed, then the LOK callback handling code didn't know there was something pending. So add an explicit call to ensure to notify about these pending invalidations. Change-Id: I0a9cb0d5aba2fdbbac126cd8a4a3412bef1cab25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136531 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 32cbd1c57dbaf7cff2325c126b3adfcf2150bc23) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136532 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index baa1b682de07..7346e51ff159 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -119,6 +119,7 @@ namespace desktop { virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) override; virtual void libreOfficeKitViewUpdatedCallback(int nType) override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) override; +virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; virtual void dumpState(rtl::OStringBuffer ) override; private: diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d1b1931fc69e..bf37ae65c9d0 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1490,6 +1490,12 @@ void CallbackFlushHandler::dumpState(rtl::OStringBuffer ) } } +void CallbackFlushHandler::libreOfficeKitViewAddPendingInvalidateTiles() +{ +// Invoke() will call flushPendingLOKInvalidateTiles(), so just make sure the timer is active. +startTimer(); +} + void CallbackFlushHandler::queue(const int type, const char* data) { CallbackData callbackData(data); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 87fabb4ee45e..c8890a89a72f 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -373,6 +373,7 @@ public: virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0; virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0; +virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual ViewShellId GetViewShellId() const = 0; virtual ViewShellDocId GetDocId() const = 0; /// Wrapper around SfxLokHelper::notifyOtherViews(). diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx index 95572aba1104..1b90e6c938c5 100644 --- a/include/sfx2/lokcallback.hxx +++ b/include/sfx2/lokcallback.hxx @@ -52,6 +52,9 @@ public: virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) = 0; +// There are pending invalidate tiles calls that need to be processed. +// A call to SfxViewShell::flushPendingLOKInvalidateTiles() should be scheduled. +virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual void dumpState(rtl::OStringBuffer& rState) = 0; }; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index e2ef0475dbc6..9f085fca62e3 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -346,10 +346,11 @@ public: virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override; virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const override; -// Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. -virtual void flushPendingLOKInvalidateTiles(); virtual void libreOfficeKitViewUpdatedCallback(int
[Libreoffice-commits] core.git: 2 commits - sc/source
sc/source/core/opencl/op_spreadsheet.cxx | 213 +-- 1 file changed, 120 insertions(+), 93 deletions(-) New commits: commit 73f9048c4038707258ee42acaf1946d90df6270a Author: Luboš Luňák AuthorDate: Tue Aug 30 12:19:46 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Aug 30 15:52:21 2022 +0200 bail out in opencl unsorted vlookup as soon as a match is found Change-Id: Ic2eda985f93c4eac26e08251c5bdbc36d7c03708 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139028 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_spreadsheet.cxx b/sc/source/core/opencl/op_spreadsheet.cxx index 09ef4e65ef65..4679b2d01f30 100644 --- a/sc/source/core/opencl/op_spreadsheet.cxx +++ b/sc/source/core/opencl/op_spreadsheet.cxx @@ -165,9 +165,10 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream , } else { -ss << "if(tmp0 == tmp1 && rowNum == -1)\n"; +ss << "if(tmp0 == tmp1)\n"; ss << "{\n"; ss << "rowNum = doubleIndex;\n"; +ss << "break;\n"; ss << "}\n"; ss << "i++;\n"; ss << "doubleIndex++;\n"; @@ -244,9 +245,10 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream , } else { -ss << "if(tmp0 == tmp1 && rowNum == -1)\n"; +ss << "if(tmp0 == tmp1)\n"; ss << "{\n"; ss << "rowNum = doubleIndex;\n"; +ss << "break;\n"; ss << "}\n"; } ss << "}\n\n"; commit ad2b6f1623300d28723d66fa0ac40530498acc77 Author: Luboš Luňák AuthorDate: Tue Aug 30 12:19:41 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Aug 30 15:52:05 2022 +0200 opencl vlookup, move constant condition out of a loop There's no need to check in every loop iteration if the vlookup should be sorted or unsorted, and this needless branching slows the execution. Change-Id: I4f3072ddeaf54269cfec51043e84adb2571f0f73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139027 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/opencl/op_spreadsheet.cxx b/sc/source/core/opencl/op_spreadsheet.cxx index d088b718b442..09ef4e65ef65 100644 --- a/sc/source/core/opencl/op_spreadsheet.cxx +++ b/sc/source/core/opencl/op_spreadsheet.cxx @@ -96,76 +96,85 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream , tmpCur = vSubArguments[1]->GetFormulaToken(); pCurDVR = static_cast(tmpCur); size_t nCurWindowSize = std::min(pCurDVR->GetArrayLength(), pCurDVR->GetRefRowSize()); -int unrollSize = 8; -ss << "int loop;\n"; +const int unrollSize = 8; + +ss << "\n"; +ss << "int loop = "; if (!pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed()) { -ss << "loop = ("IsEndFixed()) { -ss << "loop = (" IsEndFixed()) -{ -ss << "int doubleIndex = i+gid0;\n"; -} -else -{ -ss << "int doubleIndex = i;\n"; -} -ss << "if(tmp"; +ss << "if(tmp"; ss << 3+(secondParaWidth-1); -ss << " == 1)\n"; -ss << "{\n"; +ss << " == 0) /* unsorted vlookup */\n"; +ss << "{\n"; -for (int j = 0;j < unrollSize; j++) +for( int sorted = 0; sorted < 2; ++sorted ) // sorted vs unsorted vlookup cases { -CheckSubArgumentIsNan(ss,vSubArguments,1); +if( sorted == 1 ) +{ +ss << "}\n"; +ss << "else\n"; +ss << "{ /* sorted vlookup */ \n"; +} -ss << "if((tmp0 - tmp1)>=0 && intermediate > (tmp0 -tmp1))\n"; -ss << "{\n"; -ss << "rowNum = doubleIndex;\n"; -ss << "intermediate = tmp0 - tmp1;\n"; -ss << "}\n"; -ss << "i++;\n"; -ss << "doubleIndex++;\n"; -} +ss << "for ( int j = 0;j< loop; j++)\n"; +ss << "{\n"; +ss << "int i = "; +if (!pCurDVR->IsStartFixed()&& pCurDVR->IsEndFixed()) +{ +ss << "gid0 + j * "<< unrollSize <<";\n"; +} +else +{ +ss << "j * "<< unrollSize <<";\n"; +}
[Libreoffice-commits] core.git: sc/qa sc/source
sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods | 220 + sc/source/core/opencl/op_spreadsheet.cxx| 252 +++- 2 files changed, 334 insertions(+), 138 deletions(-) New commits: commit 0db5b15e8e2799ed28ed4baa9939b76c90e944fb Author: Luboš Luňák AuthorDate: Tue Aug 30 12:19:16 2022 +0200 Commit: Luboš Luňák CommitDate: Tue Aug 30 15:51:39 2022 +0200 opencl VLOOKUP should not look up in other columns VLOOKUP searches only the first column, I have no idea why this was made to search all of them. Change-Id: I3297a723a727ba3f56db9bbb320d5b868b247db7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139026 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods index 301b9bfaf690..354aff0d763d 100644 --- a/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods +++ b/sc/qa/unit/data/functions/spreadsheet/fods/vlookup.fods @@ -991,6 +991,15 @@ False + + + Sorted num + + + + Unsorted num + + @@ -1068,6 +1077,20 @@ cherry + + + 1 + + + 11 + + + + 5 + + + 21 + @@ -1129,6 +1152,20 @@ banana + + + 2 + + + 12 + + + + 8 + + + 24 + @@ -1188,6 +1225,20 @@ blackberry + + + 4 + + + 14 + + + + 6 + + + 22 + @@ -2343,14 +2394,179 @@ - + + + 11 + + + 11 + + + PRAVDA + + + =VLOOKUP(1;$AJ$2:$AK$4;2;1) + + + + + + 14 + + + 14 + + + PRAVDA + + + =VLOOKUP(4;$AJ$2:$AK$4;2;1) + + + + + + 12 + + + 12 + + + PRAVDA + + + =VLOOKUP(3,5;$AJ$2:$AK$4;2;1) + + + + + + 14 + + + 14 + + + PRAVDA + + + =VLOOKUP(5;$AJ$2:$AK$4;2;1) + + + + + + #N/A + + + #N/A + + + PRAVDA + + + =VLOOKUP(-0,5;$AJ$2:$AK$4;2;1) + + + + + + 14 + + + 14 + + + PRAVDA + + + =VLOOKUP(11;$AJ$2:$AK$4;2;1) + + + + + + 21 + + + 21 + + + PRAVDA + + + =VLOOKUP(5;$AM$2:$AN$4;2;0) + + + + + + 22 + + + 22 + + + PRAVDA + + + =VLOOKUP(6;$AM$2:$AN$4;2;0) + + + + + + 24 + + + 24 + + + PRAVDA + + + =VLOOKUP(8;$AM$2:$AN$4;2;0) + + + + + + #N/A + + + #N/A + + + PRAVDA + + + =VLOOKUP(7;$AM$2:$AN$4;2;0) + + + + + + 21 + + + #N/A + + + NEPRAVDA + + + =VLOOKUP(21;$AM$2:$AN$4;2;0) + + + + - + diff --git a/sc/source/core/opencl/op_spreadsheet.cxx b/sc/source/core/opencl/op_spreadsheet.cxx index 48789d582b07..d088b718b442 100644 --- a/sc/source/core/opencl/op_spreadsheet.cxx +++ b/sc/source/core/opencl/op_spreadsheet.cxx @@ -115,155 +115,135 @@ void OpVLookup::GenSlidingWindowFunction(std::stringstream , ss << "loop = "IsEndFixed()) -{ -ss << "int doubleIndex = i+gid0;\n"; -} -else -{ -ss << "int doubleIndex = i;\n"; -} -ss << "if(tmp"; -ss << 3+(secondParaWidth-1); -ss << " == 1)\n"; -ss << "{\n"; - -for (int j = 0;j < unrollSize; j++) -{ -CheckSubArgumentIsNan(ss,vSubArguments,1+i); - -ss << "if((tmp0 - tmp"; -ss << 1+i; -ss << ")>=0 && intermediate > ( tmp0 -tmp"; -ss << 1+i; -ss << "))\n"; -ss << "{\n"; -ss << "rowNum = doubleIndex;\n"; -ss << "intermediate = tmp0 - tmp"; -ss << 1+i; -ss << ";\n"; -ss << "}\n"; -ss << "i++;\n"; -ss << "doubleIndex++;\n"; -} - -ss << "}else\n"; -ss << "
[Libreoffice-commits] core.git: sc/source
sc/source/core/tool/interpr1.cxx |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) New commits: commit 690458889fd875a7885b692d3204c45c5016b925 Author: Luboš Luňák AuthorDate: Fri Aug 26 16:10:38 2022 +0200 Commit: Luboš Luňák CommitDate: Mon Aug 29 10:13:15 2022 +0200 fix undoing range reducing to apply only to COUNTIFS (tdf#150618) Before 7674399aac661eb503d7badc53b9a4d68bd9839d the code tried to range-reduce all operations except for COUNTIFS, the commit added handling also COUNTIFS and then later undo the rare cases when it shouldn't be done, but the undo wasn't specific to COUNTIFS even though it should have. Change-Id: Ibdb6516a1ac7bc7d34f16f8a99781859e9fc7b60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138880 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 957d93005375..9eb660386e97 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -6092,9 +6092,10 @@ void ScInterpreter::IterateParametersIfs( double(*ResultFunc)( const sc::ParamIf rParam.eSearchType = DetectSearchType(rItem.maString.getString(), mrDoc); } -// Undo bRangeReduce if asked to match empty cells (which should be rare). +// Undo bRangeReduce if asked to match empty cells for COUNTIFS (which should be rare). assert(rEntry.GetQueryItems().size() == 1); -if((rEntry.IsQueryByEmpty() || rItem.mbMatchEmpty) && bRangeReduce) +const bool isCountIfs = (nParamCount % 2) == 0; +if(isCountIfs && (rEntry.IsQueryByEmpty() || rItem.mbMatchEmpty) && bRangeReduce) { bRangeReduce = false; // All criteria ranges are svDoubleRef's, so only vConditions needs adjusting.
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sc/inc sc/source
sc/inc/column.hxx |2 - sc/inc/document.hxx|4 ++- sc/inc/formulacell.hxx |2 + sc/inc/rangecache.hxx |2 - sc/inc/table.hxx |2 - sc/source/core/data/column3.cxx| 44 + sc/source/core/data/documen2.cxx | 11 ++--- sc/source/core/data/document.cxx | 13 +++--- sc/source/core/data/table1.cxx |7 - sc/source/core/tool/rangecache.cxx |6 - 10 files changed, 65 insertions(+), 28 deletions(-) New commits: commit d8eba60009afce4d9cca1488b4ce70e221642865 Author: Luboš Luňák AuthorDate: Tue Aug 23 19:47:50 2022 +0200 Commit: Xisco Fauli CommitDate: Thu Aug 25 23:06:17 2022 +0200 try harder to ensure InterpretCellsIfNeeded() interprets (tdf#150499) ScFormulaCell::Interpret() tries to interpret the whole formula group (or the given range of it), but it's not guaranteed, and possibly just the called cell will be interpreted. So if a specific range really needs to be interpreted, handle that case. Change-Id: I7fb563ae471eefd49e5bb6c92b6aff98c42a440e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138741 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit e1f02b8d00272be9cbf17cb8c351445a08a4c5f4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138814 Reviewed-by: Xisco Fauli diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index e4b7eb148d9a..aa5a5c689c01 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -721,7 +721,7 @@ public: bool IsDrawObjectsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ); -void InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 ); +bool InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 ); static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 959960e15e03..b4552e792000 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1363,7 +1363,9 @@ public: void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp void InterpretDirtyCells( const ScRangeList& rRanges ); // Interprets cells that have NeedsInterpret(), i.e. the same like calling MaybeInterpret() on them. -void InterpretCellsIfNeeded( const ScRangeList& rRanges ); +// Returns false if some couldn't be interpreted (i.e. they still have NeedsInterpret()). +// Useful to ensure that the given cells will not need interpreting. +bool InterpretCellsIfNeeded( const ScRangeList& rRanges ); SC_DLLPUBLIC void CalcAll(); SC_DLLPUBLIC void CalcAfterLoad( bool bStartListening = true ); void CompileAll(); diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 013a0058ba5d..789353efce9f 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -261,6 +261,8 @@ public: void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); // compile temporary string tokens void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ); boolMarkUsedExternalReferences(); +// Returns true if the cell was interpreted as part of the formula group. +// The parameters may limit which subset of the formula group should be interepreted, if possible. bool Interpret(SCROW nStartOffset = -1, SCROW nEndOffset = -1); bool IsIterCell() const { return bIsIterCell; } sal_uInt16 GetSeenInIteration() const { return nSeenInIteration; } diff --git a/sc/inc/rangecache.hxx b/sc/inc/rangecache.hxx index 7490a570f20a..c65e8653a458 100644 --- a/sc/inc/rangecache.hxx +++ b/sc/inc/rangecache.hxx @@ -46,7 +46,7 @@ class ScSortedRangeCache final : public SvtListener public: /// MUST be new'd because Notify() deletes. ScSortedRangeCache(ScDocument* pDoc, const ScRange& rRange, const ScQueryParam& param, - ScInterpreterContext* context); + ScInterpreterContext* context, bool invalid = false); /// Returns if the cache is usable. bool isValid() const { return mValid; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0a3bc6c67956..35388b54ea1f 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1057,7 +1057,7 @@ public: void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool* pPool ) const; void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); -void InterpretCellsIfNeeded( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); +bool InterpretCellsIfNeeded( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen ); diff --git
[Libreoffice-commits] core.git: desktop/inc desktop/source include/editeng include/sfx2 include/test sfx2/source sw/source test/source
desktop/inc/lib/init.hxx|1 + desktop/source/lib/init.cxx |6 ++ include/editeng/outliner.hxx|1 + include/sfx2/lokcallback.hxx|3 +++ include/sfx2/viewsh.hxx |5 +++-- include/test/lokcallback.hxx|1 + sfx2/source/view/viewsh.cxx | 10 ++ sw/source/core/view/viewimp.cxx |5 - test/source/lokcallback.cxx |6 ++ 9 files changed, 35 insertions(+), 3 deletions(-) New commits: commit 32cbd1c57dbaf7cff2325c126b3adfcf2150bc23 Author: Luboš Luňák AuthorDate: Tue Jun 28 09:42:17 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Aug 25 10:28:35 2022 +0200 lok: make sure flushPendingLOKInvalidateTiles() is called SwViewShellImp::AddPendingLOKInvalidation() collects invalidations, but this was relying on something eventually calling flushPendingLOKInvalidateTiles(), which wasn't guaranteed. If e.g. a spellchecker caused an invalidation from in idle callback and nothing else changed, then the LOK callback handling code didn't know there was something pending. So add an explicit call to ensure to notify about these pending invalidations. Change-Id: I0a9cb0d5aba2fdbbac126cd8a4a3412bef1cab25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136531 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx index 78c74c753063..2b21f6a6d30a 100644 --- a/desktop/inc/lib/init.hxx +++ b/desktop/inc/lib/init.hxx @@ -118,6 +118,7 @@ namespace desktop { virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) override; virtual void libreOfficeKitViewUpdatedCallback(int nType) override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) override; +virtual void libreOfficeKitViewAddPendingInvalidateTiles() override; virtual void dumpState(rtl::OStringBuffer ) override; private: diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 91f6b771a8f1..54b72d7ef88f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1486,6 +1486,12 @@ void CallbackFlushHandler::dumpState(rtl::OStringBuffer ) } } +void CallbackFlushHandler::libreOfficeKitViewAddPendingInvalidateTiles() +{ +// Invoke() will call flushPendingLOKInvalidateTiles(), so just make sure the timer is active. +startTimer(); +} + void CallbackFlushHandler::queue(const int type, const char* data) { CallbackData callbackData(data); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 3326a3d6662b..1712c1f3d427 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -373,6 +373,7 @@ public: virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const = 0; virtual void libreOfficeKitViewUpdatedCallback(int nType) const = 0; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const = 0; +virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual ViewShellId GetViewShellId() const = 0; virtual ViewShellDocId GetDocId() const = 0; /// Wrapper around SfxLokHelper::notifyOtherViews(). diff --git a/include/sfx2/lokcallback.hxx b/include/sfx2/lokcallback.hxx index a92f60572145..cf97f083e792 100644 --- a/include/sfx2/lokcallback.hxx +++ b/include/sfx2/lokcallback.hxx @@ -50,6 +50,9 @@ public: virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) = 0; +// There are pending invalidate tiles calls that need to be processed. +// A call to SfxViewShell::flushPendingLOKInvalidateTiles() should be scheduled. +virtual void libreOfficeKitViewAddPendingInvalidateTiles() = 0; virtual void dumpState(rtl::OStringBuffer& rState) = 0; }; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 9762c6cd6e03..28b4c190cdc8 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -350,10 +350,11 @@ public: virtual void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; virtual void libreOfficeKitViewCallbackWithViewId(int nType, const char* pPayload, int nViewId) const override; virtual void libreOfficeKitViewInvalidateTilesCallback(const tools::Rectangle* pRect, int nPart) const override; -// Performs any pending calls to libreOfficeKitViewInvalidateTilesCallback() as necessary. -virtual void flushPendingLOKInvalidateTiles(); virtual void libreOfficeKitViewUpdatedCallback(int nType) const override; virtual void libreOfficeKitViewUpdatedCallbackPerViewId(int nType, int nViewId, int nSourceViewId) const override; +// Performs any pending calls to
[Libreoffice-commits] core.git: sc/inc sc/source
sc/inc/column.hxx |2 - sc/inc/document.hxx|4 ++- sc/inc/formulacell.hxx |2 + sc/inc/rangecache.hxx |2 - sc/inc/table.hxx |2 - sc/source/core/data/column3.cxx| 44 + sc/source/core/data/documen2.cxx | 11 ++--- sc/source/core/data/document.cxx | 13 +++--- sc/source/core/data/table1.cxx |7 - sc/source/core/tool/rangecache.cxx |6 - 10 files changed, 65 insertions(+), 28 deletions(-) New commits: commit b1b2083ec2ebde32d2c3f7ee2f2e3d2cc75721d8 Author: Luboš Luňák AuthorDate: Tue Aug 23 19:47:50 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Aug 25 09:47:35 2022 +0200 try harder to ensure InterpretCellsIfNeeded() interprets (tdf#150499) ScFormulaCell::Interpret() tries to interpret the whole formula group (or the given range of it), but it's not guaranteed, and possibly just the called cell will be interpreted. So if a specific range really needs to be interpreted, handle that case. Change-Id: I7fb563ae471eefd49e5bb6c92b6aff98c42a440e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138741 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 4cc57f418e91..69f0d12d8273 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -719,7 +719,7 @@ public: bool IsDrawObjectsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ); -void InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 ); +bool InterpretCellsIfNeeded( SCROW nRow1, SCROW nRow2 ); static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 7866b5a3cf9c..4dab1da8158b 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1363,7 +1363,9 @@ public: void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp void InterpretDirtyCells( const ScRangeList& rRanges ); // Interprets cells that have NeedsInterpret(), i.e. the same like calling MaybeInterpret() on them. -void InterpretCellsIfNeeded( const ScRangeList& rRanges ); +// Returns false if some couldn't be interpreted (i.e. they still have NeedsInterpret()). +// Useful to ensure that the given cells will not need interpreting. +bool InterpretCellsIfNeeded( const ScRangeList& rRanges ); SC_DLLPUBLIC void CalcAll(); SC_DLLPUBLIC void CalcAfterLoad( bool bStartListening = true ); void CompileAll(); diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx index 013a0058ba5d..789353efce9f 100644 --- a/sc/inc/formulacell.hxx +++ b/sc/inc/formulacell.hxx @@ -261,6 +261,8 @@ public: void CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rProgress ); // compile temporary string tokens void CalcAfterLoad( sc::CompileFormulaContext& rCxt, bool bStartListening ); boolMarkUsedExternalReferences(); +// Returns true if the cell was interpreted as part of the formula group. +// The parameters may limit which subset of the formula group should be interepreted, if possible. bool Interpret(SCROW nStartOffset = -1, SCROW nEndOffset = -1); bool IsIterCell() const { return bIsIterCell; } sal_uInt16 GetSeenInIteration() const { return nSeenInIteration; } diff --git a/sc/inc/rangecache.hxx b/sc/inc/rangecache.hxx index 7490a570f20a..c65e8653a458 100644 --- a/sc/inc/rangecache.hxx +++ b/sc/inc/rangecache.hxx @@ -46,7 +46,7 @@ class ScSortedRangeCache final : public SvtListener public: /// MUST be new'd because Notify() deletes. ScSortedRangeCache(ScDocument* pDoc, const ScRange& rRange, const ScQueryParam& param, - ScInterpreterContext* context); + ScInterpreterContext* context, bool invalid = false); /// Returns if the cache is usable. bool isValid() const { return mValid; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index c6c3bd031cb3..d8daa1b03f4a 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -1057,7 +1057,7 @@ public: void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, svl::SharedStringPool* pPool ) const; void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); -void InterpretCellsIfNeeded( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); +bool InterpretCellsIfNeeded( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); void SetFormulaResults( SCCOL nCol, SCROW nRow, const double* pResults, size_t nLen ); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 6956951cf765..b93e3afb47fc 100644 --- a/sc/source/core/data/column3.cxx +++
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - svtools/source
svtools/source/svrtf/parrtf.cxx | 35 +-- 1 file changed, 21 insertions(+), 14 deletions(-) New commits: commit 7ca35790effb9a5a1ee17bd9a669fc2c38fcb99f Author: Luboš Luňák AuthorDate: Fri Aug 12 13:01:24 2022 +0200 Commit: Xisco Fauli CommitDate: Mon Aug 15 13:38:38 2022 +0200 revert direct append to aToken in SvRTFParser::ScanText() (tdf#150151) This reverts most of commit 09558e2f45e27d572fd261562c884c2d2cc896a7, the problem is that GetNextToken_() resets aToken, overwriting the value created by this function. Change-Id: I1daca07a6e01cfecfeff9fbf7c311b0d392d84d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138190 Tested-by: Jenkins Reviewed-by: Luboš Luňák Signed-off-by: Xisco Fauli Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138273 diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index c6dcef7a0b69..69fdb9508408 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -302,9 +302,9 @@ sal_Unicode SvRTFParser::GetHexValue() void SvRTFParser::ScanText() { const sal_Unicode cBreak = 0; -const sal_uInt32 nStartLength = aToken.getLength(); +OUStringBuffer aStrBuffer; bool bContinue = true; -while( bContinue && IsParserWorking() && aToken.getLength() - nStartLength < MAX_STRING_LEN) +while( bContinue && IsParserWorking() && aStrBuffer.getLength() < MAX_STRING_LEN) { bool bNextCh = true; switch( nNextCh ) @@ -342,8 +342,8 @@ void SvRTFParser::ScanText() if (next>0xFF) // fix for #i43933# and #i35653# { if (!aByteString.isEmpty()) -aToken.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) ); - aToken.append(static_cast(next)); +aStrBuffer.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) ); + aStrBuffer.append(static_cast(next)); continue; } @@ -383,23 +383,23 @@ void SvRTFParser::ScanText() bNextCh = false; if (!aByteString.isEmpty()) -aToken.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) ); +aStrBuffer.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) ); } break; case '\\': case '}': case '{': case '+': // I found in a RTF file -aToken.append(sal_Unicode(nNextCh)); +aStrBuffer.append(sal_Unicode(nNextCh)); break; case '~': // nonbreaking space -aToken.append(u'\x00A0'); +aStrBuffer.append(u'\x00A0'); break; case '-': // optional hyphen -aToken.append(u'\x00AD'); +aStrBuffer.append(u'\x00AD'); break; case '_': // nonbreaking hyphen -aToken.append(u'\x2011'); +aStrBuffer.append(u'\x2011'); break; case 'u': @@ -412,12 +412,12 @@ void SvRTFParser::ScanText() { bRTF_InTextRead = true; -OUString sSave( aToken ); +OUString sSave( aToken ); // GetNextToken_() overwrites this nNextCh = '\\'; int nToken = GetNextToken_(); DBG_ASSERT( RTF_U == nToken, "still not a UNI-Code character" ); // don't convert symbol chars -aToken.append(static_cast< sal_Unicode >(nTokenValue)); +aStrBuffer.append(static_cast< sal_Unicode >(nTokenValue)); // overread the next n "RTF" characters. This // can be also \{, \}, \'88 @@ -488,20 +488,24 @@ void SvRTFParser::ScanText() break; default: -if( nNextCh == cBreak || aToken.getLength() - nStartLength >= MAX_STRING_LEN) +if( nNextCh == cBreak || aStrBuffer.getLength() >= MAX_STRING_LEN) bContinue = false; else { do { // all other characters end up in the text -aToken.appendUtf32(nNextCh); +aStrBuffer.appendUtf32(nNextCh); if (sal_Unicode(EOF) == (nNextCh
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - vcl/source
vcl/source/gdi/impglyphitem.cxx |4 1 file changed, 4 deletions(-) New commits: commit 7e428644ff93ecccda9196ebff8883f6f077c7b8 Author: Luboš Luňák AuthorDate: Thu Aug 11 15:02:02 2022 +0200 Commit: Caolán McNamara CommitDate: Sat Aug 13 16:43:30 2022 +0200 fix checking glyph break position (tdf#150138) Glyphs in RTL mode are in reverse, which includes the fast that a cluster start is last, not first. So going back requires means going back just one glyph, not a whole cluster. I'm not sure why I originally did it this way, tdf#148954 works fine even this way, so presumably I got confused. Change-Id: I6ed0caf4e64e93e0643f7b88099bc7c992ea3329 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138144 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit fd82419a27014f7b53138332b252f0ea7f17000a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138125 Reviewed-by: Caolán McNamara diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index 124ae16f2e20..7dd090929907 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -190,10 +190,6 @@ bool SalLayoutGlyphsImpl::isSafeToBreak(const_iterator pos, bool rtl) const if (pos == begin()) return true; --pos; -while (pos >= begin() && (pos->IsInCluster() && !pos->IsClusterStart())) ---pos; -if (pos < begin()) -return true; } // Don't create a subset if it's not safe to break at the beginning or end of the sequence // (https://harfbuzz.github.io/harfbuzz-hb-buffer.html#hb-glyph-flags-t).
[Libreoffice-commits] core.git: svtools/source
svtools/source/svrtf/parrtf.cxx | 35 +-- 1 file changed, 21 insertions(+), 14 deletions(-) New commits: commit c62a987ebce52f7e30afb1f6bce4c7bd3ac45644 Author: Luboš Luňák AuthorDate: Fri Aug 12 13:01:24 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Aug 12 15:34:39 2022 +0200 revert direct append to aToken in SvRTFParser::ScanText() (tdf#150151) This reverts most of commit 09558e2f45e27d572fd261562c884c2d2cc896a7, the problem is that GetNextToken_() resets aToken, overwriting the value created by this function. Change-Id: I1daca07a6e01cfecfeff9fbf7c311b0d392d84d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138190 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index 8f55ae448d44..42fcc211b264 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -302,9 +302,9 @@ sal_Unicode SvRTFParser::GetHexValue() void SvRTFParser::ScanText() { const sal_Unicode cBreak = 0; -const sal_uInt32 nStartLength = aToken.getLength(); +OUStringBuffer aStrBuffer; bool bContinue = true; -while( bContinue && IsParserWorking() && aToken.getLength() - nStartLength < MAX_STRING_LEN) +while( bContinue && IsParserWorking() && aStrBuffer.getLength() < MAX_STRING_LEN) { bool bNextCh = true; switch( nNextCh ) @@ -343,10 +343,10 @@ void SvRTFParser::ScanText() { if (!aByteString.isEmpty()) { -aToken.append( OStringToOUString(aByteString, GetSrcEncoding()) ); +aStrBuffer.append( OStringToOUString(aByteString, GetSrcEncoding()) ); aByteString.setLength(0); } - aToken.append(static_cast(next)); + aStrBuffer.append(static_cast(next)); continue; } @@ -387,7 +387,7 @@ void SvRTFParser::ScanText() if (!aByteString.isEmpty()) { -aToken.append( OStringToOUString(aByteString, GetSrcEncoding()) ); +aStrBuffer.append( OStringToOUString(aByteString, GetSrcEncoding()) ); aByteString.setLength(0); } } @@ -396,16 +396,16 @@ void SvRTFParser::ScanText() case '}': case '{': case '+': // I found in a RTF file -aToken.append(sal_Unicode(nNextCh)); +aStrBuffer.append(sal_Unicode(nNextCh)); break; case '~': // nonbreaking space -aToken.append(u'\x00A0'); +aStrBuffer.append(u'\x00A0'); break; case '-': // optional hyphen -aToken.append(u'\x00AD'); +aStrBuffer.append(u'\x00AD'); break; case '_': // nonbreaking hyphen -aToken.append(u'\x2011'); +aStrBuffer.append(u'\x2011'); break; case 'u': @@ -418,12 +418,12 @@ void SvRTFParser::ScanText() { bRTF_InTextRead = true; -OUString sSave( aToken ); +OUString sSave( aToken ); // GetNextToken_() overwrites this nNextCh = '\\'; int nToken = GetNextToken_(); DBG_ASSERT( RTF_U == nToken, "still not a UNI-Code character" ); // don't convert symbol chars -aToken.append(static_cast< sal_Unicode >(nTokenValue)); +aStrBuffer.append(static_cast< sal_Unicode >(nTokenValue)); // overread the next n "RTF" characters. This // can be also \{, \}, \'88 @@ -494,20 +494,24 @@ void SvRTFParser::ScanText() break; default: -if( nNextCh == cBreak || aToken.getLength() - nStartLength >= MAX_STRING_LEN) +if( nNextCh == cBreak || aStrBuffer.getLength() >= MAX_STRING_LEN) bContinue = false; else { do { // all other characters end up in the text -aToken.appendUtf32(nNextCh); +aStrBuffer.appendUtf32(nNextCh); if (sal_Unicode(EOF) == (nNextCh = GetNextChar())) +{ +
[Libreoffice-commits] core.git: vcl/source
vcl/source/gdi/impglyphitem.cxx |4 1 file changed, 4 deletions(-) New commits: commit 82553b46b689c0ff4c218a2a70918c3f4dafccfe Author: Luboš Luňák AuthorDate: Thu Aug 11 15:02:02 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Aug 12 12:13:32 2022 +0200 fix checking glyph break position (tdf#150138) Glyphs in RTL mode are in reverse, which includes the fast that a cluster start is last, not first. So going back requires means going back just one glyph, not a whole cluster. I'm not sure why I originally did it this way, tdf#148954 works fine even this way, so presumably I got confused. Change-Id: I6ed0caf4e64e93e0643f7b88099bc7c992ea3329 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138144 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index 94da485276ae..51bff5966d32 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -191,10 +191,6 @@ bool SalLayoutGlyphsImpl::isSafeToBreak(const_iterator pos, bool rtl) const if (pos == begin()) return true; --pos; -while (pos >= begin() && (pos->IsInCluster() && !pos->IsClusterStart())) ---pos; -if (pos < begin()) -return true; } // Don't create a subset if it's not safe to break at the beginning or end of the sequence // (https://harfbuzz.github.io/harfbuzz-hb-buffer.html#hb-glyph-flags-t).
[Libreoffice-commits] core.git: vcl/qa
vcl/qa/cppunit/complextext.cxx |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) New commits: commit d21a23cb03b54d423faf6c4a3d706cb9c749916d Author: Luboš Luňák AuthorDate: Tue Aug 9 12:46:06 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Aug 12 12:12:33 2022 +0200 use the same vcl::text::TextLayoutCache when comparing text layout Otherwise OutputDevice::ImplLayout() might use a temporary cache just for the subtext while SalLayoutGlyphsCache would use cache for the whole string, and those two might differ e.g. with an arabic string starting with numbers when the subset is just the numbers. Change-Id: Idea7ef277beae07e39e4a714088a7585361d13e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138143 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx index d6c624fa7406..9e96205946b1 100644 --- a/vcl/qa/cppunit/complextext.cxx +++ b/vcl/qa/cppunit/complextext.cxx @@ -226,8 +226,10 @@ static void testCachedGlyphsSubstring( const OUString& aText, const OUString& aF vcl::Font aFont( aFontName, Size(0, 12)); pOutputDevice->SetFont( aFont ); SalLayoutGlyphsCache::self()->clear(); +std::shared_ptr layoutCache = OutputDevice::CreateTextLayoutCache(aText); // Get the glyphs for the entire text once, to ensure the cache can built subsets from it. -pOutputDevice->ImplLayout( aText, 0, aText.getLength(), Point(0, 0), 0, {}, SalLayoutFlags::GlyphItemsOnly); +pOutputDevice->ImplLayout( aText, 0, aText.getLength(), Point(0, 0), 0, {}, SalLayoutFlags::GlyphItemsOnly, +layoutCache.get()); // Now check for all subsets. Some of them possibly do not make sense in practice, but the code // should cope with them. for( sal_Int32 len = 1; len <= aText.getLength(); ++len ) @@ -235,10 +237,10 @@ static void testCachedGlyphsSubstring( const OUString& aText, const OUString& aF { std::string message = prefix + " (" + std::to_string(pos) + "/" + std::to_string(len) + ")"; std::unique_ptr pLayout1 = pOutputDevice->ImplLayout( -aText, pos, len, Point(0, 0), 0, {}, SalLayoutFlags::GlyphItemsOnly); +aText, pos, len, Point(0, 0), 0, {}, SalLayoutFlags::GlyphItemsOnly, layoutCache.get()); SalLayoutGlyphs aGlyphs1 = pLayout1->GetGlyphs(); const SalLayoutGlyphs* aGlyphs2 = SalLayoutGlyphsCache::self()->GetLayoutGlyphs( -pOutputDevice, aText, pos, len, 0); +pOutputDevice, aText, pos, len, 0, layoutCache.get()); CPPUNIT_ASSERT_MESSAGE(message, aGlyphs2 != nullptr); checkCompareGlyphs(aGlyphs1, *aGlyphs2, message); }
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - officecfg/registry
officecfg/registry/data/org/openoffice/Office/Common.xcu |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 7db2df3d8f19cf4734ef359f238eb70e62b4be1d Author: Luboš Luňák AuthorDate: Tue Feb 1 14:55:39 2022 +0100 Commit: Christian Lohmaier CommitDate: Wed Jul 27 23:06:55 2022 +0200 disable Skia as default on Mac for 7.4 There are some problems like tdf#145843 and tdf#145988 that I cannot reproduce, yet a number of users apparently can. I can't fix those for 7.3, so default to the previous VCL backend again. Change-Id: I8c3e9713913a453c2b55a0ad9b1c8f82af8f7917 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129290 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos (cherry picked from commit 290957ad1383565c97201360defdeae9ae5ef502) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135708 Reviewed-by: Xisco Fauli Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index 4694135efce7..98e4d87f410c 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -51,7 +51,7 @@ - true + false false true
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/layout/layact.cxx | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) New commits: commit e61e77481174692d5be72962f6f029e6f4e2e8d9 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:31:17 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 26 11:58:11 2022 +0200 Revert "avoid repeated writer layout calls with tiled rendering" (tdf#145396) This was incorrect, the proper fix was my previous Writer commit. This reverts commit b9c2207e1b5247b4d3184b137be9a75a4b8c6c37. Change-Id: I829da1633dd11cb0c6e944fbf5acef030fad7dc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137294 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 9dff8edf97f454f24a40acbed4a9297816f91da6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137316 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index b2b246e5eb2f..9375ca13cd51 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2275,16 +2275,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) : { --rSh.mnStartAction; -// When using tiled rendering, idle painting is disabled and paints are done -// only later by tiled rendering. But paints call SwViewShellImp::DeletePaintRegion() -// to reset this HasPaintRegion(), and if it's done too late, -// SwTiledRenderingTest::testTablePaintInvalidate() will end up in an infinite -// loop, because the idle layout will call this code repeatedly, because there -// will be no idle paints to reset HasPaintRegion(). -// This code dates back to the initial commit, and I find its purpose unclear, -// so I'm still leaving it here in case it turns out it serves a purpose. -static const bool blockOnRepaints = true; -if (!blockOnRepaints && rSh.Imp()->HasPaintRegion()) +if ( rSh.Imp()->HasPaintRegion() ) bActions = true; else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source
sw/source/core/layout/layact.cxx | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) New commits: commit fc435d88f6d700aeb5e5f43f41ff659b98df0a95 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:31:17 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 26 11:57:08 2022 +0200 Revert "avoid repeated writer layout calls with tiled rendering" (tdf#145396) This was incorrect, the proper fix was my previous Writer commit. This reverts commit b9c2207e1b5247b4d3184b137be9a75a4b8c6c37. Change-Id: I829da1633dd11cb0c6e944fbf5acef030fad7dc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137294 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 9dff8edf97f454f24a40acbed4a9297816f91da6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137314 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 4a9ca92f52a2..6cdfcfce09ce 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2276,16 +2276,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) : { --rSh.mnStartAction; -// When using tiled rendering, idle painting is disabled and paints are done -// only later by tiled rendering. But paints call SwViewShellImp::DeletePaintRegion() -// to reset this HasPaintRegion(), and if it's done too late, -// SwTiledRenderingTest::testTablePaintInvalidate() will end up in an infinite -// loop, because the idle layout will call this code repeatedly, because there -// will be no idle paints to reset HasPaintRegion(). -// This code dates back to the initial commit, and I find its purpose unclear, -// so I'm still leaving it here in case it turns out it serves a purpose. -static const bool blockOnRepaints = true; -if (!blockOnRepaints && rSh.Imp()->HasPaintRegion()) +if ( rSh.Imp()->HasPaintRegion() ) bActions = true; else {
[Libreoffice-commits] core.git: Branch 'libreoffice-7-3' - sw/source
sw/source/core/view/viewsh.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit bb5643c1318de5b1ee0adcfbe8c4c4115a175ac1 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:27:45 2022 +0200 Commit: Xisco Fauli CommitDate: Tue Jul 26 11:55:51 2022 +0200 Revert "do not draw directly in SwViewShell in LOK mode" It is actually needed to process SwViewShellImp's paint region, as otherwise testTablePaintInvalidate::TestBody from CppunitTest_sw_tiledrendering will end up in an infinite loop repeatedly calling SwLayIdle ctor. That's what I tried to handle in b9c2207e1b5247b4d3184b137be9a75a4b8c6c37 and got it wrong. This reverts commit 2aa2d03ec4e775d9399420c21cd1f2e972984154. Change-Id: I25e897ea4e38db48cd969a3c21d677701f75a0aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137293 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 94bde29634c095e40bfcf74d27821b48919595da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137315 Reviewed-by: Xisco Fauli diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index b16b2d042727..7c4b55729ca7 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -478,7 +478,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) CurrShell aCurr( this ); if ( GetWin() && GetWin()->IsVisible() ) { -if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && !comphelper::LibreOfficeKit::isActive()) +if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) { //Refresh with virtual device to avoid flickering. VclPtrInstance pVout( *mpOut );
[Libreoffice-commits] core.git: configure.ac
configure.ac |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 8a97da679bbccf81e73dc5d2e864b5f40adfc0eb Author: Luboš Luňák AuthorDate: Thu Jul 21 17:01:38 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Jul 22 19:17:30 2022 +0200 fix clang-cl check on WSL Change-Id: Id357ee8e27eb3e8b6f5f076350c43bb75e7d0683 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137348 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/configure.ac b/configure.ac index f81492852b8c..33dc0fb96316 100644 --- a/configure.ac +++ b/configure.ac @@ -12193,9 +12193,9 @@ if test "$ENABLE_SKIA" = TRUE -a "$COM_IS_CLANG" != TRUE; then AC_MSG_CHECKING([for clang-cl]) if test -x "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"; then LO_CLANG_CC=`win_short_path_for_make "$VC_PRODUCT_DIR/Tools/Llvm/bin/clang-cl.exe"` -elif test -n "$PROGRAMFILES" -a -x "$PROGRAMFILES/LLVM/bin/clang-cl.exe"; then +elif test -n "$PROGRAMFILES" -a -x "$(cygpath -u "$PROGRAMFILES/LLVM/bin/clang-cl.exe")"; then LO_CLANG_CC=`win_short_path_for_make "$PROGRAMFILES/LLVM/bin/clang-cl.exe"` -elif test -x "c:/Program Files/LLVM/bin/clang-cl.exe"; then +elif test -x "$(cygpath -u "c:/Program Files/LLVM/bin/clang-cl.exe")"; then LO_CLANG_CC=`win_short_path_for_make "c:/Program Files/LLVM/bin/clang-cl.exe"` fi if test -n "$LO_CLANG_CC"; then
[Libreoffice-commits] core.git: 2 commits - configure.ac
configure.ac | 112 +-- 1 file changed, 78 insertions(+), 34 deletions(-) New commits: commit f6882d91ad8d2219aa6fdc1583507910ee103e2b Author: Luboš Luňák AuthorDate: Thu Jul 21 16:53:32 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Jul 22 19:16:59 2022 +0200 fix configure handling of tarball path on WSL Change-Id: Ie33eb8e256a38c5120fdd713b3fc34160a8728b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137347 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/configure.ac b/configure.ac index 3b96ba195226..f81492852b8c 100644 --- a/configure.ac +++ b/configure.ac @@ -190,7 +190,9 @@ AbsolutePath() # Args: $1: A possibly relative pathname # Return value: $absolute_path -local rel="$1" +# Convert to unix path, mkdir would treat c:/path as a relative path. +PathFormat "$1" +local rel="$formatted_path_unix" absolute_path="" test ! -e "$rel" && mkdir -p "$rel" if test -d "$rel" ; then @@ -6081,7 +6083,7 @@ if test -z "$TARFILE_LOCATION"; then else AbsolutePath "$TARFILE_LOCATION" PathFormat "${absolute_path}" -TARFILE_LOCATION="${formatted_path}" +TARFILE_LOCATION="${formatted_path_unix}" fi AC_SUBST(TARFILE_LOCATION) commit c93e40ea0be17b586c30fc3b53c5f8193f26cd79 Author: Luboš Luňák AuthorDate: Thu Jul 21 16:31:03 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Jul 22 19:16:45 2022 +0200 configure fixes for WSL - Enabling some Cygwin checks also for WSL. - Handling of Windows paths as needed for WSL. - Reading of registry using wsl-lo-helper as WSL doesn't provide registry in /proc the way Cygwin does. Configure now passes for me (with Skia and Java disabled). Change-Id: I325c4e6f9f825b3b6d0aa6cb350bafabc4011ce5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137346 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/configure.ac b/configure.ac index 67493ea442e7..3b96ba195226 100644 --- a/configure.ac +++ b/configure.ac @@ -3849,6 +3849,31 @@ reg_get_value_64() reg_get_value "64" "$1" } +reg_list_values() +{ +# Return value: $reglist +unset reglist + +if test "$build_os" = "wsl"; then +reglist=$($WSL_LO_HELPER --list-registry $1 "$2" 2>/dev/null | tr -d '\r') +return +fi + +reglist=$(ls "/proc/registry${1}/${2}") +} + +# List values from the 32-bit side of the Registry +reg_list_values_32() +{ +reg_list_values "32" "$1" +} + +# List values from the 64-bit side of the Registry +reg_list_values_64() +{ +reg_list_values "64" "$1" +} + case "$host_os" in cygwin*|wsl*) COM=MSC @@ -6510,15 +6535,18 @@ find_al() # We need this check to detect 4.6.1 or above. for ver in 4.8 4.7.2 4.7.1 4.7 4.6.2 4.6.1; do reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/NETFXSDK/$ver/WinSDK-NetFx40Tools/InstallationFolder" -if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then +PathFormat "$regvalue" +if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then altest=$regvalue return fi done -for x in `ls /proc/registry32/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft\ SDKs/Windows`; do +reg_list_values_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows" +for x in $reglist; do reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/$x/WinSDK-NetFx40Tools/InstallationFolder" -if test -n "$regvalue" -a \( -f "$regvalue/al.exe" -o -f "$regvalue/bin/al.exe" \); then +PathFormat "$regvalue" +if test -n "$regvalue" -a \( -f "$formatted_path_unix/al.exe" -o -f "$formatted_path_unix/bin/al.exe" \); then altest=$regvalue return fi @@ -6804,26 +6832,30 @@ AC_SUBST(WINDOWS_SDK_LIB_SUBDIR) AC_SUBST(WINDOWS_SDK_VERSION) AC_SUBST(WINDOWS_SDK_WILANGID) -if test "$build_os" = "cygwin"; then +if test "$build_os" = "cygwin" -o "$build_os" = "wsl"; then dnl Check midl.exe; this being the first check for a tool in the SDK bin dnl dir, it also determines that dir's path w/o an arch segment if any, dnl WINDOWS_SDK_BINDIR_NO_ARCH: AC_MSG_CHECKING([for midl.exe]) find_winsdk +PathFormat "$winsdktest" +winsdktest_unix="$formatted_path_unix" + if test -n "$winsdkbinsubdir" \ --a -f "$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe" +-a -f "$winsdktest_unix/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH/midl.exe" then MIDL_PATH=$winsdktest/Bin/$winsdkbinsubdir/$WIN_BUILD_ARCH -WINDOWS_SDK_BINDIR_NO_ARCH=$WINDOWS_SDK_HOME/Bin/$winsdkbinsubdir -elif test -f "$winsdktest/Bin/$WIN_BUILD_ARCH/midl.exe"; then +
[Libreoffice-commits] core.git: 2 commits - configure.ac solenv/wsl
configure.ac | 20 +--- solenv/wsl/README|8 solenv/wsl/wsl-lo-helper.cpp |8 3 files changed, 25 insertions(+), 11 deletions(-) New commits: commit 981ba02267af461792c3ff30b8fecc5cd73497a3 Author: Luboš Luňák AuthorDate: Thu Jul 21 15:59:50 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Jul 22 19:16:29 2022 +0200 add fallback for $PROGRAMFILESX86 It's not set in my WSL, but since it's going to be c:\program files (x86) in the vast majority of cases, just hardcode a fallback. Change-Id: I3bf41d6bae0e5bb36c53f0a4cf913a980a058fcf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137345 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/configure.ac b/configure.ac index eca0ab405c85..67493ea442e7 100644 --- a/configure.ac +++ b/configure.ac @@ -4052,6 +4052,9 @@ find_msvc() vs_versions_to_check "$1" if test "$build_os" = wsl; then vswhere="$PROGRAMFILESX86" +if test -z "$vswhere"; then +vswhere="c:\\Program Files (x86)" +fi else vswhere="$(perl -e 'print $ENV{"ProgramFiles(x86)"}')" fi commit 4fbcededefa07a97aa9ca55986241a0dd0146806 Author: Luboš Luňák AuthorDate: Thu Jul 21 15:57:53 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Jul 22 19:16:16 2022 +0200 require wsl-lo-helper to be preinstalled, like 'make' It is needed to even find MSVC, so configure cannot easily build it. Change-Id: Ie4e950cf01b9d8778cdc3e9a53718954b0c3c166 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137344 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/configure.ac b/configure.ac index 2bf56df211d9..eca0ab405c85 100644 --- a/configure.ac +++ b/configure.ac @@ -119,7 +119,7 @@ PathFormat() formatted_path=$(wslpath -w "$formatted_path") ;; esac -formatted_path=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$formatted_path") +formatted_path=$($WSL_LO_HELPER --8.3 "$formatted_path") elif test "$GNUMAKE_WIN_NATIVE" = "TRUE" ; then formatted_path=`cygpath -sm "$formatted_path"` else @@ -355,7 +355,7 @@ if test -z "$host" -a -z "$build" -a "$(uname -r | grep -i Microsoft 2>/dev/null ;; esac if test -n "$opt_d" -o -n "$opt_s"; then -input=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --8.3 "$input") +input=$($WSL_LO_HELPER --8.3 "$input") fi if test -n "$opt_m"; then input="${input//\\//}" @@ -399,6 +399,17 @@ if test -z "$host" -a -z "$build" -a "$(uname -r | grep -i Microsoft 2>/dev/null exit 0 fi + +if test -z "$WSL_LO_HELPER"; then +if test -n "$LODE_HOME" -a -x "$LODE_HOME/opt/bin/wsl-lo-helper" ; then +WSL_LO_HELPER="$LODE_HOME/opt/bin/wsl-lo-helper" +elif test -x "/opt/lo/bin/wsl-lo-helper"; then +WSL_LO_HELPER="/opt/lo/bin/wsl-lo-helper" +fi +fi +if test -z "$WSL_LO_HELPER"; then +AC_MSG_ERROR([wsl-lo-helper not found. See solenv/wsl/README.]) +fi fi AC_CANONICAL_HOST @@ -3811,7 +3822,7 @@ reg_get_value() unset regvalue if test "$build_os" = "wsl"; then -regvalue=$($BUILDDIR/solenv/wsl/wsl-lo-helper.exe --read-registry $1 "$2" 2>/dev/null) +regvalue=$($WSL_LO_HELPER --read-registry $1 "$2" 2>/dev/null) return fi diff --git a/solenv/wsl/README b/solenv/wsl/README new file mode 100644 index ..a9609f08dce9 --- /dev/null +++ b/solenv/wsl/README @@ -0,0 +1,8 @@ +This is a tool that will be useful for various tasks when building LO on WSL. + +It is a Win32 program, not a Linux (WSL) one. + +Compile using the Developer Command Prompt from MSVC as: +cl wsl-lo-helper.cpp advapi32.lib +and the copy the executable to /opt/lo/bin (e.g. from shell as): +sudo mv wsl-lo-helper.exe /opt/lo/bin/wsl-lo-helper diff --git a/solenv/wsl/wsl-lo-helper.cpp b/solenv/wsl/wsl-lo-helper.cpp index 1a90580b6f19..87285dcb1d3c 100644 --- a/solenv/wsl/wsl-lo-helper.cpp +++ b/solenv/wsl/wsl-lo-helper.cpp @@ -7,14 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* - * This is a tool that will be useful for various tasks if/when we build LO on WSL - * - * It is a Win32 program, not a Linux (WSL) one. - * - * Compile as: cl -MD wsl-lo-helper.cpp advapi32.lib - */ - #include #include
[Libreoffice-commits] core.git: configure.ac
configure.ac |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 5a8a1c4a86938b65c5ea7807f60e721946d7d8de Author: Luboš Luňák AuthorDate: Thu Jul 21 14:55:28 2022 +0200 Commit: Luboš Luňák CommitDate: Fri Jul 22 19:15:53 2022 +0200 use uname for detecting WSL There's no wslsys in my WSL setup. I also don't see why WSL should be at least version 2, they both should(?) work and it is recommended to use version 1 with NTFS (and version 2 also doesn't work e.g. inside VirtualBox). Change-Id: I5b9440f65624f49e331d84235046e4dd2e31af4e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137343 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/configure.ac b/configure.ac index 6b7070c78d87..2bf56df211d9 100644 --- a/configure.ac +++ b/configure.ac @@ -288,9 +288,9 @@ dnl checks build and host OSes dnl do this before argument processing to allow for platform dependent defaults dnl === -# Check for WSL (version 2, at least). But if --host is explicitly specified (to really do build for +# Check for WSL. But if --host is explicitly specified (to really do build for # Linux on WSL) trust that. -if test -z "$host" -a -z "$build" -a "`wslsys -v 2>/dev/null`" != ""; then +if test -z "$host" -a -z "$build" -a "$(uname -r | grep -i Microsoft 2>/dev/null)" != ""; then ac_cv_host="x86_64-pc-wsl" ac_cv_host_cpu="x86_64" ac_cv_host_os="wsl"
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source
sw/source/core/layout/layact.cxx | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) New commits: commit 4d1135553d47d627cfc63761818e00d9042f9e18 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:31:17 2022 +0200 Commit: Miklos Vajna CommitDate: Fri Jul 22 14:31:56 2022 +0200 Revert "avoid repeated writer layout calls with tiled rendering" (tdf#145396) This was incorrect, the proper fix was my previous Writer commit. This reverts commit b9c2207e1b5247b4d3184b137be9a75a4b8c6c37. Change-Id: I829da1633dd11cb0c6e944fbf5acef030fad7dc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137294 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 9dff8edf97f454f24a40acbed4a9297816f91da6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137318 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index b2b246e5eb2f..9375ca13cd51 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2275,16 +2275,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) : { --rSh.mnStartAction; -// When using tiled rendering, idle painting is disabled and paints are done -// only later by tiled rendering. But paints call SwViewShellImp::DeletePaintRegion() -// to reset this HasPaintRegion(), and if it's done too late, -// SwTiledRenderingTest::testTablePaintInvalidate() will end up in an infinite -// loop, because the idle layout will call this code repeatedly, because there -// will be no idle paints to reset HasPaintRegion(). -// This code dates back to the initial commit, and I find its purpose unclear, -// so I'm still leaving it here in case it turns out it serves a purpose. -static const bool blockOnRepaints = true; -if (!blockOnRepaints && rSh.Imp()->HasPaintRegion()) +if ( rSh.Imp()->HasPaintRegion() ) bActions = true; else {
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-22.05' - sw/source
sw/source/core/view/viewsh.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 50788a6e27e02fdb49f4e43a82b041e6a2a628db Author: Luboš Luňák AuthorDate: Thu Jul 21 13:27:45 2022 +0200 Commit: Miklos Vajna CommitDate: Fri Jul 22 14:31:32 2022 +0200 Revert "do not draw directly in SwViewShell in LOK mode" It is actually needed to process SwViewShellImp's paint region, as otherwise testTablePaintInvalidate::TestBody from CppunitTest_sw_tiledrendering will end up in an infinite loop repeatedly calling SwLayIdle ctor. That's what I tried to handle in b9c2207e1b5247b4d3184b137be9a75a4b8c6c37 and got it wrong. This reverts commit 2aa2d03ec4e775d9399420c21cd1f2e972984154. Change-Id: I25e897ea4e38db48cd969a3c21d677701f75a0aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137293 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 94bde29634c095e40bfcf74d27821b48919595da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137317 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index b16b2d042727..7c4b55729ca7 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -478,7 +478,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) CurrShell aCurr( this ); if ( GetWin() && GetWin()->IsVisible() ) { -if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && !comphelper::LibreOfficeKit::isActive()) +if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) { //Refresh with virtual device to avoid flickering. VclPtrInstance pVout( *mpOut );
[Libreoffice-commits] core.git: Branch 'libreoffice-7-4' - sw/source
sw/source/core/view/viewsh.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c5e2611cff9ab0e436b66c39330c8d994e746cb0 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:27:45 2022 +0200 Commit: Caolán McNamara CommitDate: Fri Jul 22 12:45:28 2022 +0200 Revert "do not draw directly in SwViewShell in LOK mode" It is actually needed to process SwViewShellImp's paint region, as otherwise testTablePaintInvalidate::TestBody from CppunitTest_sw_tiledrendering will end up in an infinite loop repeatedly calling SwLayIdle ctor. That's what I tried to handle in b9c2207e1b5247b4d3184b137be9a75a4b8c6c37 and got it wrong. This reverts commit 2aa2d03ec4e775d9399420c21cd1f2e972984154. Change-Id: I25e897ea4e38db48cd969a3c21d677701f75a0aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137293 Tested-by: Jenkins Reviewed-by: Luboš Luňák (cherry picked from commit 94bde29634c095e40bfcf74d27821b48919595da) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137193 Reviewed-by: Caolán McNamara diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 3358043a2b8d..057b69878e10 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -485,7 +485,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) CurrShell aCurr( this ); if ( GetWin() && GetWin()->IsVisible() ) { -if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && !comphelper::LibreOfficeKit::isActive()) +if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) { //Refresh with virtual device to avoid flickering. VclPtrInstance pVout( *mpOut );
[Libreoffice-commits] core.git: sw/source
sw/source/core/layout/layact.cxx | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) New commits: commit 9dff8edf97f454f24a40acbed4a9297816f91da6 Author: Luboš Luňák AuthorDate: Thu Jul 21 13:31:17 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Jul 21 16:46:21 2022 +0200 Revert "avoid repeated writer layout calls with tiled rendering" (tdf#145396) This was incorrect, the proper fix was my previous Writer commit. This reverts commit b9c2207e1b5247b4d3184b137be9a75a4b8c6c37. Change-Id: I829da1633dd11cb0c6e944fbf5acef030fad7dc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137294 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 4a9ca92f52a2..6cdfcfce09ce 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -2276,16 +2276,7 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) : { --rSh.mnStartAction; -// When using tiled rendering, idle painting is disabled and paints are done -// only later by tiled rendering. But paints call SwViewShellImp::DeletePaintRegion() -// to reset this HasPaintRegion(), and if it's done too late, -// SwTiledRenderingTest::testTablePaintInvalidate() will end up in an infinite -// loop, because the idle layout will call this code repeatedly, because there -// will be no idle paints to reset HasPaintRegion(). -// This code dates back to the initial commit, and I find its purpose unclear, -// so I'm still leaving it here in case it turns out it serves a purpose. -static const bool blockOnRepaints = true; -if (!blockOnRepaints && rSh.Imp()->HasPaintRegion()) +if ( rSh.Imp()->HasPaintRegion() ) bActions = true; else {
[Libreoffice-commits] core.git: sw/source
sw/source/core/view/viewsh.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 94bde29634c095e40bfcf74d27821b48919595da Author: Luboš Luňák AuthorDate: Thu Jul 21 13:27:45 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Jul 21 16:45:51 2022 +0200 Revert "do not draw directly in SwViewShell in LOK mode" It is actually needed to process SwViewShellImp's paint region, as otherwise testTablePaintInvalidate::TestBody from CppunitTest_sw_tiledrendering will end up in an infinite loop repeatedly calling SwLayIdle ctor. That's what I tried to handle in b9c2207e1b5247b4d3184b137be9a75a4b8c6c37 and got it wrong. This reverts commit 2aa2d03ec4e775d9399420c21cd1f2e972984154. Change-Id: I25e897ea4e38db48cd969a3c21d677701f75a0aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137293 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 3358043a2b8d..057b69878e10 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -485,7 +485,7 @@ void SwViewShell::ImplUnlockPaint( bool bVirDev ) CurrShell aCurr( this ); if ( GetWin() && GetWin()->IsVisible() ) { -if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() && !comphelper::LibreOfficeKit::isActive()) +if ( (bInSizeNotify || bVirDev ) && VisArea().HasArea() ) { //Refresh with virtual device to avoid flickering. VclPtrInstance pVout( *mpOut );
[Libreoffice-commits] core.git: include/vcl
include/vcl/lazydelete.hxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit c069dc225897b774ce3e09fbcd45a7d35297a8a9 Author: Luboš Luňák AuthorDate: Wed Jul 13 20:30:55 2022 +0200 Commit: Luboš Luňák CommitDate: Thu Jul 14 09:23:17 2022 +0200 fix vcl::DeleteOnDeinit example in its docs The ctor does not take 'new T', now it takes arguments that are passed to T ctor. Change-Id: I04b330d98dd84c86e00ec937a00d1097f21c55c5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137039 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/include/vcl/lazydelete.hxx b/include/vcl/lazydelete.hxx index 290a2ad2acd2..e700582f1297 100644 --- a/include/vcl/lazydelete.hxx +++ b/include/vcl/lazydelete.hxx @@ -47,7 +47,7 @@ namespace vcl SomeWindow::Paint() { -static vcl::DeleteOnDeinit< BitmapEx > aBmp( new BitmapEx( ... ) ); +static vcl::DeleteOnDeinit< BitmapEx > aBmp( ... ); if( aBmp.get() ) // check whether DeInitVCL has been called already DrawBitmapEx( Point( 10, 10 ), *aBmp );
[Libreoffice-commits] core.git: vcl/skia
vcl/skia/SkiaHelper.cxx | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) New commits: commit 6c58b01c791ec4939523147d5d075611bbbfe314 Author: Luboš Luňák AuthorDate: Wed Jul 13 12:54:20 2022 +0200 Commit: Luboš Luňák CommitDate: Wed Jul 13 16:23:26 2022 +0200 move Skia setup code to a shared function Change-Id: Ifcd434512854b5fedb0baf4ce1251a05f659b006 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137017 Tested-by: Jenkins Reviewed-by: Luboš Luňák diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx index 84c40baffae4..f4346b74f73a 100644 --- a/vcl/skia/SkiaHelper.cxx +++ b/vcl/skia/SkiaHelper.cxx @@ -273,6 +273,8 @@ static bool supportsVCLSkia() return getenv("SAL_DISABLESKIA") == nullptr; } +static void initInternal(); + bool isVCLSkiaEnabled() { /** @@ -308,8 +310,7 @@ bool isVCLSkiaEnabled() if (bForceSkia && bSupportsVCLSkia) { bRet = true; -SkGraphics::Init(); -SkLoOpts::Init(); +initInternal(); // don't actually block if denylisted, but log it if enabled, and also get the vendor id checkDeviceDenylisted(true); } @@ -334,8 +335,7 @@ bool isVCLSkiaEnabled() if (bEnable) { -SkGraphics::Init(); -SkLoOpts::Init(); +initInternal(); checkDeviceDenylisted(); // switch to raster if driver is denylisted } @@ -754,6 +754,13 @@ void setBlenderXor(SkPaint* paint) paint->setBlender(xorBlender); } +static void initInternal() +{ +// Set up all things needed for using Skia. +SkGraphics::Init(); +SkLoOpts::Init(); +} + void cleanup() { sharedWindowContext.reset();