core.git: canvas/inc canvas/source cui/inc cui/source drawinglayer/source include/vcl oox/source sd/source svgio/source svx/inc svx/source vcl/inc vcl/qa vcl/source vcl/unx vcl/workben

2024-10-21 Thread Chris Sherlock (via logerrit)
/BitmapSeparableUnsharpenFilter.cxx|6 -
 vcl/source/bitmap/BitmapSepiaFilter.cxx |4 
 vcl/source/bitmap/BitmapShadowFilter.cxx|3 
 vcl/source/bitmap/BitmapSimpleColorQuantizationFilter.cxx   |4 
 vcl/source/bitmap/BitmapSmoothenFilter.cxx  |7 -
 vcl/source/bitmap/BitmapSobelGreyFilter.cxx |4 
 vcl/source/bitmap/BitmapSolarizeFilter.cxx  |4 
 vcl/source/bitmap/bitmap.cxx|2 
 vcl/source/bitmap/bitmapfilter.cxx  |6 -
 vcl/source/graphic/UnoGraphic.cxx   |2 
 vcl/source/image/ImplImage.cxx  |   10 +-
 vcl/source/rendercontext/drawmode.cxx   |2 
 vcl/unx/generic/dtrans/bmp.cxx  |2 
 vcl/workben/vcldemo.cxx |2 
 85 files changed, 217 insertions(+), 315 deletions(-)

New commits:
commit bc2ff9daf5d20bc9b8f260ffc59e820a1aa08772
Author: Chris Sherlock 
AuthorDate: Sun Sep 15 00:02:10 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 21 09:45:21 2024 +0200

vcl: move bitmap filter headers into vcl/bitmap global header directory

Use #pragma once instead of header guards

Change-Id: Iba43f2103628ed184933cf2611991e7aef9f0173
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173369
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins

diff --git a/canvas/inc/pch/precompiled_vclcanvas.hxx 
b/canvas/inc/pch/precompiled_vclcanvas.hxx
index 03c547f2c7b3..d16ad18f0a3e 100644
--- a/canvas/inc/pch/precompiled_vclcanvas.hxx
+++ b/canvas/inc/pch/precompiled_vclcanvas.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2021-03-08 13:11:36 using:
+ Generated on 2024-10-12 02:56:17 using:
  ./bin/update_pch canvas vclcanvas --cutoff=1 --exclude:system 
--include:module --include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -25,22 +25,22 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #endif // PCH_LEVEL >= 1
 #if PCH_LEVEL >= 2
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -76,12 +76,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #endif // PCH_LEVEL >= 3
diff --git a/canvas/source/vcl/canvashelper.cxx 
b/canvas/source/vcl/canvashelper.cxx
index 26c730b851bd..db19111f349c 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -40,7 +40,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
diff --git a/cui/inc/pch/precompiled_cui.hxx b/cui/inc/pch/precompiled_cui.hxx
index 2ff025d34f49..e007aea1cfa3 100644
--- a/cui/inc/pch/precompiled_cui.hxx
+++ b/cui/inc/pch/precompiled_cui.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2023-07-19 09:21:23 using:
+ Generated on 2024-09-15 00:24:27 using:
  ./bin/update_pch cui cui --cutoff=8 --exclude:system --include:module 
--exclude:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -24,9 +24,11 @@
 #if PCH_LEVEL >= 1
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -54,7 +56,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -98,7 +99,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -109,6 +109,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -116,6 +117,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -144,12 +146,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -167,7 +171,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -184,6 +187,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -195,6 +199,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -217,7 +222,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -226,13 +230,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -285,7 +286,6 @@
 #include 
 #include 
 #include 
-#include

core.git: vcl/source

2024-10-07 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx |  225 +
 1 file changed, 100 insertions(+), 125 deletions(-)

New commits:
commit 43de008d7871848c10a9d618aec8f817bb40f082
Author: Chris Sherlock 
AuthorDate: Mon Sep 2 01:33:02 2024 +1000
Commit: Michael Weghorn 
CommitDate: Mon Oct 7 11:18:04 2024 +0200

vcl: use correct var prefixes in BitmapScaleConvolutionFilter

Change-Id: Idca191a21ef63a707d9c5230dad8c97552757c06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173206
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx 
b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
index ae6398386f85..19bd391ad9c5 100644
--- a/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
+++ b/vcl/source/bitmap/BitmapScaleConvolutionFilter.cxx
@@ -32,150 +32,129 @@ namespace vcl
 namespace
 {
 
-void ImplCalculateContributions(
-const sal_Int32 aSourceSize,
-const sal_Int32 aDestinationSize,
-sal_Int32& aNumberOfContributions,
-std::vector& rWeights,
-std::vector& rPixels,
-std::vector& rCounts,
-const Kernel& aKernel)
+void ImplCalculateContributions(const sal_Int32 nSoureSize, const sal_Int32 
nDestinationSize,
+sal_Int32& rNumberOfContributions, 
std::vector& rWeights,
+std::vector& rPixels, 
std::vector& rCounts,
+const Kernel& rKernel)
 {
-const double fSamplingRadius(aKernel.GetWidth());
-const double fScale(aDestinationSize / static_cast< double >(aSourceSize));
+const double fSamplingRadius(rKernel.GetWidth());
+const double fScale(nDestinationSize / static_cast< double >(nSoureSize));
 const double fScaledRadius((fScale < 1.0) ? fSamplingRadius / fScale : 
fSamplingRadius);
 const double fFilterFactor(std::min(fScale, 1.0));
 
-aNumberOfContributions = (sal_Int32(fabs(ceil(fScaledRadius))) * 2) + 1;
-const sal_Int32 nAllocSize(aDestinationSize * aNumberOfContributions);
+rNumberOfContributions = (sal_Int32(fabs(ceil(fScaledRadius))) * 2) + 1;
+const sal_Int32 nAllocSize(nDestinationSize * rNumberOfContributions);
 rWeights.resize(nAllocSize);
 rPixels.resize(nAllocSize);
-rCounts.resize(aDestinationSize);
+rCounts.resize(nDestinationSize);
 
-for(sal_Int32 i(0); i < aDestinationSize; i++)
+for(sal_Int32 i(0); i < nDestinationSize; i++)
 {
-const sal_Int32 aIndex(i * aNumberOfContributions);
+const sal_Int32 nIndexes(i * rNumberOfContributions);
 const double aCenter(i / fScale);
-const sal_Int32 aLeft(static_cast< sal_Int32 >(floor(aCenter - 
fScaledRadius)));
-const sal_Int32 aRight(static_cast< sal_Int32 >(ceil(aCenter + 
fScaledRadius)));
-sal_Int32 aCurrentCount(0);
+const sal_Int32 nLeft(static_cast< sal_Int32 >(floor(aCenter - 
fScaledRadius)));
+const sal_Int32 nRight(static_cast< sal_Int32 >(ceil(aCenter + 
fScaledRadius)));
+sal_Int32 nCurrentCount(0);
 
-for(sal_Int32 j(aLeft); j <= aRight; j++)
+for(sal_Int32 j(nLeft); j <= nRight; j++)
 {
-const double aWeight(aKernel.Calculate(fFilterFactor * (aCenter - 
static_cast< double>(j;
+const double fWeight(rKernel.Calculate(fFilterFactor * (aCenter - 
static_cast< double>(j;
 
 // Reduce calculations with ignoring weights of 0.0
-if(fabs(aWeight) < 0.0001)
-{
+if(fabs(fWeight) < 0.0001)
 continue;
-}
 
 // Handling on edges
-const sal_Int32 aPixelIndex(std::clamp(j, sal_Int32(0), 
aSourceSize - 1));
-const sal_Int32 nIndex(aIndex + aCurrentCount);
+const sal_Int32 nPixelIndex(std::clamp(j, sal_Int32(0), nSoureSize 
- 1));
+const sal_Int32 nIndex(nIndexes + nCurrentCount);
 
 // scale the weight by 255 since we're converting from float to int
-rWeights[nIndex] = aWeight * 255;
-rPixels[nIndex] = aPixelIndex;
+rWeights[nIndex] = fWeight * 255;
+rPixels[nIndex] = nPixelIndex;
 
-aCurrentCount++;
+nCurrentCount++;
 }
 
-rCounts[i] = aCurrentCount;
+rCounts[i] = nCurrentCount;
 }
 }
 
-bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& 
rScaleX, const Kernel& aKernel)
+bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& 
rScaleX, const Kernel& rKernel)
 {
 // Do horizontal filtering
 OSL_ENSURE(rScaleX > 0.0, "Error in scaling: Mirror given in 
non-mirror-capable method (!)");
 const sal_Int32 nWidth(rSource.GetSizePixel().Width());
 const sal_Int32 nNewWidth(basegfx::fro

core.git: vcl/source

2024-09-29 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapReadAccess.cxx |  168 +++--
 1 file changed, 77 insertions(+), 91 deletions(-)

New commits:
commit e5aff0ed177e218bfec7c9f57f393379c051166a
Author: Chris Sherlock 
AuthorDate: Mon Sep 2 01:15:35 2024 +1000
Commit: Michael Weghorn 
CommitDate: Mon Sep 30 08:38:29 2024 +0200

vcl: flatten BitmapReadAccess functions

Change-Id: Ib18aeca38270192364a12b6496223b0cce476b16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173205
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/bitmap/BitmapReadAccess.cxx 
b/vcl/source/bitmap/BitmapReadAccess.cxx
index f8240a733548..9a7c8082ed2d 100644
--- a/vcl/source/bitmap/BitmapReadAccess.cxx
+++ b/vcl/source/bitmap/BitmapReadAccess.cxx
@@ -142,90 +142,78 @@ BitmapColor 
BitmapReadAccess::GetInterpolatedColorWithFallback(double fY, double
 {
 // ask directly doubles >= 0.0 here to avoid rounded values of 0 at small 
negative
 // double values, e.g. static_cast< sal_Int32 >(-0.25) is 0, not -1, but 
*has* to be outside (!)
-if (mpBuffer && fX >= 0.0 && fY >= 0.0)
+if (!mpBuffer || fX < 0.0 || fY < 0.0)
+return rFallback;
+
+const sal_Int64 nX(static_cast(fX));
+const sal_Int64 nY(static_cast(fY));
+
+if (nX >= mpBuffer->mnWidth || nY >= mpBuffer->mnHeight)
+return rFallback;
+
+// get base-return value from inside pixel
+BitmapColor aRetval(GetColor(nY, nX));
+
+// calculate deltas and indices for neighbour accesses
+sal_Int16 nDeltaX((fX - (nX + 0.5)) * 255.0); // [-255 .. 255]
+sal_Int16 nDeltaY((fY - (nY + 0.5)) * 255.0); // [-255 .. 255]
+sal_Int16 nIndX(0);
+sal_Int16 nIndY(0);
+
+if (nDeltaX > 0)
 {
-const sal_Int64 nX(static_cast(fX));
-const sal_Int64 nY(static_cast(fY));
-
-if (nX < mpBuffer->mnWidth && nY < mpBuffer->mnHeight)
-{
-// get base-return value from inside pixel
-BitmapColor aRetval(GetColor(nY, nX));
-
-// calculate deltas and indices for neighbour accesses
-sal_Int16 nDeltaX((fX - (nX + 0.5)) * 255.0); // [-255 .. 255]
-sal_Int16 nDeltaY((fY - (nY + 0.5)) * 255.0); // [-255 .. 255]
-sal_Int16 nIndX(0);
-sal_Int16 nIndY(0);
-
-if (nDeltaX > 0)
-{
-nIndX = nX + 1;
-}
-else
-{
-nIndX = nX - 1;
-nDeltaX = -nDeltaX;
-}
-
-if (nDeltaY > 0)
-{
-nIndY = nY + 1;
-}
-else
-{
-nIndY = nY - 1;
-nDeltaY = -nDeltaY;
-}
-
-// get right/left neighbour
-BitmapColor aXCol(rFallback);
-
-if (nDeltaX && nIndX >= 0 && nIndX < mpBuffer->mnWidth)
-{
-aXCol = GetColor(nY, nIndX);
-}
-
-// get top/bottom neighbour
-BitmapColor aYCol(rFallback);
-
-if (nDeltaY && nIndY >= 0 && nIndY < mpBuffer->mnHeight)
-{
-aYCol = GetColor(nIndY, nX);
-}
-
-// get one of four edge neighbours
-BitmapColor aXYCol(rFallback);
-
-if (nDeltaX && nDeltaY && nIndX >= 0 && nIndY >= 0 && nIndX < 
mpBuffer->mnWidth
-&& nIndY < mpBuffer->mnHeight)
-{
-aXYCol = GetColor(nIndY, nIndX);
-}
-
-// merge return value with right/left neighbour
-if (aXCol != aRetval)
-{
-aRetval.Merge(aXCol, 255 - nDeltaX);
-}
-
-// merge top/bottom neighbour with edge
-if (aYCol != aXYCol)
-{
-aYCol.Merge(aXYCol, 255 - nDeltaX);
-}
-
-// merge return value with already merged top/bottom neighbour
-if (aRetval != aYCol)
-{
-aRetval.Merge(aYCol, 255 - nDeltaY);
-}
-
-return aRetval;
-}
+nIndX = nX + 1;
+}
+else
+{
+nIndX = nX - 1;
+nDeltaX = -nDeltaX;
+}
+
+if (nDeltaY > 0)
+{
+nIndY = nY + 1;
+}
+else
+{
+nIndY = nY - 1;
+nDeltaY = -nDeltaY;
 }
 
-return rFallback;
+// get right/left neighbour
+BitmapColor aXCol(rFallback);
+
+if (nDeltaX && nIndX >= 0 && nIndX < mpBuffer->mnWidth)
+aXCol = GetColor(nY, nIndX);
+
+// get top/bottom neighbour
+BitmapColor aYCol(rFallback);
+
+if (nDeltaY && nIndY >= 0 && nIndY < mpBuffer->mnHeight)
+aYCol = GetColor(nIndY, nX);
+
+// get

core.git: vcl/source

2024-09-29 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapPopArtFilter.cxx |  123 ++-
 1 file changed, 58 insertions(+), 65 deletions(-)

New commits:
commit 89f0b965b26eca7ca9be18122881b955072f3fa8
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 05:45:20 2024 +1000
Commit: Michael Weghorn 
CommitDate: Mon Sep 30 08:34:04 2024 +0200

vcl: flatten BitmapPopArtFilter::execute()

Change-Id: Icfbf2e625fb01f336c0c5eec8553b24922376680
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173204
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/vcl/source/bitmap/BitmapPopArtFilter.cxx 
b/vcl/source/bitmap/BitmapPopArtFilter.cxx
index ee2cf716c93e..bbb42843d397 100644
--- a/vcl/source/bitmap/BitmapPopArtFilter.cxx
+++ b/vcl/source/bitmap/BitmapPopArtFilter.cxx
@@ -18,79 +18,72 @@ BitmapEx BitmapPopArtFilter::execute(BitmapEx const& 
rBitmapEx) const
 {
 Bitmap aBitmap(rBitmapEx.GetBitmap());
 
-bool bRet = isPalettePixelFormat(aBitmap.getPixelFormat())
-|| aBitmap.Convert(BmpConversion::N8BitColors);
+bool bConvert = isPalettePixelFormat(aBitmap.getPixelFormat())
+|| aBitmap.Convert(BmpConversion::N8BitColors);
 
-if (bRet)
-{
-bRet = false;
+if (!bConvert)
+return BitmapEx();
+
+BitmapScopedWriteAccess pWriteAcc(aBitmap);
+
+if (!pWriteAcc)
+return BitmapEx();
 
-BitmapScopedWriteAccess pWriteAcc(aBitmap);
+const sal_Int32 nWidth = pWriteAcc->Width();
+const sal_Int32 nHeight = pWriteAcc->Height();
+const sal_uInt16 nEntryCount = 1 << pWriteAcc->GetBitCount();
+sal_uInt16 n = 0;
+std::vector aPopArtTable(nEntryCount);
 
-if (pWriteAcc)
+for (n = 0; n < nEntryCount; n++)
+{
+PopArtEntry& rEntry = aPopArtTable[n];
+rEntry.mnIndex = n;
+rEntry.mnCount = 0;
+}
+
+// get pixel count for each palette entry
+for (sal_Int32 nY = 0; nY < nHeight; nY++)
+{
+Scanline pScanline = pWriteAcc->GetScanline(nY);
+for (sal_Int32 nX = 0; nX < nWidth; nX++)
 {
-const sal_Int32 nWidth = pWriteAcc->Width();
-const sal_Int32 nHeight = pWriteAcc->Height();
-const sal_uInt16 nEntryCount = 1 << pWriteAcc->GetBitCount();
-sal_uInt16 n = 0;
-std::vector aPopArtTable(nEntryCount);
-
-for (n = 0; n < nEntryCount; n++)
-{
-PopArtEntry& rEntry = aPopArtTable[n];
-rEntry.mnIndex = n;
-rEntry.mnCount = 0;
-}
-
-// get pixel count for each palette entry
-for (sal_Int32 nY = 0; nY < nHeight; nY++)
-{
-Scanline pScanline = pWriteAcc->GetScanline(nY);
-for (sal_Int32 nX = 0; nX < nWidth; nX++)
-{
-aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, 
nX)].mnCount++;
-assert(aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, 
nX)].mnCount != 0);
-}
-}
-
-// sort table
-std::sort(aPopArtTable.begin(), aPopArtTable.end(),
-  [](const PopArtEntry& lhs, const PopArtEntry& rhs) {
-  return lhs.mnCount > rhs.mnCount;
-  });
-
-// get last used entry
-sal_uInt16 nFirstEntry;
-sal_uInt16 nLastEntry = 0;
-
-for (n = 0; n < nEntryCount; n++)
-{
-if (aPopArtTable[n].mnCount)
-nLastEntry = n;
-}
-
-// rotate palette (one entry)
-const BitmapColor 
aFirstCol(pWriteAcc->GetPaletteColor(aPopArtTable[0].mnIndex));
-
-for (nFirstEntry = 0; nFirstEntry < nLastEntry; nFirstEntry++)
-{
-pWriteAcc->SetPaletteColor(
-aPopArtTable[nFirstEntry].mnIndex,
-pWriteAcc->GetPaletteColor(aPopArtTable[nFirstEntry + 
1].mnIndex));
-}
-
-pWriteAcc->SetPaletteColor(aPopArtTable[nLastEntry].mnIndex, 
aFirstCol);
-
-// cleanup
-pWriteAcc.reset();
-bRet = true;
+aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, nX)].mnCount++;
+assert(aPopArtTable[pWriteAcc->GetIndexFromData(pScanline, 
nX)].mnCount != 0);
 }
 }
 
-if (bRet)
-return BitmapEx(aBitmap);
+// sort table
+std::sort(
+aPopArtTable.begin(), aPopArtTable.end(),
+[](const PopArtEntry& lhs, const PopArtEntry& rhs) { return 
lhs.mnCount > rhs.mnCount; });
+
+// get last used entry
+sal_uInt16 nFirstEntry;
+sal_uInt16 nLastEntry = 0;
+
+for (n = 0; n < nEntryCount; n++)
+{
+if (aPopArtTable[n].mnCount)
+nLastEntry = n;
+}

core.git: vcl/source

2024-09-26 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapMosaicFilter.cxx |  236 +++
 1 file changed, 118 insertions(+), 118 deletions(-)

New commits:
commit 522d2aaf1ca830bcf3bca816b06cc8faa893cd0d
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 05:31:56 2024 +1000
Commit: Michael Weghorn 
CommitDate: Fri Sep 27 08:28:08 2024 +0200

vcl: flatten BitmapMosaicFilter::execute()

Change-Id: I9e56c285cffe14374a66204ef8126a20f0e7c07c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173203
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/bitmap/BitmapMosaicFilter.cxx 
b/vcl/source/bitmap/BitmapMosaicFilter.cxx
index 0f89b23b9a6d..070b4932cf09 100644
--- a/vcl/source/bitmap/BitmapMosaicFilter.cxx
+++ b/vcl/source/bitmap/BitmapMosaicFilter.cxx
@@ -15,162 +15,162 @@
 
 BitmapEx BitmapMosaicFilter::execute(BitmapEx const& rBitmapEx) const
 {
+if (!(mnTileWidth > 1 || mnTileHeight > 1))
+return BitmapEx();
+
 Bitmap aBitmap(rBitmapEx.GetBitmap());
 
-bool bRet = false;
+std::optional pNewBmp;
+BitmapScopedReadAccess pReadAcc;
+BitmapScopedWriteAccess pWriteAcc;
 
-if (mnTileWidth > 1 || mnTileHeight > 1)
+if (!isPalettePixelFormat(aBitmap.getPixelFormat()))
+{
+pReadAcc = aBitmap;
+pWriteAcc = aBitmap;
+}
+else
 {
-std::optional pNewBmp;
-BitmapScopedReadAccess pReadAcc;
-BitmapScopedWriteAccess pWriteAcc;
+pNewBmp.emplace(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
+pReadAcc = aBitmap;
+pWriteAcc = *pNewBmp;
+}
 
-if (!isPalettePixelFormat(aBitmap.getPixelFormat()))
-{
-pReadAcc = aBitmap;
-pWriteAcc = aBitmap;
-}
-else
-{
-pNewBmp.emplace(aBitmap.GetSizePixel(), vcl::PixelFormat::N24_BPP);
-pReadAcc = aBitmap;
-pWriteAcc = *pNewBmp;
-}
+bool bConditionsMet = false;
+sal_Int32 nWidth(0);
+sal_Int32 nHeight(0);
+if (pReadAcc && pWriteAcc)
+{
+nWidth = pReadAcc->Width();
+nHeight = pReadAcc->Height();
+bConditionsMet = (nWidth > 0 && nHeight > 0);
+}
 
-bool bConditionsMet = false;
-sal_Int32 nWidth(0);
-sal_Int32 nHeight(0);
-if (pReadAcc && pWriteAcc)
-{
-nWidth = pReadAcc->Width();
-nHeight = pReadAcc->Height();
-bConditionsMet = (nWidth > 0 && nHeight > 0);
-}
+bool bRet = false;
 
-if (bConditionsMet)
-{
-BitmapColor aCol;
-sal_Int32 nX, nY, nX1, nX2, nY1, nY2, nSumR, nSumG, nSumB;
-double fArea_1;
+if (bConditionsMet)
+{
+BitmapColor aCol;
+sal_Int32 nX, nY, nX1, nX2, nY1, nY2, nSumR, nSumG, nSumB;
+double fArea_1;
 
-nY1 = 0;
-nY2 = mnTileHeight - 1;
+nY1 = 0;
+nY2 = mnTileHeight - 1;
 
-if (nY2 >= nHeight)
-nY2 = nHeight - 1;
+if (nY2 >= nHeight)
+nY2 = nHeight - 1;
 
-do
-{
-nX1 = 0;
-nX2 = mnTileWidth - 1;
+do
+{
+nX1 = 0;
+nX2 = mnTileWidth - 1;
 
-if (nX2 >= nWidth)
-nX2 = nWidth - 1;
+if (nX2 >= nWidth)
+nX2 = nWidth - 1;
 
-fArea_1 = 1.0 / ((nX2 - nX1 + 1) * (nY2 - nY1 + 1));
+fArea_1 = 1.0 / ((nX2 - nX1 + 1) * (nY2 - nY1 + 1));
 
-if (!pNewBmp)
+if (!pNewBmp)
+{
+do
 {
-do
+for (nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; nY++)
 {
-for (nY = nY1, nSumR = nSumG = nSumB = 0; nY <= nY2; 
nY++)
+Scanline pScanlineRead = pReadAcc->GetScanline(nY);
+for (nX = nX1; nX <= nX2; nX++)
 {
-Scanline pScanlineRead = pReadAcc->GetScanline(nY);
-for (nX = nX1; nX <= nX2; nX++)
-{
-aCol = 
pReadAcc->GetPixelFromData(pScanlineRead, nX);
-nSumR += aCol.GetRed();
-nSumG += aCol.GetGreen();
-nSumB += aCol.GetBlue();
-}
+aCol = pReadAcc->GetPixelFromData(pScanlineRead, 
nX);
+nSumR += aCol.GetRed();
+nSumG += aCol.GetGreen();
+nSumB += aCol.GetBlue();
 }
+}
 
-a

core.git: vcl/source

2024-09-26 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapFilterStackBlur.cxx |   50 +---
 1 file changed, 17 insertions(+), 33 deletions(-)

New commits:
commit 8e1f8e9b701839ff141bebb715de56772a85
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 05:11:57 2024 +1000
Commit: Michael Weghorn 
CommitDate: Thu Sep 26 14:27:19 2024 +0200

vcl: move variables closer to first use in BitmapFilterStackBlur functions

Change-Id: I7ce550928cf3aadf55006d43dc6aff6d109ec826
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173202
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/source/bitmap/BitmapFilterStackBlur.cxx 
b/vcl/source/bitmap/BitmapFilterStackBlur.cxx
index 6e3b1ef555a8..787ed27054da 100644
--- a/vcl/source/bitmap/BitmapFilterStackBlur.cxx
+++ b/vcl/source/bitmap/BitmapFilterStackBlur.cxx
@@ -244,24 +244,19 @@ void stackBlurHorizontal(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_In
 sal_uInt8* pStack = aArrays.maStackBuffer.data();
 sal_uInt8* pStackPtr;
 
-sal_Int32 nWidth = pReadAccess->Width();
-sal_Int32 nLastIndexX = nWidth - 1;
+const sal_Int32 nWidth = pReadAccess->Width();
+const sal_Int32 nLastIndexX = nWidth - 1;
 
-sal_Int32 nMultiplyValue = aArrays.getMultiplyValue();
-sal_Int32 nShiftValue = aArrays.getShiftValue();
+const sal_Int32 nMultiplyValue = aArrays.getMultiplyValue();
+const sal_Int32 nShiftValue = aArrays.getShiftValue();
 
-sal_Int32 nRadius = rShared.mnRadius;
-sal_Int32 nComponentWidth = rShared.mnComponentWidth;
-sal_Int32 nDiv = rShared.mnDiv;
+const sal_Int32 nRadius = rShared.mnRadius;
+const sal_Int32 nComponentWidth = rShared.mnComponentWidth;
+const sal_Int32 nDiv = rShared.mnDiv;
 
 Scanline pSourcePointer;
 Scanline pDestinationPointer;
 
-sal_Int32 nXPosition;
-sal_Int32 nStackIndex;
-sal_Int32 nStackIndexStart;
-sal_Int32 nWeight;
-
 aArrays.initializeWeightAndPositions(nLastIndexX);
 
 sal_Int32* nSum = aArrays.mnSumVector.data();
@@ -291,9 +286,7 @@ void stackBlurHorizontal(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_In
 
 SumFunction::assignPtr(pStackPtr, pSourcePointer);
 
-nWeight = pWeightPointer[i];
-
-SumFunction::add(nSum, pSourcePointer[0] * nWeight);
+SumFunction::add(nSum, pSourcePointer[0] * pWeightPointer[i]);
 
 if (i - nRadius > 0)
 {
@@ -305,8 +298,8 @@ void stackBlurHorizontal(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_In
 }
 }
 
-nStackIndex = nRadius;
-nXPosition = std::min(nRadius, nLastIndexX);
+sal_Int32 nStackIndex = nRadius;
+sal_Int32 nXPosition = std::min(nRadius, nLastIndexX);
 
 pSourcePointer = pReadAccess->GetScanline(y) + nComponentWidth * 
nXPosition;
 
@@ -318,7 +311,7 @@ void stackBlurHorizontal(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_In
 
 SumFunction::sub(nSum, nOutSum);
 
-nStackIndexStart = nStackIndex + nDiv - nRadius;
+sal_Int32 nStackIndexStart = nStackIndex + nDiv - nRadius;
 if (nStackIndexStart >= nDiv)
 {
 nStackIndexStart -= nDiv;
@@ -377,11 +370,6 @@ void stackBlurVertical(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_Int3
 Scanline pSourcePointer;
 Scanline pDestinationPointer;
 
-sal_Int32 nYPosition;
-sal_Int32 nStackIndex;
-sal_Int32 nStackIndexStart;
-sal_Int32 nWeight;
-
 aArrays.initializeWeightAndPositions(nLastIndexY);
 
 sal_Int32* nSum = aArrays.mnSumVector.data();
@@ -410,9 +398,7 @@ void stackBlurVertical(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_Int3
 
 SumFunction::assignPtr(pStackPtr, pSourcePointer);
 
-nWeight = pWeightPointer[i];
-
-SumFunction::add(nSum, pSourcePointer[0] * nWeight);
+SumFunction::add(nSum, pSourcePointer[0] * pWeightPointer[i]);
 
 if (i - nRadius > 0)
 {
@@ -424,8 +410,8 @@ void stackBlurVertical(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_Int3
 }
 }
 
-nStackIndex = nRadius;
-nYPosition = std::min(nRadius, nLastIndexY);
+sal_Int32 nStackIndex = nRadius;
+sal_Int32 nYPosition = std::min(nRadius, nLastIndexY);
 
 pSourcePointer = pReadAccess->GetScanline(nYPosition) + 
nComponentWidth * x;
 
@@ -437,11 +423,11 @@ void stackBlurVertical(BlurSharedData const& rShared, 
sal_Int32 nStart, sal_Int3
 
 SumFunction::sub(nSum, nOutSum);
 
-nStackIndexStart = nStackIndex + nDiv - nRadius;
+sal_Int32 nStackIndexStart = nStackIndex + nDiv - nRadius;
+
 if (nStackIndexStart >= nDiv)
-{
 nStackIndexStart -= nDiv;
-}
+
   

core.git: vcl/source

2024-09-26 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |  322 +++--
 1 file changed, 153 insertions(+), 169 deletions(-)

New commits:
commit 3cf0b46327111830dc4e22a1f9f9af2c3e3b30ed
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 04:23:02 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 26 13:50:48 2024 +0200

vcl: flatten functions in BitmapEx.cxx

Change-Id: I62a876ae2d517e47efc0d8abccaece3f6059b4fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173200
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 9fe00bfec311..457ed4942994 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -253,125 +253,114 @@ BitmapChecksum BitmapEx::GetChecksum() const
 
 bool BitmapEx::Invert()
 {
-bool bRet = false;
-
 if (!maBitmap.IsEmpty())
-bRet = maBitmap.Invert();
+return maBitmap.Invert();
 
-return bRet;
+return false;
 }
 
-bool BitmapEx::Mirror( BmpMirrorFlags nMirrorFlags )
+bool BitmapEx::Mirror(BmpMirrorFlags nMirrorFlags)
 {
-bool bRet = false;
+if (maBitmap.IsEmpty())
+return false;
 
-if( !maBitmap.IsEmpty() )
-{
-bRet = maBitmap.Mirror( nMirrorFlags );
+bool bRet = maBitmap.Mirror( nMirrorFlags );
 
-if( bRet && !maAlphaMask.IsEmpty() )
-maAlphaMask.Mirror( nMirrorFlags );
-}
+if (bRet && !maAlphaMask.IsEmpty())
+maAlphaMask.Mirror(nMirrorFlags);
 
 return bRet;
 }
 
 bool BitmapEx::Scale( const double& rScaleX, const double& rScaleY, 
BmpScaleFlag nScaleFlag )
 {
-bool bRet = false;
 
-if( !maBitmap.IsEmpty() )
-{
-bRet = maBitmap.Scale( rScaleX, rScaleY, nScaleFlag );
+if (maBitmap.IsEmpty())
+return false;
 
-if( bRet && !maAlphaMask.IsEmpty() )
-{
-maAlphaMask.Scale( rScaleX, rScaleY, nScaleFlag );
-}
+bool bRet = maBitmap.Scale( rScaleX, rScaleY, nScaleFlag );
 
-maBitmapSize = maBitmap.GetSizePixel();
+if (bRet && !maAlphaMask.IsEmpty())
+maAlphaMask.Scale(rScaleX, rScaleY, nScaleFlag);
 
-SAL_WARN_IF( !maAlphaMask.IsEmpty() && maBitmap.GetSizePixel() != 
maAlphaMask.GetSizePixel(), "vcl",
-"BitmapEx::Scale(): size mismatch for bitmap and alpha 
mask." );
-}
+maBitmapSize = maBitmap.GetSizePixel();
+
+SAL_WARN_IF(!maAlphaMask.IsEmpty() && maBitmap.GetSizePixel() != 
maAlphaMask.GetSizePixel(), "vcl",
+"BitmapEx::Scale(): size mismatch for bitmap and alpha mask.");
 
 return bRet;
 }
 
-bool BitmapEx::Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag )
+static bool lcl_ShouldScale(Size const& rOrigSize, Size const& rNewSize)
 {
-bool bRet;
+return rOrigSize.Width() && rOrigSize.Height()
+&& (rNewSize.Width() != rOrigSize.Width() || rNewSize.Height() != 
rOrigSize.Height());
+}
 
-if (GetSizePixel().Width() && GetSizePixel().Height()
-&& (rNewSize.Width()  != GetSizePixel().Width()
-|| rNewSize.Height() != GetSizePixel().Height() ) )
-{
-bRet = Scale( static_cast(rNewSize.Width()) / 
GetSizePixel().Width(),
-  static_cast(rNewSize.Height()) / 
GetSizePixel().Height(),
-  nScaleFlag );
-}
-else
+bool BitmapEx::Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag )
+{
+if (lcl_ShouldScale(GetSizePixel(), rNewSize))
 {
-bRet = true;
+return Scale(static_cast(rNewSize.Width()) / 
GetSizePixel().Width(),
+ static_cast(rNewSize.Height()) / 
GetSizePixel().Height(),
+ nScaleFlag);
 }
 
-return bRet;
+return true;
 }
 
 bool BitmapEx::Rotate( Degree10 nAngle10, const Color& rFillColor )
 {
-bool bRet = false;
+if (maBitmap.IsEmpty())
+return false;
 
-if( !maBitmap.IsEmpty() )
-{
-const bool bTransRotate = ( COL_TRANSPARENT == rFillColor );
+const bool bTransRotate = ( COL_TRANSPARENT == rFillColor );
 
-if( bTransRotate )
-{
-bRet = maBitmap.Rotate( nAngle10, COL_BLACK );
+bool bRet = false;
 
-if( maAlphaMask.IsEmpty() )
-{
-maAlphaMask = Bitmap(GetSizePixel(), vcl::PixelFormat::N8_BPP, 
&Bitmap::GetGreyPalette(256));
-maAlphaMask.Erase( 0 );
-}
+if (bTransRotate)
+{
+bRet = maBitmap.Rotate(nAngle10, COL_BLACK);
 
-if( bRet && !maAlphaMask.IsEmpty() )
-maAlphaMask.Rotate( nAngle10, COL_ALPHA_TRANSPARENT );
-}
-else
+if (maAlphaMask.IsEmpty())
 {
-bRet = maBitmap.Rotate( nAngle10, rFillColor );
-
-if( bRet &&

core.git: Branch 'libreoffice-24-8' - vcl/inc vcl/source

2024-09-23 Thread Chris Sherlock (via logerrit)
 vcl/inc/bitmap/BitmapFastScaleFilter.hxx|1 -
 vcl/source/bitmap/BitmapFastScaleFilter.cxx |2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 10104d8477467bce8f05f45f16ddef763c523bc4
Author: Chris Sherlock 
AuthorDate: Sun Sep 22 17:26:58 2024 +1000
Commit: Xisco Fauli 
CommitDate: Mon Sep 23 13:56:17 2024 +0200

vcl: mask scale regression in BitmapFastScaleFilter

Masks are not scaled in the fast scaling filter. The issue occured when
migrating to the BitmapFastScaleFilter class - maSize was never set.
The size is now calculated in execute() locally.

Regression from:

commit  d246aa574571409046619254292698184c2545a3
dateSun Apr 15 10:14:10 2018 +1000
author  Chris Sherlock 

vcl: move Bitmap::ImplScaleFast() and Bitmap::ImplScaleInterpolate()

Change-Id: I9cc36f609059ae2db9c4cdb169bd5110382cfb21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173766
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit c32e874a4f13acb87966731dbc5554fc95fa8e2b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173791
Reviewed-by: Xisco Fauli 

diff --git a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx 
b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
index bea516c9e01a..ab2c14e67180 100644
--- a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
+++ b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
@@ -28,7 +28,6 @@ public:
 private:
 double mfScaleX;
 double mfScaleY;
-Size maSize;
 };
 
 #endif
diff --git a/vcl/source/bitmap/BitmapFastScaleFilter.cxx 
b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
index 584942457f74..456c3d7bcc8a 100644
--- a/vcl/source/bitmap/BitmapFastScaleFilter.cxx
+++ b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
@@ -115,7 +115,7 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& 
rBitmapEx) const
 AlphaMask aMask(rBitmapEx.GetAlphaMask());
 
 if (bRet && !aMask.IsEmpty())
-bRet = aMask.Scale(maSize, BmpScaleFlag::Fast);
+bRet = aMask.Scale(Size(nNewWidth, nNewHeight), BmpScaleFlag::Fast);
 
 SAL_WARN_IF(!aMask.IsEmpty() && aBitmap.GetSizePixel() != 
aMask.GetSizePixel(), "vcl",
 "BitmapEx::Scale(): size mismatch for bitmap and alpha mask.");


core.git: Branch 'libreoffice-24-2' - vcl/inc vcl/source

2024-09-23 Thread Chris Sherlock (via logerrit)
 vcl/inc/bitmap/BitmapFastScaleFilter.hxx|1 -
 vcl/source/bitmap/BitmapFastScaleFilter.cxx |2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit d775a90fdbcf9e4c8084c39c66bd6fc6eda22e13
Author: Chris Sherlock 
AuthorDate: Sun Sep 22 17:26:58 2024 +1000
Commit: Xisco Fauli 
CommitDate: Mon Sep 23 13:31:40 2024 +0200

vcl: mask scale regression in BitmapFastScaleFilter

Masks are not scaled in the fast scaling filter. The issue occured when
migrating to the BitmapFastScaleFilter class - maSize was never set.
The size is now calculated in execute() locally.

Regression from:

commit  d246aa574571409046619254292698184c2545a3
dateSun Apr 15 10:14:10 2018 +1000
author  Chris Sherlock 

vcl: move Bitmap::ImplScaleFast() and Bitmap::ImplScaleInterpolate()

Change-Id: I9cc36f609059ae2db9c4cdb169bd5110382cfb21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173766
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
(cherry picked from commit c32e874a4f13acb87966731dbc5554fc95fa8e2b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173792
Reviewed-by: Xisco Fauli 

diff --git a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx 
b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
index bea516c9e01a..ab2c14e67180 100644
--- a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
+++ b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
@@ -28,7 +28,6 @@ public:
 private:
 double mfScaleX;
 double mfScaleY;
-Size maSize;
 };
 
 #endif
diff --git a/vcl/source/bitmap/BitmapFastScaleFilter.cxx 
b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
index 431211369f98..ae0103d32239 100644
--- a/vcl/source/bitmap/BitmapFastScaleFilter.cxx
+++ b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
@@ -115,7 +115,7 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& 
rBitmapEx) const
 AlphaMask aMask(rBitmapEx.GetAlphaMask());
 
 if (bRet && !aMask.IsEmpty())
-bRet = aMask.Scale(maSize, BmpScaleFlag::Fast);
+bRet = aMask.Scale(Size(nNewWidth, nNewHeight), BmpScaleFlag::Fast);
 
 SAL_WARN_IF(!aMask.IsEmpty() && aBitmap.GetSizePixel() != 
aMask.GetSizePixel(), "vcl",
 "BitmapEx::Scale(): size mismatch for bitmap and alpha mask.");


core.git: vcl/inc vcl/source

2024-09-23 Thread Chris Sherlock (via logerrit)
 vcl/inc/bitmap/BitmapFastScaleFilter.hxx|1 -
 vcl/source/bitmap/BitmapFastScaleFilter.cxx |2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

New commits:
commit c32e874a4f13acb87966731dbc5554fc95fa8e2b
Author: Chris Sherlock 
AuthorDate: Sun Sep 22 17:26:58 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Sep 23 11:57:13 2024 +0200

vcl: mask scale regression in BitmapFastScaleFilter

Masks are not scaled in the fast scaling filter. The issue occured when
migrating to the BitmapFastScaleFilter class - maSize was never set.
The size is now calculated in execute() locally.

Regression from:

commit  d246aa574571409046619254292698184c2545a3
dateSun Apr 15 10:14:10 2018 +1000
author  Chris Sherlock 

vcl: move Bitmap::ImplScaleFast() and Bitmap::ImplScaleInterpolate()

Change-Id: I9cc36f609059ae2db9c4cdb169bd5110382cfb21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173766
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx 
b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
index bea516c9e01a..ab2c14e67180 100644
--- a/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
+++ b/vcl/inc/bitmap/BitmapFastScaleFilter.hxx
@@ -28,7 +28,6 @@ public:
 private:
 double mfScaleX;
 double mfScaleY;
-Size maSize;
 };
 
 #endif
diff --git a/vcl/source/bitmap/BitmapFastScaleFilter.cxx 
b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
index 584942457f74..456c3d7bcc8a 100644
--- a/vcl/source/bitmap/BitmapFastScaleFilter.cxx
+++ b/vcl/source/bitmap/BitmapFastScaleFilter.cxx
@@ -115,7 +115,7 @@ BitmapEx BitmapFastScaleFilter::execute(BitmapEx const& 
rBitmapEx) const
 AlphaMask aMask(rBitmapEx.GetAlphaMask());
 
 if (bRet && !aMask.IsEmpty())
-bRet = aMask.Scale(maSize, BmpScaleFlag::Fast);
+bRet = aMask.Scale(Size(nNewWidth, nNewHeight), BmpScaleFlag::Fast);
 
 SAL_WARN_IF(!aMask.IsEmpty() && aBitmap.GetSizePixel() != 
aMask.GetSizePixel(), "vcl",
 "BitmapEx::Scale(): size mismatch for bitmap and alpha mask.");


core.git: include/vcl svgio/source vcl/qa vcl/source

2024-09-20 Thread Chris Sherlock (via logerrit)
 include/vcl/BitmapArithmeticBlendFilter.hxx   |   14 +
 svgio/source/svgreader/svgfecompositenode.cxx |6 
 vcl/qa/cppunit/BitmapFilterTest.cxx   |  182 ++
 vcl/source/bitmap/BitmapArithmeticBlendFilter.cxx |   41 ++--
 4 files changed, 183 insertions(+), 60 deletions(-)

New commits:
commit 5b54f68599d9a9b6f4d21fd8c0cdac746ea71ecb
Author: Chris Sherlock 
AuthorDate: Sat Sep 14 02:22:28 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 20 22:53:17 2024 +0200

vcl: migrate BitmapArithmeticBlendFilter to use BitmapFilter class

Change-Id: I524b8c87747b79a8698cce4bd092493ffc9c1235
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173350
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/BitmapArithmeticBlendFilter.hxx 
b/include/vcl/BitmapArithmeticBlendFilter.hxx
index 6f936c0822bc..e63f838e65f4 100644
--- a/include/vcl/BitmapArithmeticBlendFilter.hxx
+++ b/include/vcl/BitmapArithmeticBlendFilter.hxx
@@ -11,19 +11,23 @@
 #ifndef INCLUDED_VCL_BITMAPARITHMETICBLENDFILTER_HXX
 #define INCLUDED_VCL_BITMAPARITHMETICBLENDFILTER_HXX
 
-#include 
+#include 
 
-class VCL_DLLPUBLIC BitmapArithmeticBlendFilter
+class VCL_DLLPUBLIC BitmapArithmeticBlendFilter final : public BitmapFilter
 {
 private:
-BitmapEx maBitmapEx;
 BitmapEx maBitmapEx2;
+double mnK1;
+double mnK2;
+double mnK3;
+double mnK4;
 
 public:
-BitmapArithmeticBlendFilter(BitmapEx const& rBmpEx, BitmapEx const& 
rBmpEx2);
+BitmapArithmeticBlendFilter(BitmapEx const& rBmpEx2, double nK1, double 
nK2, double nK3,
+double nK4);
 ~BitmapArithmeticBlendFilter();
 
-BitmapEx execute(double aK1, double aK2, double aK3, double aK4);
+BitmapEx execute(BitmapEx const& rBitmapEx) const;
 };
 
 #endif
diff --git a/svgio/source/svgreader/svgfecompositenode.cxx 
b/svgio/source/svgreader/svgfecompositenode.cxx
index 0dea908847f6..9d9b1b2616f2 100644
--- a/svgio/source/svgreader/svgfecompositenode.cxx
+++ b/svgio/source/svgreader/svgfecompositenode.cxx
@@ -256,9 +256,9 @@ void 
SvgFeCompositeNode::apply(drawinglayer::primitive2d::Primitive2DContainer&
 aBaseRange.getHeight(), aBaseRange.getWidth() * 
aBaseRange.getHeight());
 }
 
-BitmapArithmeticBlendFilter aArithmeticFilter(aBmpEx, aBmpEx2);
-BitmapEx aResBmpEx = aArithmeticFilter.execute(maK1.getNumber(), 
maK2.getNumber(),
-   maK3.getNumber(), 
maK4.getNumber());
+BitmapArithmeticBlendFilter aArithmeticFilter(aBmpEx2, 
maK1.getNumber(), maK2.getNumber(),
+  maK3.getNumber(), 
maK4.getNumber());
+BitmapEx aResBmpEx = aArithmeticFilter.execute(aBmpEx);
 
 const drawinglayer::primitive2d::Primitive2DReference xRef(
 new drawinglayer::primitive2d::BitmapPrimitive2D(
diff --git a/vcl/qa/cppunit/BitmapFilterTest.cxx 
b/vcl/qa/cppunit/BitmapFilterTest.cxx
index 099720a1569d..c34b121e4959 100644
--- a/vcl/qa/cppunit/BitmapFilterTest.cxx
+++ b/vcl/qa/cppunit/BitmapFilterTest.cxx
@@ -612,91 +612,207 @@ void BitmapFilterTest::testArithmeticBlendFilter()
 
 // same color
 {
-BitmapArithmeticBlendFilter* pArithmeticFilter
-= new BitmapArithmeticBlendFilter(aRedBitmapEx, aRedBitmapEx);
-BitmapEx aResBitmapEx = pArithmeticFilter->execute(0, 0, 0, 0);
+BitmapEx aResBitmapEx(aRedBitmapEx);
+BitmapFilter::Filter(aResBitmapEx, 
BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 0, 0));
+
 CPPUNIT_ASSERT_EQUAL(Color(ColorAlpha, 0x00, 0x00, 0x00, 0x00),
  aResBitmapEx.GetPixelColor(0, 0));
-aResBitmapEx = pArithmeticFilter->execute(1, 0, 0, 0);
+}
+
+{
+BitmapEx aResBitmapEx(aRedBitmapEx);
+BitmapFilter::Filter(aResBitmapEx, 
BitmapArithmeticBlendFilter(aRedBitmapEx, 1, 0, 0, 0));
 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0));
-aResBitmapEx = pArithmeticFilter->execute(0, 1, 0, 0);
+}
+
+{
+BitmapEx aResBitmapEx(aRedBitmapEx);
+BitmapFilter::Filter(aResBitmapEx, 
BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 1, 0, 0));
 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0));
-aResBitmapEx = pArithmeticFilter->execute(0, 0, 1, 0);
+}
+
+{
+BitmapEx aResBitmapEx(aRedBitmapEx);
+BitmapFilter::Filter(aResBitmapEx, 
BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 1, 0));
 CPPUNIT_ASSERT_EQUAL(COL_LIGHTRED, aResBitmapEx.GetPixelColor(0, 0));
-aResBitmapEx = pArithmeticFilter->execute(0, 0, 0, 1);
+}
+
+{
+BitmapEx aResBitmapEx(aRedBitmapEx);
+BitmapFilter::Filter(aResBitmapEx, 
BitmapArithmeticBlendFilter(aRedBitmapEx, 0, 0, 0, 1));
 CPPUNIT_ASSERT_EQUAL(Color

core.git: vcl/source

2024-09-13 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapEmbossGreyFilter.cxx |   20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

New commits:
commit 0874f235e6779317ae215c438b6e642694b40af1
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 03:53:23 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 13 11:15:11 2024 +0200

vcl: move variables closer to first usage in 
BitmapEmbossGreyFilter::execute()

Change-Id: I711b82e2c86035aa1bfbb245c125be65277043f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173198
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx 
b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
index 3e7694968d1b..325badb4d16a 100644
--- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
+++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
@@ -35,19 +35,10 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& 
rBitmapEx) const
 if (!pWriteAcc)
 return BitmapEx();
 
-BitmapColor aGrey(sal_uInt8(0));
 const sal_Int32 nWidth = pWriteAcc->Width();
 const sal_Int32 nHeight = pWriteAcc->Height();
-const double fAzim = toRadians(mnAzimuthAngle);
-const double fElev = toRadians(mnElevationAngle);
 std::vector pHMap(nWidth + 2);
 std::vector pVMap(nHeight + 2);
-const double nLx = cos(fAzim) * cos(fElev) * 255.0;
-const double nLy = sin(fAzim) * cos(fElev) * 255.0;
-const double nLz = sin(fElev) * 255.0;
-const double nNz = 6 * 255.0 / 4;
-const double nNzLz = nNz * nLz;
-const sal_uInt8 cLz = basegfx::fround(nLz);
 
 // fill mapping tables
 pHMap[0] = 0;
@@ -68,6 +59,15 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& 
rBitmapEx) const
 
 pVMap[nHeight + 1] = nHeight - 1;
 
+const double fAzim = toRadians(mnAzimuthAngle);
+const double fElev = toRadians(mnElevationAngle);
+const double nLx = cos(fAzim) * cos(fElev) * 255.0;
+const double nLy = sin(fAzim) * cos(fElev) * 255.0;
+const double nLz = sin(fElev) * 255.0;
+const double nNz = 6 * 255.0 / 4;
+const double nNzLz = nNz * nLz;
+const sal_uInt8 cLz = basegfx::fround(nLz);
+
 for (sal_Int32 nY = 0; nY < nHeight; nY++)
 {
 sal_Int32 nGrey11 = pReadAcc->GetPixel(pVMap[nY], pHMap[0]).GetIndex();
@@ -81,6 +81,8 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& 
rBitmapEx) const
 sal_Int32 nGrey33 = pReadAcc->GetPixel(pVMap[nY + 2], 
pHMap[2]).GetIndex();
 
 Scanline pScanline = pWriteAcc->GetScanline(nY);
+BitmapColor aGrey(sal_uInt8(0));
+
 for (sal_Int32 nX = 0; nX < nWidth; nX++)
 {
 const sal_Int32 nNx = nGrey11 + nGrey21 + nGrey31 - nGrey13 - 
nGrey23 - nGrey33;


core.git: vcl/source

2024-09-13 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapDisabledImageFilter.cxx |9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit dc451a30d4a42dcf7bc7f3a9b42721aa9d0dbd43
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 03:45:36 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 13 11:14:36 2024 +0200

vcl: just return a BitmapEx() in BitmapDisabledImageFilter::execute()

Change-Id: I2a257211d7fdf22abb8d6e1f994293873348b38e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173191
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx 
b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
index e38c450d7949..396d0e0a2af7 100644
--- a/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
+++ b/vcl/source/bitmap/BitmapDisabledImageFilter.cxx
@@ -26,7 +26,6 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& 
rBitmapEx) const
 Bitmap aGrey(aSize, ePixelFormat, pPal);
 BitmapScopedWriteAccess pGrey(aGrey);
 
-BitmapEx aReturnBitmap;
 Bitmap aReadBitmap(rBitmapEx.GetBitmap());
 BitmapScopedReadAccess pRead(aReadBitmap);
 if (pRead && pGrey)
@@ -48,13 +47,9 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& 
rBitmapEx) const
 }
 
 if (rBitmapEx.IsAlpha())
-{
-aReturnBitmap = BitmapEx(aGrey, rBitmapEx.GetAlphaMask());
-}
-else
-aReturnBitmap = BitmapEx(aGrey);
+return BitmapEx(aGrey, rBitmapEx.GetAlphaMask());
 
-return aReturnBitmap;
+return BitmapEx(aGrey);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


core.git: vcl/source

2024-09-13 Thread Chris Sherlock (via logerrit)
 vcl/source/bitmap/BitmapEx.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 8f6f57e126c8e44f23fde6d35f027214a3fd557b
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 03:59:16 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 13 11:14:04 2024 +0200

tdf#43157 vcl: remove OSL_ENSURE from BitmapEx functions

Change-Id: I8232751174dccc55139ab4878950636c32b1d6a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173199
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins

diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index a1348749195b..9fe00bfec311 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -133,7 +133,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const Bitmap& rMask 
) :
 else
 {
 // convert to alpha bitmap
-SAL_WARN( "vcl", "BitmapEx: forced mask to monochrome");
+SAL_WARN("vcl", "BitmapEx: forced mask to monochrome");
 BitmapEx aMaskEx(rMask);
 BitmapFilter::Filter(aMaskEx, BitmapMonochromeFilter(255));
 aMaskEx.Invert();
@@ -142,7 +142,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const Bitmap& rMask 
) :
 
 if (!maBitmap.IsEmpty() && maBitmap.GetSizePixel() != 
maAlphaMask.GetSizePixel())
 {
-OSL_ENSURE(false, "Mask size differs from Bitmap size, corrected Mask 
(!)");
+SAL_WARN("vcl", "Mask size differs from Bitmap size, corrected Mask 
(!)");
 maAlphaMask.Scale(maBitmap.GetSizePixel(), BmpScaleFlag::Fast);
 }
 }
@@ -154,7 +154,7 @@ BitmapEx::BitmapEx( const Bitmap& rBmp, const AlphaMask& 
rAlphaMask ) :
 {
 if (!maBitmap.IsEmpty() && !maAlphaMask.IsEmpty() && 
maBitmap.GetSizePixel() != maAlphaMask.GetSizePixel())
 {
-OSL_ENSURE(false, "Alpha size differs from Bitmap size, corrected Mask 
(!)");
+SAL_WARN("vcl", "Alpha size differs from Bitmap size, corrected Mask 
(!)");
 maAlphaMask.Scale(rBmp.GetSizePixel(), BmpScaleFlag::Fast);
 }
 }
@@ -925,7 +925,7 @@ BitmapEx BitmapEx::ModifyBitmapEx(const 
basegfx::BColorModifierStack& rBColorMod
 // determined and used -> this may be different from what is 
wanted here.
 // Better create a new bitmap with the needed color explicitly.
 BitmapScopedReadAccess xReadAccess(aChangedBitmap);
-OSL_ENSURE(xReadAccess, "Got no Bitmap ReadAccess ?!?");
+SAL_WARN_IF(!xReadAccess, "vcl", "Got no Bitmap ReadAccess ?!?");
 
 if(xReadAccess)
 {


core.git: 2 commits - include/vcl vcl/source

2024-09-10 Thread Chris Sherlock (via logerrit)
 include/vcl/BitmapConvolutionMatrixFilter.hxx   |5 -
 vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx |   68 ++--
 2 files changed, 37 insertions(+), 36 deletions(-)

New commits:
commit bacaa3e5243e4aabc7fad795af2b25d79611f18c
Author: Chris Sherlock 
AuthorDate: Sat Sep 7 02:20:32 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 10 13:30:17 2024 +0200

tdf#143148 Use pragma once in BitmapConvolutionMatrixFilter.hxx

Change-Id: If220df8a3bba570e00ba7891f7141892d80da3bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172974
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/BitmapConvolutionMatrixFilter.hxx 
b/include/vcl/BitmapConvolutionMatrixFilter.hxx
index a504ff0eebbe..34b0b03c8ad5 100644
--- a/include/vcl/BitmapConvolutionMatrixFilter.hxx
+++ b/include/vcl/BitmapConvolutionMatrixFilter.hxx
@@ -8,8 +8,7 @@
  *
  */
 
-#ifndef INCLUDED_VCL_BITMAPCONVOLUTIONMATRIXFILTER_HXX
-#define INCLUDED_VCL_BITMAPCONVOLUTIONMATRIXFILTER_HXX
+#pragma once
 
 #include 
 
@@ -31,6 +30,4 @@ private:
 const sal_Int32 (&mrMatrix)[9];
 };
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit eb3d1b3cade22c323d83973e8a087fe2d1b7bff0
Author: Chris Sherlock 
AuthorDate: Sun Sep 1 03:08:27 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Sep 10 13:30:04 2024 +0200

vcl: variable refactoring BitmapConvolutionMatrixFilter::execute()

Renamed variables, moved to declare closer to first use.

Change-Id: I60b909c79d7c12c81247af2013228be84b42991e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172916
Reviewed-by: Tomaž Vajngerl 
Tested-by: Jenkins

diff --git a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx 
b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
index ea11a1c0a2c5..4caed2b7b3be 100644
--- a/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
+++ b/vcl/source/bitmap/BitmapConvolutionMatrixFilter.cxx
@@ -22,7 +22,6 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx 
const& rBitmapEx) const
 {
 Bitmap aBitmap(rBitmapEx.GetBitmap());
 
-const sal_Int32 nDivisor = 8;
 BitmapScopedReadAccess pReadAcc(aBitmap);
 if (!pReadAcc)
 return BitmapEx();
@@ -32,66 +31,69 @@ BitmapEx BitmapConvolutionMatrixFilter::execute(BitmapEx 
const& rBitmapEx) const
 if (!pWriteAcc)
 return BitmapEx();
 
-const sal_Int32 nWidth = pWriteAcc->Width(), nWidth2 = nWidth + 2;
-const sal_Int32 nHeight = pWriteAcc->Height(), nHeight2 = nHeight + 2;
-std::unique_ptr pColm(new sal_Int32[nWidth2]);
-std::unique_ptr pRows(new sal_Int32[nHeight2]);
-std::unique_ptr pColRow1(new BitmapColor[nWidth2]);
-std::unique_ptr pColRow2(new BitmapColor[nWidth2]);
-std::unique_ptr pColRow3(new BitmapColor[nWidth2]);
-BitmapColor* pRowTmp1 = pColRow1.get();
-BitmapColor* pRowTmp2 = pColRow2.get();
-BitmapColor* pRowTmp3 = pColRow3.get();
-BitmapColor* pColor;
-sal_Int32 nY, nX, i, nSumR, nSumG, nSumB, nMatrixVal, nTmp;
 std::array, 9> aKoeff;
-sal_Int32* pTmp;
 
 // create LUT of products of matrix value and possible color component 
values
-for (nY = 0; nY < 9; nY++)
+for (sal_Int32 nY = 0; nY < 9; nY++)
 {
-for (nX = nTmp = 0, nMatrixVal = mrMatrix[nY]; nX < 256; nX++, nTmp += 
nMatrixVal)
+for (sal_Int32 nX = 0, nTmp = 0, nMatrixVal = mrMatrix[nY]; nX < 256;
+ nX++, nTmp += nMatrixVal)
 {
 aKoeff[nY][nX] = nTmp;
 }
 }
 
+const sal_Int32 nWidth = pWriteAcc->Width();
+const sal_Int32 nWidth2 = nWidth + 2;
+std::unique_ptr pColm(new sal_Int32[nWidth2]);
+
 // create column LUT
-for (i = 0; i < nWidth2; i++)
+for (sal_Int32 nColIdx = 0; nColIdx < nWidth2; nColIdx++)
 {
-pColm[i] = (i > 0) ? (i - 1) : 0;
+pColm[nColIdx] = (nColIdx > 0) ? (nColIdx - 1) : 0;
 }
 
 pColm[nWidth + 1] = pColm[nWidth];
 
+const sal_Int32 nHeight = pWriteAcc->Height();
+const sal_Int32 nHeight2 = nHeight + 2;
+std::unique_ptr pRows(new sal_Int32[nHeight2]);
+
 // create row LUT
-for (i = 0; i < nHeight2; i++)
+for (sal_Int32 nRowIdx = 0; nRowIdx < nHeight2; nRowIdx++)
 {
-pRows[i] = (i > 0) ? (i - 1) : 0;
+pRows[nRowIdx] = (nRowIdx > 0) ? (nRowIdx - 1) : 0;
 }
 
 pRows[nHeight + 1] = pRows[nHeight];
 
+std::unique_ptr pColRow1(new BitmapColor[nWidth2]);
+std::unique_ptr pColRow2(new BitmapColor[nWidth2]);
+std::unique_ptr pColRow3(new BitmapColor[nWidth2]);
+BitmapColor* pRowTmp1 = pColRow1.get();
+BitmapColor* pRowTmp2 = pColRow2.get();
+BitmapColor* pRowTmp3 = pColRow3.get();
+
 // read first three rows of bitmap color
-for (i = 0; i < nWidth2; i++)
+for (sal_Int32 nRowIdx = 0; nRowIdx < nWidth2; nRowIdx++)
 {
-pColRow1[i] = pR

core.git: vcl/source

2024-09-01 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |  275 ++-
 1 file changed, 129 insertions(+), 146 deletions(-)

New commits:
commit 77aa9c210ad79af443191860ee1a7233d2d007cf
Author: Chris Sherlock 
AuthorDate: Sat Aug 31 14:13:36 2024 +1000
Commit: Tomaž Vajngerl 
CommitDate: Sun Sep 1 22:18:50 2024 +0200

vcl: flatten Animation.cxx functions

Change-Id: I613c630bdbd9eefa4c9196e4647fb0f26f5efcd5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172691
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index daa9e1f1be4e..0233288e77fd 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -165,59 +165,57 @@ BitmapChecksum Animation::GetChecksum() const
 bool Animation::Start(OutputDevice& rOut, const Point& rDestPt, const Size& 
rDestSz,
   tools::Long nRendererId, OutputDevice* pFirstFrameOutDev)
 {
-bool bRet = false;
+if (maFrames.empty())
+return false;
 
-if (!maFrames.empty())
+if ((rOut.GetOutDevType() == OUTDEV_WINDOW) && !mbLoopTerminated
+&& (ANIMATION_TIMEOUT_ON_CLICK != maFrames[mnFrameIndex]->mnWait))
 {
-if ((rOut.GetOutDevType() == OUTDEV_WINDOW) && !mbLoopTerminated
-&& (ANIMATION_TIMEOUT_ON_CLICK != maFrames[mnFrameIndex]->mnWait))
-{
-bool differs = true;
+bool differs = true;
 
-auto itAnimView = std::find_if(
-maRenderers.begin(), maRenderers.end(),
-[&rOut, nRendererId](const std::unique_ptr& 
pRenderer) -> bool {
-return pRenderer->matches(&rOut, nRendererId);
-});
+auto itAnimView = std::find_if(
+maRenderers.begin(), maRenderers.end(),
+[&rOut, nRendererId](const std::unique_ptr& 
pRenderer) -> bool {
+return pRenderer->matches(&rOut, nRendererId);
+});
 
-if (itAnimView != maRenderers.end())
+if (itAnimView != maRenderers.end())
+{
+if ((*itAnimView)->getOriginPosition() == rDestPt
+&& (*itAnimView)->getOutSizePix() == 
rOut.LogicToPixel(rDestSz))
 {
-if ((*itAnimView)->getOriginPosition() == rDestPt
-&& (*itAnimView)->getOutSizePix() == 
rOut.LogicToPixel(rDestSz))
-{
-(*itAnimView)->repaint();
-differs = false;
-}
-else
-{
-maRenderers.erase(itAnimView);
-}
+(*itAnimView)->repaint();
+differs = false;
 }
-
-if (maRenderers.empty())
+else
 {
-maTimer.Stop();
-mbIsInAnimation = false;
-mnFrameIndex = 0;
+maRenderers.erase(itAnimView);
 }
+}
 
-if (differs)
-maRenderers.emplace_back(new AnimationRenderer(this, &rOut, 
rDestPt, rDestSz,
-   nRendererId, 
pFirstFrameOutDev));
-
-if (!mbIsInAnimation)
-{
-ImplRestartTimer(maFrames[mnFrameIndex]->mnWait);
-mbIsInAnimation = true;
-}
+if (maRenderers.empty())
+{
+maTimer.Stop();
+mbIsInAnimation = false;
+mnFrameIndex = 0;
 }
-else
-Draw(rOut, rDestPt, rDestSz);
 
-bRet = true;
+if (differs)
+maRenderers.emplace_back(new AnimationRenderer(this, &rOut, 
rDestPt, rDestSz,
+   nRendererId, 
pFirstFrameOutDev));
+
+if (!mbIsInAnimation)
+{
+ImplRestartTimer(maFrames[mnFrameIndex]->mnWait);
+mbIsInAnimation = true;
+}
+}
+else
+{
+Draw(rOut, rDestPt, rDestSz);
 }
 
-return bRet;
+return true;
 }
 
 void Animation::Stop(const OutputDevice* pOut, tools::Long nRendererId)
@@ -377,52 +375,47 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
 
-if (nAnimCount)
+if (!nAnimCount)
 {
-bool bIsAnyRendererActive = true;
+Stop();
+return;
+}
 
-if (maNotifyLink.IsSet())
-{
-maNotifyLink.Call(this);
-PopulateRenderers();
-PruneMarkedRenderers();
-bIsAnyRendererActive = IsAnyRendererActive();
-}
+bool bIsAnyRendererActive = true;
 
-if (maRenderers.empty())
-Stop();
-else if (!bIsAnyRendererActive)
-

core.git: vcl/inc vcl/qa vcl/source

2023-12-27 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |4 ++--
 vcl/qa/cppunit/textlayout.cxx  |6 +++---
 vcl/source/text/textlayout.cxx |8 
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 7c1a359663355fac356e1eccf76f3f0247d4e3c6
Author: Chris Sherlock 
AuthorDate: Thu Oct 26 03:27:29 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 28 02:34:56 2023 +0100

vcl: BreakLines() -> BreakLine() and BreakLinesSimple() -> BreakLineSimple()

Change-Id: I8cb778a09566c1b7d6c2ba4ac5766a5675e62465
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158465
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index d05259475d18..7f81fcbeb10a 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -52,13 +52,13 @@ namespace vcl
 public:
 OUString GetEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 
-std::tuple BreakLines(const tools::Long nWidth, 
OUString const& rStr,
+std::tuple BreakLine(const tools::Long nWidth, 
OUString const& rStr,
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference& xBI,
 const bool bHyphenate, const tools::Long 
nOrigLineWidth,
 const sal_Int32 nPos, const sal_Int32 nLen);
 
-std::tuple BreakLinesSimple(const tools::Long 
nWidth, OUString const& rStr,
+std::tuple BreakLineSimple(const tools::Long 
nWidth, OUString const& rStr,
   const sal_Int32 nPos, sal_Int32 nBreakPos, 
const tools::Long nOrigLineWidth);
 
 tools::Long GetTextLines(tools::Rectangle const& rRect, const 
tools::Long nTextHeight,
diff --git a/vcl/qa/cppunit/textlayout.cxx b/vcl/qa/cppunit/textlayout.cxx
index 3ace6a8b836d..36129aec6920 100644
--- a/vcl/qa/cppunit/textlayout.cxx
+++ b/vcl/qa/cppunit/textlayout.cxx
@@ -49,7 +49,7 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLines_invalid_softbreak)
 const auto nTextLen = 13;
 
 auto[nBreakPos, nLineWidth]
-= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, false, 
nTextWidth, nTextLen, 15);
+= aTextLayout.BreakLine(nTextWidth, sTestStr, xHyph, xBI, false, 
nTextWidth, nTextLen, 15);
 
 const sal_Int32 nExpectedBreakPos = 13;
 CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
@@ -75,7 +75,7 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLines_hyphens)
 css::uno::Reference xBI = 
vcl::unohelper::CreateBreakIterator();
 
 auto[nBreakPos, nLineWidth]
-= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 13, 12);
+= aTextLayout.BreakLine(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 13, 12);
 
 const sal_Int32 nExpectedBreakPos = 13;
 CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
@@ -101,7 +101,7 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLines_hyphen_word_under_two_cha
 css::uno::Reference xBI = 
vcl::unohelper::CreateBreakIterator();
 
 auto[nBreakPos, nLineWidth]
-= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 2, 10);
+= aTextLayout.BreakLine(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 2, 10);
 
 const sal_Int32 nExpectedBreakPos = 2;
 CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index e90c56b6355a..8797689963c0 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -218,7 +218,7 @@ namespace vcl
 return aStr;
 }
 
-std::tuple TextLayoutCommon::BreakLines(const 
tools::Long nWidth, OUString const& rStr,
+std::tuple TextLayoutCommon::BreakLine(const 
tools::Long nWidth, OUString const& rStr,
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference& xBI,
 const bool bHyphenate, const tools::Long 
nOrigLineWidth,
@@ -228,7 +228,7 @@ namespace vcl
 xBI = vcl::unohelper::CreateBreakIterator();
 
 if (!xBI.is())
-return BreakLinesSimple(nWidth, rStr, nPos, nLen, nOrigLineWidth);
+return BreakLineSimple(nWidth, rStr, nPos, nLen, nOrigLineWidth);
 
 const css::lang::Locale& 
rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
 
@@ -338,7 +338,7 @@ namespace vcl
 return { nBreakPos, GetTextWidth(rStr, nPos, nBreakPos - nPos) };
 }
 
-std::tuple TextLayoutCommon::BreakLinesSimple(const 
tools::Long nWidth, OUString const& rStr,
+std::tuple TextLayoutCommon::BreakLineSimple(const 
tools::Long nWidth, OUString const& rStr,
  const sal_Int32 nPos, const 
sal_Int

core.git: vcl/CppunitTest_vcl_textlayout.mk vcl/inc vcl/qa vcl/source

2023-12-27 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_textlayout.mk |1 
 vcl/inc/textlayout.hxx|   10 ++---
 vcl/qa/cppunit/textlayout.cxx |   64 +++---
 vcl/source/text/textlayout.cxx|   61 +---
 4 files changed, 96 insertions(+), 40 deletions(-)

New commits:
commit 938d3b35b83093de4e310d32de5137f6bdbcf22b
Author: Chris Sherlock 
AuthorDate: Sun Oct 1 18:08:49 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 28 02:33:50 2023 +0100

vcl: test BreakLinesWithIterator with hyphens

Change-Id: Ied5e688b9eec19c2f1b3d1289cc4a6605703c3e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157904
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/CppunitTest_vcl_textlayout.mk 
b/vcl/CppunitTest_vcl_textlayout.mk
index d7ac49a9e6df..57d5177f2a19 100644
--- a/vcl/CppunitTest_vcl_textlayout.mk
+++ b/vcl/CppunitTest_vcl_textlayout.mk
@@ -55,6 +55,7 @@ $(eval $(call gb_CppunitTest_use_components,vcl_textlayout,\
configmgr/source/configmgr \
i18npool/util/i18npool \
ucb/source/core/ucb1 \
+   linguistic/source/lng \
 ))
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_textlayout))
diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index 58f3bb33469b..d05259475d18 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -52,14 +52,14 @@ namespace vcl
 public:
 OUString GetEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 
-sal_Int32 BreakLinesWithIterator(const tools::Long nWidth, OUString 
const& rStr,
+std::tuple BreakLines(const tools::Long nWidth, 
OUString const& rStr,
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
-css::uno::Reference const& 
xBI,
-const bool bHyphenate,
+css::uno::Reference& xBI,
+const bool bHyphenate, const tools::Long 
nOrigLineWidth,
 const sal_Int32 nPos, const sal_Int32 nLen);
 
-sal_Int32 BreakLinesSimple(const tools::Long nWidth, OUString const& 
rStr,
-  const sal_Int32 nPos, sal_Int32 nBreakPos, 
tools::Long& nLineWidth);
+std::tuple BreakLinesSimple(const tools::Long 
nWidth, OUString const& rStr,
+  const sal_Int32 nPos, sal_Int32 nBreakPos, 
const tools::Long nOrigLineWidth);
 
 tools::Long GetTextLines(tools::Rectangle const& rRect, const 
tools::Long nTextHeight,
  ImplMultiTextLineInfo& rLineInfo,
diff --git a/vcl/qa/cppunit/textlayout.cxx b/vcl/qa/cppunit/textlayout.cxx
index 147826f19842..3ace6a8b836d 100644
--- a/vcl/qa/cppunit/textlayout.cxx
+++ b/vcl/qa/cppunit/textlayout.cxx
@@ -12,6 +12,8 @@
 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -28,7 +30,7 @@ public:
 
 #if HAVE_MORE_FONTS
 
-CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLinesWithIterator_invalid_softbreak)
+CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, testBreakLines_invalid_softbreak)
 {
 ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::WITHOUT_ALPHA);
 device->SetOutputSizePixel(Size(1000, 1000));
@@ -46,9 +48,63 @@ CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLinesWithIterator_invalid_softb
 
 const auto nTextLen = 13;
 
-CPPUNIT_ASSERT_EQUAL(
-static_cast(13),
-aTextLayout.BreakLinesWithIterator(nTextWidth, sTestStr, xHyph, xBI, 
false, nTextLen, 15));
+auto[nBreakPos, nLineWidth]
+= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, false, 
nTextWidth, nTextLen, 15);
+
+const sal_Int32 nExpectedBreakPos = 13;
+CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
+}
+
+CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, testBreakLines_hyphens)
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::WITHOUT_ALPHA);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+vcl::DefaultTextLayout aTextLayout(*device);
+
+const OUString sTestStr = u"textline text-moretext"_ustr;
+const auto nTextWidth = device->GetTextWidth("textline text-moretex");
+
+css::uno::Reference xContext(
+comphelper::getProcessComponentContext());
+css::uno::Reference xLinguMgr
+= css::linguistic2::LinguServiceManager::create(xContext);
+
+css::uno::Reference xHyph = 
xLinguMgr->getHyphenator();
+css::uno::Reference xBI = 
vcl::unohelper::CreateBreakIterator();
+
+auto[nBreakPos, nLineWidth]
+= aTextLayout.BreakLines(nTextWidth, sTestStr, xHyph, xBI, true, 
nTextWidth, 13, 12);
+
+const sal_Int32 nExpectedBreakPos = 13;
+CPPUNIT_ASSERT_EQUAL(nExpectedBreakPos, nBreakPos);
+}
+
+CPPUNIT_TEST_FIXTURE(VclTextLayoutTest, 
testBreakLin

core.git: vcl/CppunitTest_vcl_textlayout.mk vcl/inc vcl/Module_vcl.mk vcl/qa

2023-12-27 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_textlayout.mk |   64 ++
 vcl/Module_vcl.mk |1 
 vcl/inc/textlayout.hxx|4 +-
 vcl/qa/cppunit/text.cxx   |   15 
 vcl/qa/cppunit/textlayout.cxx |   58 ++
 5 files changed, 140 insertions(+), 2 deletions(-)

New commits:
commit 9157281deb81522bb02af73a08c4d7beed7aab75
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 01:02:41 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 28 02:12:38 2023 +0100

vcl: add test for an invalid index in OutputDevice::GetTextBreak()

Change-Id: I0b534e42e041972ad2f92e789fc757e949a33d4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158394
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/CppunitTest_vcl_textlayout.mk 
b/vcl/CppunitTest_vcl_textlayout.mk
new file mode 100644
index ..d7ac49a9e6df
--- /dev/null
+++ b/vcl/CppunitTest_vcl_textlayout.mk
@@ -0,0 +1,64 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_set_include,vcl_textlayout,\
+$$(INCLUDE) \
+-I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,vcl_textlayout, \
+   vcl/qa/cppunit/textlayout \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,vcl_textlayout,\
+   boost_headers \
+   harfbuzz \
+))
+
+ifeq ($(SYSTEM_ICU),TRUE)
+$(eval $(call gb_CppunitTest_use_externals,vcl_textlayout,\
+   icuuc \
+))
+else
+$(eval $(call gb_CppunitTest_use_externals,vcl_textlayout,\
+icu_headers \
+))
+endif
+
+$(eval $(call gb_CppunitTest_use_libraries,vcl_textlayout, \
+   comphelper \
+   cppu \
+   cppuhelper \
+   i18nlangtag \
+   sal \
+   svt \
+   test \
+   tl \
+   unotest \
+   vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_use_ure,vcl_textlayout))
+$(eval $(call gb_CppunitTest_use_vcl,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_use_components,vcl_textlayout,\
+   configmgr/source/configmgr \
+   i18npool/util/i18npool \
+   ucb/source/core/ucb1 \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,vcl_textlayout))
+
+$(eval $(call gb_CppunitTest_use_more_fonts,vcl_textlayout))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 19ab27106ad0..cc8667cad420 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -224,6 +224,7 @@ $(eval $(call gb_Module_add_check_targets,vcl,\
 CppunitTest_vcl_fontfeature \
 CppunitTest_vcl_fontmetric \
 CppunitTest_vcl_text \
+CppunitTest_vcl_textlayout \
 CppunitTest_vcl_filters_test \
 CppunitTest_vcl_mnemonic \
 CppunitTest_vcl_outdev \
diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index e90a7ec05858..58f3bb33469b 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -47,7 +47,7 @@ namespace vcl
 ~ITextLayout() COVERITY_NOEXCEPT_FALSE {}
 };
 
-class TextLayoutCommon : public ITextLayout
+class VCL_DLLPUBLIC TextLayoutCommon : public ITextLayout
 {
 public:
 OUString GetEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
@@ -75,7 +75,7 @@ namespace vcl
 /** is an implementation of the ITextLayout interface which simply 
delegates its calls to the respective
 methods of an OutputDevice instance, without any inbetween magic.
 */
-class DefaultTextLayout final : public TextLayoutCommon
+class VCL_DLLPUBLIC DefaultTextLayout final : public TextLayoutCommon
 {
 public:
 DefaultTextLayout( OutputDevice& _rTargetDevice )
diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index cabe502db462..371783759b65 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -719,6 +719,21 @@ CPPUNIT_TEST_FIXTURE(VclTextTest, 
testGetStringWithNewsEllpsis)
 device->GetEllipsisString(u"ab. cde. x y z"_ustr, 50, 
DrawTextFlags::NewsEllipsis));
 }
 
+CPPUNIT_TEST_FIXTURE(VclTextTest, testGetTextBreak_invalid_index)
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::WITHOUT_ALPHA);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+const OUString sTestStr(u"textline_ text_"_ustr);
+const auto nLen = sTestStr.getLength();
+const auto nTextWidth = device->GetTextWidth("text");
+const auto nInvalidIndex = sTestStr.getLength() + 2;
+
+CPPUNIT_ASSERT_EQUAL(st

core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

New commits:
commit 755ce3ae9f6c672cc3ac1596fce182cd2c6993db
Author: Chris Sherlock 
AuthorDate: Thu Oct 26 02:07:02 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:48:39 2023 +0100

vcl: remove out of sync comment - the code has since changed!

Change-Id: I4354d64671db697be4e4ea7c907bb13fa421e0df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158462
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 535e0c1c16f1..095c087d5377 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -245,10 +245,7 @@ namespace vcl
 return nBreakPos;
 
 // Whether hyphen or not: Put the word after the hyphen through
-// word boundary.
-
-// nMaxBreakPos the last char that fits into the line
-// nBreakPos is the word's start
+// the word boundary.
 
 // We run into a problem if the doc is so narrow, that a word
 // is broken into more than two lines ...
@@ -264,8 +261,6 @@ namespace vcl
 if ( ( nWordEnd < nSoftBreak ) || ( nWordLen <= 3 ) )
 return nBreakPos;
 
-// #104415# May happen, because getLineBreak may differ from 
getWordBoundary with DICTIONARY_WORD
-// SAL_WARN_IF( nWordEnd < nMaxBreakPos, "vcl", "Hyph: Break?" );
 OUString aWord = rStr.copy( nWordStart, nWordLen );
 sal_Int32 nMinTrail = nWordEnd-nSoftBreak+1;  //+1: Before the "broken 
off" char
 css::uno::Reference< css::linguistic2::XHyphenatedWord > xHyphWord;


core.git: vcl/inc vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |2 +-
 vcl/source/text/textlayout.cxx |   20 
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 144ac97827ddf770c5185549d6dba47f698b9807
Author: Chris Sherlock 
AuthorDate: Thu Oct 26 01:58:05 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:48:18 2023 +0100

vcl: BreakLinesWithIterator() is actually looking for the length of the 
string

Change-Id: Id4a6f56dfcbf87418b5be8404c4321a5611b0465
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158461
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index 53462d0cc1a2..e90a7ec05858 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -56,7 +56,7 @@ namespace vcl
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference const& 
xBI,
 const bool bHyphenate,
-const sal_Int32 nPos, sal_Int32 nBreakPos);
+const sal_Int32 nPos, const sal_Int32 nLen);
 
 sal_Int32 BreakLinesSimple(const tools::Long nWidth, OUString const& 
rStr,
   const sal_Int32 nPos, sal_Int32 nBreakPos, 
tools::Long& nLineWidth);
diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 8e2ddeb55875..535e0c1c16f1 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -222,22 +222,26 @@ namespace vcl
 css::uno::Reference< css::linguistic2::XHyphenator > 
const& xHyph,
 css::uno::Reference const& 
xBI,
 const bool bHyphenate,
-const sal_Int32 nPos, sal_Int32 nBreakPos)
+const sal_Int32 nPos, const sal_Int32 nLen)
 {
 const css::lang::Locale& 
rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
-sal_Int32 nSoftBreak = GetTextBreak( rStr, nWidth, nPos, nBreakPos - 
nPos );
+
+sal_Int32 nSoftBreak = GetTextBreak(rStr, nWidth, nPos, nLen - nPos);
 if (nSoftBreak == -1)
-{
 nSoftBreak = nPos;
-}
-SAL_WARN_IF( nSoftBreak >= nBreakPos, "vcl", "Break?!" );
+
+SAL_WARN_IF( nSoftBreak >= nLen, "vcl", "Break?!" );
+
 css::i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, 
css::uno::Sequence (), 1 );
 css::i18n::LineBreakUserOptions aUserOptions;
 css::i18n::LineBreakResults aLBR = xBI->getLineBreak( rStr, 
nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions );
-nBreakPos = aLBR.breakIndex;
-if ( nBreakPos <= nPos )
+
+sal_Int32 nBreakPos = aLBR.breakIndex;
+
+if (nBreakPos <= nPos)
 nBreakPos = nSoftBreak;
-if ( !bHyphenate )
+
+if (!bHyphenate)
 return nBreakPos;
 
 // Whether hyphen or not: Put the word after the hyphen through


core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 0db0662376dd9e89e1ad1e0a5764c69f94f9a059
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 06:15:37 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:45:05 2023 +0100

vcl: move bClipping closer to first use

Change-Id: Iad480c82cce99f14448588154bf96ae4ec5605f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158404
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index b6f90c6b972d..8e2ddeb55875 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -393,8 +393,6 @@ namespace vcl
 if (rStr.isEmpty())
 return 0;
 
-const bool bClipping = (nStyle & DrawTextFlags::Clip) && !(nStyle & 
DrawTextFlags::EndEllipsis);
-
 tools::Long nMaxLineWidth  = 0;
 const bool bHyphenate = (nStyle & DrawTextFlags::WordBreakHyphenation) 
== DrawTextFlags::WordBreakHyphenation;
 css::uno::Reference< css::linguistic2::XHyphenator > xHyph;
@@ -410,6 +408,7 @@ namespace vcl
 sal_Int32 nPos = 0;
 sal_Int32 nLen = rStr.getLength();
 sal_Int32 nCurrentTextY = 0;
+
 while ( nPos < nLen )
 {
 sal_Int32 nBreakPos = lcl_GetEndOfLine(rStr, nPos, nLen);
@@ -437,6 +436,7 @@ namespace vcl
 
 if ( nBreakPos == nPos )
 nBreakPos++;
+
 nPos = nBreakPos;
 
 if ( nPos < nLen && ( ( rStr[ nPos ] == '\r' ) || ( rStr[ nPos ] 
== '\n' ) ) )
@@ -447,6 +447,9 @@ namespace vcl
 nPos++;
 }
 nCurrentTextY += nTextHeight;
+
+const bool bClipping = (nStyle & DrawTextFlags::Clip) && !(nStyle 
& DrawTextFlags::EndEllipsis);
+
 if (bClipping && nCurrentTextY > rRect.GetHeight())
 break;
 }


core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

New commits:
commit 37bd1098fa0b2c5094aee0a48feff260b59681f3
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 05:18:43 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:44:29 2023 +0100

vcl: extract lcl_GetEndOfLine()

Change-Id: I2bc8750fc9ebfc4bc080020d744e2cf9fac75dce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158460
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 587060cb8690..b6f90c6b972d 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -365,6 +365,18 @@ namespace vcl
 {
 return ((nLineWidth > nWidth) && (nStyle & 
DrawTextFlags::WordBreak));
 }
+
+sal_Int32 lcl_GetEndOfLine(std::u16string_view rStr, const sal_Int32 
nPos, const sal_Int32 nLen)
+{
+sal_Int32 nBreakPos = nPos;
+
+while ((nBreakPos < nLen) && (rStr[nBreakPos] != '\r') && 
(rStr[nBreakPos] != '\n'))
+{
+nBreakPos++;
+}
+
+return nBreakPos;
+}
 }
 
 tools::Long TextLayoutCommon::GetTextLines(tools::Rectangle const& rRect, 
const tools::Long nTextHeight,
@@ -400,12 +412,8 @@ namespace vcl
 sal_Int32 nCurrentTextY = 0;
 while ( nPos < nLen )
 {
-sal_Int32 nBreakPos = nPos;
-
-while ( ( nBreakPos < nLen ) && ( rStr[ nBreakPos ] != '\r' ) && ( 
rStr[ nBreakPos ] != '\n' ) )
-nBreakPos++;
-
-tools::Long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos 
);
+sal_Int32 nBreakPos = lcl_GetEndOfLine(rStr, nPos, nLen);
+tools::Long nLineWidth = GetTextWidth(rStr, nPos, nBreakPos-nPos);
 
 if (lcl_ShouldBreakWord(nLineWidth, nWidth, nStyle))
 {


core.git: vcl/source

2023-12-12 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 5aad3b5d8c4da23e90869b70907c3e5c5883ceea
Author: Chris Sherlock 
AuthorDate: Wed Oct 25 05:12:06 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 12 10:43:39 2023 +0100

vcl: extract lcl_ShouldBreakWord()

Change-Id: Ib552ee59d23215d2c714c10b3ef1f7fc3e8a890f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158401
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 33232b6f0999..587060cb8690 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -359,6 +359,14 @@ namespace vcl
 return nBreakPos;
 }
 
+namespace
+{
+bool lcl_ShouldBreakWord(const sal_Int32 nLineWidth, const sal_Int32 
nWidth, const DrawTextFlags nStyle)
+{
+return ((nLineWidth > nWidth) && (nStyle & 
DrawTextFlags::WordBreak));
+}
+}
+
 tools::Long TextLayoutCommon::GetTextLines(tools::Rectangle const& rRect, 
const tools::Long nTextHeight,
ImplMultiTextLineInfo& 
rLineInfo,
tools::Long nWidth, OUString 
const& rStr,
@@ -398,12 +406,13 @@ namespace vcl
 nBreakPos++;
 
 tools::Long nLineWidth = GetTextWidth( rStr, nPos, nBreakPos-nPos 
);
-if ( ( nLineWidth > nWidth ) && ( nStyle & 
DrawTextFlags::WordBreak ) )
+
+if (lcl_ShouldBreakWord(nLineWidth, nWidth, nStyle))
 {
-if ( !xBI.is() )
+if (!xBI.is())
 xBI = vcl::unohelper::CreateBreakIterator();
 
-if ( xBI.is() )
+if (xBI.is())
 {
 nBreakPos = BreakLinesWithIterator(nWidth, rStr, xHyph, 
xBI, bHyphenate, nPos, nBreakPos);
 nLineWidth = GetTextWidth(rStr, nPos, nBreakPos - nPos);


core.git: vcl/source

2023-12-08 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/bitmap.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 29df1afa1f439bf44a6be1b04ec0190e8f40abe2
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 00:29:02 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Dec 8 11:49:31 2023 +0100

tdf#43157 vcl: remove DBG_ASSERT() from DrawDeviceAlphaBitmapSlowPath()

Change-Id: I6c120eb2bb8999276103f50bf3679366b6ee86ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157189
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index c6855909d312..86ac23137562 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -653,8 +653,8 @@ void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const 
Bitmap& rBitmap,
 BitmapScopedReadAccess pBitmapReadAccess(rBitmap);
 BitmapScopedReadAccess pAlphaReadAccess(rAlpha);
 
-DBG_ASSERT( pAlphaReadAccess->GetScanlineFormat() == 
ScanlineFormat::N8BitPal,
-"OutputDevice::ImplDrawAlpha(): non-8bit alpha no longer 
supported!" );
+SAL_WARN_IF(pAlphaReadAccess->GetScanlineFormat() != 
ScanlineFormat::N8BitPal, "vcl.gdi", "non-8bit alpha no longer supported!");
+assert(pAlphaReadAccess->GetScanlineFormat() == ScanlineFormat::N8BitPal);
 
 // #i38887# reading from screen may sometimes fail
 if (aBmp.ImplGetSalBitmap())


[Libreoffice-commits] core.git: vcl/qa

2023-12-05 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/complextext.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 9b5964cf5931d7c09e4fd624d68595891c2afb58
Author: Chris Sherlock 
AuthorDate: Tue Nov 14 02:13:17 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 5 14:23:50 2023 +0100

vcl: add unit test for cached glyphs based on tdf#103492

Change-Id: Id66be996053435c92b667eb142ae1e271ff33b90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159386
Tested-by: Jenkins
Tested-by: Tomaž Vajngerl 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index d4eb3db67093..37f4fbc0766c 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -191,6 +191,8 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testCaching)
 testCachedGlyphs( "test", "Dejavu Sans" );
 // This font does not have latin characters, will need fallback.
 testCachedGlyphs( "test", "Noto Kufi Arabic" );
+// see tdf#103492
+testCachedGlyphs( u"يوسف My name is"_ustr, "Liberation Sans");
 }
 
 static void testCachedGlyphsSubstring( const OUString& aText, const OUString& 
aFontName, bool rtl )


[Libreoffice-commits] core.git: include/vcl vcl/qa vcl/source

2023-12-04 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |2 ++
 vcl/qa/cppunit/complextext.cxx |   37 ++---
 vcl/source/outdev/font.cxx |   32 +++-
 vcl/source/outdev/outdev.cxx   |6 --
 4 files changed, 71 insertions(+), 6 deletions(-)

New commits:
commit 042dc4a9186f526b625817dde50bb2f5a91fd2c6
Author: Chris Sherlock 
AuthorDate: Thu Nov 9 18:19:41 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Tue Dec 5 04:39:05 2023 +0100

vcl: add unit tests for a mixture of CJK and latin characters

To influence the fallback fonts chosen, I have introduced a new
OutputDevice function ForceFallbackFont() which injects ("forces") a
font as the first one in the font fallback chain.

Change-Id: I05856cbe829fde0eb140bb48a37795a84d780900
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159221
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index bea1e00d9b7f..329364559108 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -184,6 +184,7 @@ private:
 mutable VclPtrmpNextGraphics; ///< Next output 
device in list
 GDIMetaFile*mpMetaFile;
 mutable rtl::Reference mpFontInstance;
+rtl::Reference mpForcedFallbackInstance;
 mutable std::unique_ptr  
mpFontFaceCollection;
 std::vectormaOutDevStateStack;
 std::unique_ptr mpOutDevData;
@@ -1165,6 +1166,7 @@ public:
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
 LogicalFontInstance const* GetFontInstance() const;
+bool ForceFallbackFont(vcl::Font const& rFallbackFont);
 
 protected:
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index 633dc2210e07..d4eb3db67093 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -491,6 +491,40 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf153440)
 #endif
 }
 
+CPPUNIT_TEST_FIXTURE(VclComplexTextTest, 
testMixedCJKLatinScript_glyph_advancements)
+{
+#if HAVE_MORE_FONTS
+#if !defined _WIN32
+OUString aTestScript(u"根据10.1(37BA) Eng"_ustr);
+
+ScopedVclPtrInstance pOutDev;
+// note you can only run this once and it was designed for tdf#107718
+bool bAdded = addFont(pOutDev, u"tdf107718.otf", u"Source Han Sans");
+CPPUNIT_ASSERT_EQUAL(true, bAdded);
+
+vcl::Font aFont(u"Source Han Sans"_ustr, u"Regular"_ustr, Size(0, 72));
+pOutDev->SetFont( aFont );
+
+vcl::Font aFallbackFont("DejaVu Sans", "Book", Size(0, 72));
+pOutDev->ForceFallbackFont(aFallbackFont);
+
+// absolute character widths AKA text array.
+tools::Long nRefTextWidth = 704;
+std::vector aRefCharWidths = { 72, 144, 190, 236, 259, 305, 
333, 379, 425, 474, 523, 551, 567, 612, 658, 704 };
+KernArray aCharWidths;
+tools::Long nTextWidth = pOutDev->GetTextArray(aTestScript, &aCharWidths);
+
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths, aCharWidths.get_subunit_array());
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
+
+// text advance width and line height
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aTestScript));
+CPPUNIT_ASSERT_EQUAL(tools::Long(105), pOutDev->GetTextHeight());
+#endif
+#endif
+}
+
 CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf107718)
 {
 #if !defined _WIN32 // TODO: Fails on jenkins but passes locally
@@ -498,9 +532,6 @@ CPPUNIT_TEST_FIXTURE(VclComplexTextTest, testTdf107718)
 
 ScopedVclPtrInstance pOutDev;
 
-bool bAdded = addFont(pOutDev, u"tdf107718.otf", u"Source Han Sans");
-CPPUNIT_ASSERT_EQUAL(true, bAdded);
-
 OUString aText(u"\u4E16\u1109\u1168\u11BC\u302E"_ustr);
 for (bool bVertical : { false, true })
 {
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index ea0727b294f9..0e37c7613ded 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -1020,6 +1020,22 @@ std::unique_ptr 
OutputDevice::getFallbackLayout(
 return pFallback;
 }
 
+bool OutputDevice::ForceFallbackFont(vcl::Font const& rFallbackFont)
+{
+vcl::Font aOldFont = GetFont();
+SetFont(rFallbackFont);
+InitFont();
+
+mpForcedFallbackInstance = mpFontInstance;
+SetFont(aOldFont);
+InitFont();
+
+if (mpForcedFallbackInstance)
+return true;
+
+return false;
+}
+
 std::unique_ptr OutputDevice::ImplGlyphFallbackLayout( 
std::unique_ptr pSalLayout,
 vcl::text::ImplLayoutArgs& rLayoutArgs, const SalLayoutGlyphs* pGlyphs ) 
const
 {
@@ -1051,12 +1067,22 @@ std::unique_ptr 
OutputDevice::ImplGlyphFallbackLayout( std::unique_pt
 vcl::font::FontSelectPattern 

[Libreoffice-commits] core.git: vcl/qa

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |   97 
 1 file changed, 97 insertions(+)

New commits:
commit 4a1fac7c703068a49df897bb635ff98bf22c0468
Author: Chris Sherlock 
AuthorDate: Wed Nov 8 14:21:47 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:24:59 2023 +0100

vcl: add unit tests for simple text 'AV' with kerning and no-kerning enabled

Change-Id: I72812c9fd83730daf62aeb4a300c548f153ee8a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159091
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index 59e079c963ce..b2e837a32c40 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -224,6 +224,103 @@ CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleText)
 CPPUNIT_ASSERT_DOUBLES_EQUAL(width36 / 2, width36pct50, 2);
 }
 
+CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleTextFontSpecificKerning)
+{
+OUString aAV(u"AV"_ustr);
+
+vcl::Font aFont("DejaVu Sans", "Book", Size(0, 2048));
+
+ScopedVclPtrInstance pOutDev;
+pOutDev->SetFont(aFont);
+
+// absolute character widths AKA text array.
+tools::Long nRefTextWidth = 2671;
+std::vector aRefCharWidths = { 1270, 2671 };
+KernArray aCharWidths;
+tools::Long nTextWidth = pOutDev->GetTextArray(aAV, &aCharWidths);
+
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], 
aCharWidths.get_subunit_array()[0]);
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], 
aCharWidths.get_subunit_array()[1]);
+// this sporadically returns 75 or 74 on some of the windows tinderboxes 
eg. tb73
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
+
+// text advance width and line height
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
+CPPUNIT_ASSERT_EQUAL(tools::Long(2384), pOutDev->GetTextHeight());
+
+// exact bounding rectangle, not essentially the same as text width/height
+tools::Rectangle aBoundRect;
+pOutDev->GetTextBoundRect(aBoundRect, aAV);
+CPPUNIT_ASSERT_EQUAL(tools::Long(16), aBoundRect.Left());
+CPPUNIT_ASSERT_EQUAL(tools::Long(408), aBoundRect.Top());
+CPPUNIT_ASSERT_EQUAL(tools::Long(2639), aBoundRect.GetWidth());
+CPPUNIT_ASSERT_EQUAL(tools::Long(1493), aBoundRect.getOpenHeight());
+
+// normal orientation
+tools::Rectangle aInput;
+tools::Rectangle aRect = pOutDev->GetTextRect(aInput, aAV);
+
+// now rotate 270 degrees
+vcl::Font aRotated(aFont);
+aRotated.SetOrientation(2700_deg10);
+pOutDev->SetFont(aRotated);
+tools::Rectangle aRectRot = pOutDev->GetTextRect(aInput, aAV);
+
+// Check that we did do the rotation...
+CPPUNIT_ASSERT_EQUAL(aRectRot.GetWidth(), aRect.GetHeight());
+CPPUNIT_ASSERT_EQUAL(aRectRot.GetHeight(), aRect.GetWidth());
+}
+
+CPPUNIT_TEST_FIXTURE(VclTextTest, testSimpleTextNoKerning)
+{
+OUString aAV(u"AV"_ustr);
+
+vcl::Font aFont("DejaVu Sans", "Book", Size(0, 2048));
+aFont.SetKerning(FontKerning::NONE);
+
+ScopedVclPtrInstance pOutDev;
+pOutDev->SetFont(aFont);
+
+// absolute character widths AKA text array.
+tools::Long nRefTextWidth = 2802;
+std::vector aRefCharWidths = { 1401, 2802 };
+KernArray aCharWidths;
+tools::Long nTextWidth = pOutDev->GetTextArray(aAV, &aCharWidths);
+
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[0], 
aCharWidths.get_subunit_array()[0]);
+CPPUNIT_ASSERT_EQUAL(aRefCharWidths[1], 
aCharWidths.get_subunit_array()[1]);
+// this sporadically returns 75 or 74 on some of the windows tinderboxes 
eg. tb73
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, nTextWidth);
+CPPUNIT_ASSERT_EQUAL(sal_Int32(nTextWidth), aCharWidths.back());
+
+// text advance width and line height
+CPPUNIT_ASSERT_EQUAL(nRefTextWidth, pOutDev->GetTextWidth(aAV));
+CPPUNIT_ASSERT_EQUAL(tools::Long(2384), pOutDev->GetTextHeight());
+
+// exact bounding rectangle, not essentially the same as text width/height
+tools::Rectangle aBoundRect;
+pOutDev->GetTextBoundRect(aBoundRect, aAV);
+CPPUNIT_ASSERT_EQUAL(tools::Long(16), aBoundRect.Left());
+CPPUNIT_ASSERT_EQUAL(tools::Long(408), aBoundRect.Top());
+CPPUNIT_ASSERT_EQUAL(tools::Long(2770), aBoundRect.GetWidth());
+CPPUNIT_ASSERT_EQUAL(tools::Long(1493), aBoundRect.getOpenHeight());
+
+// normal orientation
+tools::Rectangle aInput;
+tools::Rectangle aRect = pOutDev->GetTextRect(aInput, aAV);
+
+// now rotate 270 degrees
+vcl::Font aRotated(aFont);
+aRotated.SetOrientation(2700_deg10);
+pOutDev->SetFont(aRotated);
+tools::Rectangle aRectRot = pOutDev->GetTextRect(aInput, aAV);
+
+// Check that we did do the rotation...
+CPPUNIT_ASSERT_EQUAL(aRectRot.GetWidth(), aRect.GetHeight());
+CPPUNIT_ASSERT_EQUAL(aRectRot.Get

[Libreoffice-commits] core.git: vcl/source

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2195d87e62dae3465554be5a20a45b0a377845d2
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:54:26 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:23:09 2023 +0100

vcl: simplify warning message

Change-Id: Ie8ccf8bc5ba493987bebf38d8b1227c30bcd6e2d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158077
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index a9e219099191..33232b6f0999 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -254,7 +254,7 @@ namespace vcl
 css::i18n::Boundary aBoundary = xBI->getWordBoundary( rStr, nBreakPos, 
rDefLocale, css::i18n::WordType::DICTIONARY_WORD, true );
 sal_Int32 nWordStart = nPos;
 sal_Int32 nWordEnd = aBoundary.endPos;
-SAL_WARN_IF( nWordEnd <= nWordStart, "vcl", "ImpBreakLine: Start >= 
End?" );
+SAL_WARN_IF(nWordEnd <= nWordStart, "vcl", "Start >= End?");
 
 sal_Int32 nWordLen = nWordEnd - nWordStart;
 if ( ( nWordEnd < nSoftBreak ) || ( nWordLen <= 3 ) )


[Libreoffice-commits] core.git: vcl/source

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 72eaff7b6af01f3b6d9754660ce231e74d501466
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:39:01 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:21:38 2023 +0100

vcl: ImplIsCharIn() -> lcl_IsCharIn()

Change-Id: I61b24783e39e9f904c48c0726024cd5fa122b724
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158076
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index dd05d57f77c3..a9e219099191 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -30,7 +30,7 @@
 #include 
 #include 
 
-static bool ImplIsCharIn(sal_Unicode c, const char* pStr)
+static bool lcl_IsCharIn(sal_Unicode c, const char* pStr)
 {
 while ( *pStr )
 {
@@ -124,11 +124,11 @@ namespace vcl
 {
 nLastContent--;
 
-if (ImplIsCharIn(aStr[nLastContent], pSepChars))
+if (lcl_IsCharIn(aStr[nLastContent], pSepChars))
 break;
 }
 
-while (nLastContent && ImplIsCharIn(aStr[nLastContent-1], pSepChars))
+while (nLastContent && lcl_IsCharIn(aStr[nLastContent-1], pSepChars))
 {
 nLastContent--;
 }
@@ -143,11 +143,11 @@ namespace vcl
 while (nFirstContent < nLastContent)
 {
 nFirstContent++;
-if (ImplIsCharIn(aStr[nFirstContent], pSepChars))
+if (lcl_IsCharIn(aStr[nFirstContent], pSepChars))
 break;
 }
 
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nFirstContent], pSepChars))
+while ((nFirstContent < nLastContent) && 
lcl_IsCharIn(aStr[nFirstContent], pSepChars))
 {
 nFirstContent++;
 }
@@ -174,12 +174,12 @@ namespace vcl
 while (nFirstContent < nLastContent)
 {
 nLastContent--;
-if (ImplIsCharIn(aStr[nLastContent], pSepChars))
+if (lcl_IsCharIn(aStr[nLastContent], pSepChars))
 break;
 
 }
 
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nLastContent-1], pSepChars))
+while ((nFirstContent < nLastContent) && 
lcl_IsCharIn(aStr[nLastContent-1], pSepChars))
 {
 nLastContent--;
 }


[Libreoffice-commits] core.git: vcl/inc

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

New commits:
commit c0aacb30b73405f6d0213fcb85b53b6d0f0854d7
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:36:36 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:19:59 2023 +0100

tdf#124176 vcl: Use pragma once instead of include guards in 
inc/textlayout.hxx

Change-Id: Ie51fbc687002a6139dc98309cb7e1c39bb4de4a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158075
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index b5402cc63177..53462d0cc1a2 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -17,8 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_INC_TEXTLAYOUT_HXX
-#define INCLUDED_VCL_INC_TEXTLAYOUT_HXX
+#pragma once
 
 #include 
 #include 
@@ -141,6 +140,4 @@ namespace vcl
 
 } // namespace vcl
 
-#endif // INCLUDED_VCL_INC_TEXTLAYOUT_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: vcl/source

2023-11-18 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 696644462e1f3e43608319068db2bbc167e7b8f8
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:34:46 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 19 02:19:35 2023 +0100

vcl: remove unnecessary includes from textlayout.cxx

Change-Id: I4cef4b61c15cde5682b65590bebdc9981d38908c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158074
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 3b084a03115f..dd05d57f77c3 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -20,22 +20,16 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
-#include 
-#include 
 #include 
 #include 
 
 #include 
 #include 
 
-#include 
-#include 
-
 static bool ImplIsCharIn(sal_Unicode c, const char* pStr)
 {
 while ( *pStr )


Re: Testing CJK glyphs

2023-11-09 Thread Chris Sherlock


Sent from my iPhone

> On 9 Nov 2023, at 8:03 pm, Caolán McNamara  
> wrote:
> 
> On Thu, 2023-11-09 at 16:23 +1100, Chris Sherlock wrote:
>> Just a quick question - I want to write a unit test that checks the
>> glyph advancements for CJK glyphs. 
>> 
>> Specifically, I want to test the advancements of the following text:
>> 
>> 根据10.1(37BA) Eng
>> 
>> What font comes bundled with LibreOffice that I can use?
> 
> My understanding is that we don't bundle a CJK font. I think the best
> option is to follow the pattern of:
> https://git.libreoffice.org/core/commit/6b178c6e88ec5a765ad2b3ccd98182286222f550
> where you can see from the little font.readme how to make a small
> testing font with just the subset of glyphs you need from (an
> appropriately licensed) CJK font for the purposes of such a test.

Thanks Caolán, that’s very helpful. 
We seem to bundle Noto Sans in extras, but not the CJK variant. Is this 
something we could look at including?

Chris

Testing CJK glyphs

2023-11-08 Thread Chris Sherlock
Hi all, 

Just a quick question - I want to write a unit test that checks the glyph 
advancements for CJK glyphs. 

Specifically, I want to test the advancements of the following text:

根据10.1(37BA) Eng

What font comes bundled with LibreOffice that I can use?

Chris

[Libreoffice-commits] core.git: vcl/source

2023-11-05 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 383f666bcad27b2fbea6ac13a42cafd6f035fc5c
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:25:38 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 6 07:22:51 2023 +0100

tdf#43157 vcl: remove DBG_ASSERT() from BreakLinesWithIterator()

Change-Id: I2ab54966c8a8b5e5a15f78481330365725b6ef30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158073
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index 95e5d54a4b3c..3b084a03115f 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -17,6 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -26,14 +33,6 @@
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
 #include 
 #include 
 
@@ -523,7 +522,7 @@ namespace vcl
 m_rTargetDevice.Push( PushFlags::MAPMODE | PushFlags::FONT | 
PushFlags::TEXTLAYOUTMODE );
 
 MapMode aTargetMapMode( m_rTargetDevice.GetMapMode() );
-OSL_ENSURE( aTargetMapMode.GetOrigin() == Point(), 
"ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: uhm, the code below 
won't work here ..." );
+SAL_WARN_IF(aTargetMapMode.GetOrigin() != Point(), "vcl", "uhm, the 
code below won't work here ...");
 
 // normally, controls simulate "zoom" by "zooming" the font. This is 
responsible for (part of) the discrepancies
 // between text in Writer and text in controls in Writer, though both 
have the same font.
@@ -534,13 +533,11 @@ namespace vcl
 
 // also, use a higher-resolution map unit than "pixels", which should 
save us some rounding errors when
 // translating coordinates between the reference device and the target 
device.
-OSL_ENSURE( aTargetMapMode.GetMapUnit() == MapUnit::MapPixel,
-"ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: this class 
is not expected to work with such target devices!" );
+SAL_WARN_IF(aTargetMapMode.GetMapUnit() != MapUnit::MapPixel, "vcl", 
"this class is not expected to work with such target devices!");
 // we *could* adjust all the code in this class to handle this 
case, but at the moment, it's not necessary
 const MapUnit eTargetMapUnit = 
m_rReferenceDevice.GetMapMode().GetMapUnit();
 aTargetMapMode.SetMapUnit( eTargetMapUnit );
-OSL_ENSURE( aTargetMapMode.GetMapUnit() != MapUnit::MapPixel,
-"ReferenceDeviceTextLayout::ReferenceDeviceTextLayout: a reference 
device which has map mode PIXEL?!" );
+SAL_WARN_IF(aTargetMapMode.GetMapUnit() == MapUnit::MapPixel, "vcl", 
"a reference device which has map mode PIXEL?!");
 
 m_rTargetDevice.SetMapMode( aTargetMapMode );
 


[Libreoffice-commits] core.git: vcl/source

2023-11-05 Thread Chris Sherlock (via logerrit)
 vcl/source/text/textlayout.cxx |   97 +
 1 file changed, 42 insertions(+), 55 deletions(-)

New commits:
commit 183973ece62c0eefbd841dcf99f7fb8716f0fca1
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 18:06:59 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 6 07:21:23 2023 +0100

vcl: flatten TextLayoutHelper::GetNewsEllipsisString()

Change-Id: Ie94ce7c75ab96b8f7186f9f0c455dfa3a9f1683f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158072
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index db2226842d09..95e5d54a4b3c 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -144,76 +144,63 @@ namespace vcl
 OUString aTempLastStr1 = "..." + aLastStr;
 
 if (GetTextWidth(aTempLastStr1, 0, aTempLastStr1.getLength()) > 
nMaxWidth)
+return GetEllipsisString(aStr, nMaxWidth, 
DrawTextFlags::EndEllipsis);
+
+sal_Int32 nFirstContent = 0;
+while (nFirstContent < nLastContent)
+{
+nFirstContent++;
+if (ImplIsCharIn(aStr[nFirstContent], pSepChars))
+break;
+}
+
+while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nFirstContent], pSepChars))
 {
-aStr = GetEllipsisString(aStr, nMaxWidth, 
DrawTextFlags::EndEllipsis);
+nFirstContent++;
 }
-else
+
+if (nFirstContent >= nLastContent)
+return GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
+
+if (nFirstContent > 4)
+nFirstContent = 4;
+
+OUString aFirstStr = OUString::Concat(aStr.subView(0, nFirstContent)) 
+ "...";
+OUString aTempStr = aFirstStr + aLastStr;
+
+if (GetTextWidth(aTempStr, 0, aTempStr.getLength() ) > nMaxWidth)
+return GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
+
+do
 {
-sal_Int32 nFirstContent = 0;
+aStr = aTempStr;
+
+if (nLastContent > aStr.getLength())
+nLastContent = aStr.getLength();
+
 while (nFirstContent < nLastContent)
 {
-nFirstContent++;
-if (ImplIsCharIn( aStr[nFirstContent], pSepChars))
+nLastContent--;
+if (ImplIsCharIn(aStr[nLastContent], pSepChars))
 break;
-}
 
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nFirstContent], pSepChars))
-{
-nFirstContent++;
 }
 
-// MEM continue here
-if (nFirstContent >= nLastContent)
+while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nLastContent-1], pSepChars))
 {
-aStr = GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
+nLastContent--;
 }
-else
-{
-if (nFirstContent > 4)
-nFirstContent = 4;
 
-OUString aFirstStr = OUString::Concat(aStr.subView(0, 
nFirstContent)) + "...";
-OUString aTempStr = aFirstStr + aLastStr;
+if (nFirstContent < nLastContent)
+{
+std::u16string_view aTempLastStr = aStr.subView(nLastContent);
+aTempStr = aFirstStr + aTempLastStr;
 
-if (GetTextWidth(aTempStr, 0, aTempStr.getLength() ) > 
nMaxWidth)
-{
-aStr = GetEllipsisString(aStr, nMaxWidth, nStyle | 
DrawTextFlags::EndEllipsis);
-}
-else
-{
-do
-{
-aStr = aTempStr;
-
-if (nLastContent > aStr.getLength())
-nLastContent = aStr.getLength();
-
-while (nFirstContent < nLastContent)
-{
-nLastContent--;
-if (ImplIsCharIn(aStr[nLastContent], pSepChars))
-break;
-
-}
-
-while ((nFirstContent < nLastContent) && 
ImplIsCharIn(aStr[nLastContent-1], pSepChars))
-{
-nLastContent--;
-}
-
-if (nFirstContent < nLastContent)
-{
-std::u16string_view aTempLastStr = 
aStr.subView(nLastContent);
-aTempStr = aFirstStr + aTempLastStr;
-
-if (GetTextWidth(aTempStr, 0, 
aTempStr.getLength()) > nMaxWidth)
-  

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

2023-11-05 Thread Chris Sherlock (via logerrit)
 vcl/inc/textlayout.hxx |5 
 vcl/source/text/textlayout.cxx |  226 +++--
 2 files changed, 135 insertions(+), 96 deletions(-)

New commits:
commit 5886a6faad298cb42fdb4ceb52120bfc569c6e14
Author: Chris Sherlock 
AuthorDate: Tue Oct 17 17:53:10 2023 +1100
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 6 07:20:28 2023 +0100

vcl: split out functions from TextLayoutCommon::GetEllipsisString()

Change-Id: Ifced331b65e27a02d9a3b3e220e22c279c6fc496
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158071
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx
index ee9eb9e39266..b5402cc63177 100644
--- a/vcl/inc/textlayout.hxx
+++ b/vcl/inc/textlayout.hxx
@@ -66,6 +66,11 @@ namespace vcl
  ImplMultiTextLineInfo& rLineInfo,
  tools::Long nWidth, OUString const& rStr,
  DrawTextFlags nStyle);
+
+private:
+OUString GetCenterEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex, tools::Long nMaxWidth);
+OUString GetEndEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex, tools::Long nMaxWidth, bool bClipText);
+OUString GetNewsEllipsisString(OUString const& rOrigStr, tools::Long 
nMaxWidth, DrawTextFlags nStyle);
 };
 
 /** is an implementation of the ITextLayout interface which simply 
delegates its calls to the respective
diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx
index a1597c69793e..db2226842d09 100644
--- a/vcl/source/text/textlayout.cxx
+++ b/vcl/source/text/textlayout.cxx
@@ -69,134 +69,148 @@ void ImplMultiTextLineInfo::Clear()
 
 namespace vcl
 {
+OUString TextLayoutCommon::GetCenterEllipsisString(OUString const& 
rOrigStr, sal_Int32 nIndex, tools::Long nMaxWidth)
+{
+OUStringBuffer aTmpStr(rOrigStr);
 
-OUString TextLayoutCommon::GetEllipsisString(OUString const& rOrigStr, 
tools::Long nMaxWidth, DrawTextFlags nStyle)
+// speed it up by removing all but 1.33x as many as the break pos.
+sal_Int32 nEraseChars = std::max(4, rOrigStr.getLength() - 
(nIndex*4)/3);
+while(nEraseChars < rOrigStr.getLength() && 
GetTextWidth(aTmpStr.toString(), 0, aTmpStr.getLength()) > nMaxWidth)
+{
+aTmpStr = rOrigStr;
+sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
+aTmpStr.remove(i, nEraseChars++);
+aTmpStr.insert(i, "...");
+}
+
+return aTmpStr.makeStringAndClear();
+}
+
+OUString TextLayoutCommon::GetEndEllipsisString(OUString const& rOrigStr, 
sal_Int32 nIndex, tools::Long nMaxWidth, bool bClipText)
 {
 OUString aStr = rOrigStr;
-sal_Int32 nIndex = GetTextBreak( aStr, nMaxWidth, 0, aStr.getLength() 
);
-
-if (nIndex == -1)
-return aStr;
+aStr = aStr.copy(0, nIndex);
 
-if( (nStyle & DrawTextFlags::CenterEllipsis) == 
DrawTextFlags::CenterEllipsis )
+if (nIndex > 1)
 {
-OUStringBuffer aTmpStr( aStr );
-// speed it up by removing all but 1.33x as many as the break pos.
-sal_Int32 nEraseChars = std::max(4, aStr.getLength() - 
(nIndex*4)/3);
-while( nEraseChars < aStr.getLength() && GetTextWidth( 
aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
+aStr += "...";
+while (!aStr.isEmpty() && (GetTextWidth(aStr, 0, aStr.getLength()) 
> nMaxWidth))
 {
-aTmpStr = aStr;
-sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
-aTmpStr.remove(i, nEraseChars++);
-aTmpStr.insert(i, "...");
+if ((nIndex > 1) || (nIndex == aStr.getLength()))
+nIndex--;
+
+aStr = aStr.replaceAt(nIndex, 1, u"");
 }
-aStr = aTmpStr.makeStringAndClear();
 }
-else if ( nStyle & DrawTextFlags::EndEllipsis )
+
+if (aStr.isEmpty() && bClipText)
+aStr += OUStringChar(rOrigStr[0]);
+
+return aStr;
+}
+
+namespace
+{
+OUString lcl_GetPathEllipsisString(OUString const& rOrigStr, sal_Int32 
nIndex)
 {
-aStr = aStr.copy(0, nIndex);
-if ( nIndex > 1 )
-{
-aStr += "...";
-while ( !aStr.isEmpty() && ( GetTextWidth( aStr, 0, 
aStr.getLength() ) > nMaxWidth) )
-{
-if ( (nIndex > 1) || (nIndex == aStr.getLength()) )
-nIndex--;
-aStr = aStr.replaceAt( nIndex, 1, u"");
-}
-}
+OUString aPath(rOrigStr

[Libreoffice-commits] core.git: vcl/source

2023-10-26 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/bitmap.cxx |   64 ++-
 1 file changed, 28 insertions(+), 36 deletions(-)

New commits:
commit 4a6492e155d44ef51fc9a89271f857a6f987182e
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 00:42:07 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:52:56 2023 +0200

vcl: flatten OutputDevice::BlendBitmap()

Change-Id: Idb0c21dd37af81fae0fd4152f0556edb20e63b80
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157190
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index d95c97e8633c..1806635593d2 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -909,8 +909,6 @@ Bitmap OutputDevice::BlendBitmap(
 if( !pP || !pA )
 return aBmp;
 
-Bitmap  res;
-
 if( GetBitCount() <= 8 )
 {
 Bitmap aDither(aBmp.GetSizePixel(), vcl::PixelFormat::N8_BPP);
@@ -949,53 +947,47 @@ Bitmap OutputDevice::BlendBitmap(
 
 pB.reset();
 pW.reset();
-res = aDither;
+return aDither;
 }
-else
+
+BitmapScopedWriteAccess pB(aBmp);
+
+bool bFastBlend = false;
+if (!bHMirr && !bVMirr)
 {
-BitmapScopedWriteAccess pB(aBmp);
+SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), aBmpRect.GetWidth(), 
aBmpRect.GetHeight(),
+nOffX, nOffY, aOutSz.Width(), aOutSz.Height());
 
-bool bFastBlend = false;
-if( !bHMirr && !bVMirr )
+bFastBlend = ImplFastBitmapBlending(*pB, *pP, *pA, aTR);
+}
+
+if (!bFastBlend)
+{
+for (int nY = 0; nY < nDstHeight; nY++)
 {
-SalTwoRect aTR(aBmpRect.Left(), aBmpRect.Top(), 
aBmpRect.GetWidth(), aBmpRect.GetHeight(),
-nOffX, nOffY, aOutSz.Width(), aOutSz.Height());
+tools::Long  nMapY = pMapY[nY];
 
-bFastBlend = ImplFastBitmapBlending( *pB,*pP,*pA, aTR );
-}
+if (bVMirr)
+nMapY = aBmpRect.Bottom() - nMapY;
 
-if( !bFastBlend )
-{
-for( int nY = 0; nY < nDstHeight; nY++ )
+Scanline pAScan = pA->GetScanline(nMapY);
+Scanline pBScan = pB->GetScanline(nY);
+for(int nX = 0; nX < nDstWidth; nX++)
 {
-tools::Long  nMapY = pMapY[ nY ];
+tools::Long nMapX = pMapX[nX];
 
-if ( bVMirr )
-{
-nMapY = aBmpRect.Bottom() - nMapY;
-}
-Scanline pAScan = pA->GetScanline( nMapY );
-Scanline pBScan = pB->GetScanline(nY);
-for( int nX = 0; nX < nDstWidth; nX++ )
-{
-tools::Long nMapX = pMapX[ nX ];
+if (bHMirr)
+nMapX = aBmpRect.Right() - nMapX;
 
-if ( bHMirr )
-{
-nMapX = aBmpRect.Right() - nMapX;
-}
-BitmapColor aDstCol = pB->GetPixelFromData( pBScan, nX );
-aDstCol.Merge( pP->GetColor( nMapY, nMapX ), pAScan[ nMapX 
] );
-pB->SetPixelOnData( pBScan, nX, aDstCol );
-}
+BitmapColor aDstCol = pB->GetPixelFromData(pBScan, nX);
+aDstCol.Merge(pP->GetColor(nMapY, nMapX), pAScan[nMapX]);
+pB->SetPixelOnData(pBScan, nX, aDstCol);
 }
 }
-
-pB.reset();
-res = aBmp;
 }
 
-return res;
+pB.reset();
+return aBmp;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: vcl/source

2023-10-26 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/bitmapex.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d35236adb3fc561f49134a88c7468411527ee3d5
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 00:58:17 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:50:44 2023 +0200

vcl: flatten OutputDevice::GetBitmapEx()

Change-Id: I85e7767cd2665febd289cc1fd023d30ab80cfe5d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157191
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx
index e849f4b73181..b4fa9641a1e5 100644
--- a/vcl/source/outdev/bitmapex.cxx
+++ b/vcl/source/outdev/bitmapex.cxx
@@ -160,8 +160,8 @@ BitmapEx OutputDevice::GetBitmapEx( const Point& rSrcPt, 
const Size& rSize ) con
 
 return BitmapEx(GetBitmap( rSrcPt, rSize ), AlphaMask( aAlphaBitmap ) 
);
 }
-else
-return BitmapEx(GetBitmap( rSrcPt, rSize ));
+
+return BitmapEx(GetBitmap( rSrcPt, rSize ));
 }
 
 void OutputDevice::DrawDeviceBitmapEx( const Point& rDestPt, const Size& 
rDestSize,


[Libreoffice-commits] core.git: solenv/clang-format vcl/Library_vcl.mk vcl/source

2023-10-26 Thread Chris Sherlock (via logerrit)
 solenv/clang-format/excludelist |2 +-
 vcl/Library_vcl.mk  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 60abfe9e514d71a14b388f0156b31a4be5896686
Author: Chris Sherlock 
AuthorDate: Sat Sep 30 12:08:32 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:49:53 2023 +0200

vcl: move textlayout.cxx from gdi to text directory

Change-Id: Ia8efd1d984c94b4fa6d77759fa8c8ec8834ac140
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157415
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 0b81e5a560d5..5e334c0cbcfd 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14764,7 +14764,6 @@ vcl/source/gdi/salgdilayout.cxx
 vcl/source/gdi/sallayout.cxx
 vcl/source/gdi/salmisc.cxx
 vcl/source/gdi/scrptrun.cxx
-vcl/source/gdi/textlayout.cxx
 vcl/source/gdi/vectorgraphicdata.cxx
 vcl/source/gdi/virdev.cxx
 vcl/source/gdi/wall.cxx
@@ -14817,6 +14816,7 @@ vcl/source/outdev/transparent.cxx
 vcl/source/outdev/vclreferencebase.cxx
 vcl/source/outdev/wallpaper.cxx
 vcl/source/text/ImplLayoutRuns.cxx
+vcl/source/text/textlayout.cxx
 vcl/source/toolkit/group.cxx
 vcl/source/toolkit/morebtn.cxx
 vcl/source/treelist/headbar.cxx
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index e15b54c4e918..4c8162459835 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -244,6 +244,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/outdev/map \
 vcl/source/text/ImplLayoutArgs \
 vcl/source/text/TextLayoutCache \
+vcl/source/text/textlayout \
 vcl/source/treelist/headbar \
 vcl/source/treelist/iconview \
 vcl/source/treelist/iconviewimpl \
@@ -303,7 +304,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/gdi/sallayout \
 vcl/source/gdi/salmisc \
 vcl/source/gdi/vectorgraphicdata \
-vcl/source/gdi/textlayout \
 vcl/source/gdi/virdev \
 vcl/source/gdi/wall \
 vcl/source/gdi/scrptrun \
diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/text/textlayout.cxx
similarity index 100%
rename from vcl/source/gdi/textlayout.cxx
rename to vcl/source/text/textlayout.cxx


[Libreoffice-commits] core.git: vcl/source

2023-10-26 Thread Chris Sherlock (via logerrit)
 vcl/source/gdi/textlayout.cxx |  182 ++
 1 file changed, 96 insertions(+), 86 deletions(-)

New commits:
commit adba3022f14d28090a668da10fc3311633535ae8
Author: Chris Sherlock 
AuthorDate: Thu Sep 28 21:14:15 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 27 05:48:33 2023 +0200

vcl: flatten TextLayoutCommon::GetEllipsisString()

Change-Id: I04a5eed7a6fbd2d4c7f31006c73729cf79a2ed02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157367
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/gdi/textlayout.cxx b/vcl/source/gdi/textlayout.cxx
index 2eaf5746f30b..a1597c69793e 100644
--- a/vcl/source/gdi/textlayout.cxx
+++ b/vcl/source/gdi/textlayout.cxx
@@ -75,117 +75,127 @@ namespace vcl
 OUString aStr = rOrigStr;
 sal_Int32 nIndex = GetTextBreak( aStr, nMaxWidth, 0, aStr.getLength() 
);
 
-if ( nIndex != -1 )
+if (nIndex == -1)
+return aStr;
+
+if( (nStyle & DrawTextFlags::CenterEllipsis) == 
DrawTextFlags::CenterEllipsis )
 {
-if( (nStyle & DrawTextFlags::CenterEllipsis) == 
DrawTextFlags::CenterEllipsis )
+OUStringBuffer aTmpStr( aStr );
+// speed it up by removing all but 1.33x as many as the break pos.
+sal_Int32 nEraseChars = std::max(4, aStr.getLength() - 
(nIndex*4)/3);
+while( nEraseChars < aStr.getLength() && GetTextWidth( 
aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
 {
-OUStringBuffer aTmpStr( aStr );
-// speed it up by removing all but 1.33x as many as the break 
pos.
-sal_Int32 nEraseChars = std::max(4, 
aStr.getLength() - (nIndex*4)/3);
-while( nEraseChars < aStr.getLength() && GetTextWidth( 
aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
-{
-aTmpStr = aStr;
-sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
-aTmpStr.remove(i, nEraseChars++);
-aTmpStr.insert(i, "...");
-}
-aStr = aTmpStr.makeStringAndClear();
+aTmpStr = aStr;
+sal_Int32 i = (aTmpStr.getLength() - nEraseChars)/2;
+aTmpStr.remove(i, nEraseChars++);
+aTmpStr.insert(i, "...");
 }
-else if ( nStyle & DrawTextFlags::EndEllipsis )
+aStr = aTmpStr.makeStringAndClear();
+}
+else if ( nStyle & DrawTextFlags::EndEllipsis )
+{
+aStr = aStr.copy(0, nIndex);
+if ( nIndex > 1 )
 {
-aStr = aStr.copy(0, nIndex);
-if ( nIndex > 1 )
+aStr += "...";
+while ( !aStr.isEmpty() && ( GetTextWidth( aStr, 0, 
aStr.getLength() ) > nMaxWidth) )
 {
-aStr += "...";
-while ( !aStr.isEmpty() && ( GetTextWidth( aStr, 0, 
aStr.getLength() ) > nMaxWidth) )
-{
-if ( (nIndex > 1) || (nIndex == aStr.getLength()) )
-nIndex--;
-aStr = aStr.replaceAt( nIndex, 1, u"");
-}
+if ( (nIndex > 1) || (nIndex == aStr.getLength()) )
+nIndex--;
+aStr = aStr.replaceAt( nIndex, 1, u"");
 }
+}
 
-if ( aStr.isEmpty() && (nStyle & DrawTextFlags::Clip) )
-aStr += OUStringChar(rOrigStr[ 0 ]);
+if ( aStr.isEmpty() && (nStyle & DrawTextFlags::Clip) )
+aStr += OUStringChar(rOrigStr[ 0 ]);
+}
+else if ( nStyle & DrawTextFlags::PathEllipsis )
+{
+OUString aPath( rOrigStr );
+OUString aAbbreviatedPath;
+osl_abbreviateSystemPath( aPath.pData, &aAbbreviatedPath.pData, 
nIndex, nullptr );
+aStr = aAbbreviatedPath;
+}
+else if ( nStyle & DrawTextFlags::NewsEllipsis )
+{
+static char const   pSepChars[] = ".";
+// Determine last section
+sal_Int32 nLastContent = aStr.getLength();
+while ( nLastContent )
+{
+nLastContent--;
+if ( ImplIsCharIn( aStr[ nLastContent ], pSepChars ) )
+break;
 }
-else if ( nStyle & DrawTextFlags::PathEllipsis )
+while ( nLastContent &&
+ImplIsCharIn( aStr[ nLastContent-1 ], pSepChars ) )
+nLastContent--;
+
+OUString aLastStr = aStr.copy(nLastContent);
+OUString aTempLastStr1 = 

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

2023-10-23 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx|   23 --
 include/vcl/window.hxx|2 
 vcl/inc/textlayout.hxx|   26 ++
 vcl/source/gdi/pdfwriter_impl.cxx |2 
 vcl/source/gdi/textlayout.cxx |  396 ++-
 vcl/source/outdev/text.cxx|  427 +-
 vcl/source/window/window3.cxx |2 
 7 files changed, 442 insertions(+), 436 deletions(-)

New commits:
commit 41e00b105f004b75451e24043dc85af703c91dd3
Author: Chris Sherlock 
AuthorDate: Mon Sep 25 00:24:32 2023 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 23 09:42:11 2023 +0200

vcl: migrate text layout functions out of OutputDevice

OutputDevice is not where text layout should be done. There are a number
of text layout functions that are used across the text layout classes,
so I have moved them into TextLayoutHelper and made the text layout
classes rely on this. I have made TextLayoutHelper implement the
ITextLayout interface because this is still useful to new classes that
need to implement new text layout functionality.

Change-Id: Ic137a938576e7a6a64db0e5780bbbdd8342ef421
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157362
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4a6d217c2cb6..bea1e00d9b7f 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -102,7 +102,7 @@ class SalLayoutGlyphs;
 namespace vcl
 {
 class ExtOutDevData;
-class ITextLayout;
+class TextLayoutCommon;
 struct FontCapabilities;
 class Window;
 class WindowOutputDevice;
@@ -869,11 +869,11 @@ public:
 voidDrawText( const tools::Rectangle& rRect,
   const OUString& rStr, DrawTextFlags 
nStyle = DrawTextFlags::NONE,
   std::vector< tools::Rectangle >* 
pVector = nullptr, OUString* pDisplayText = nullptr,
-  vcl::ITextLayout* _pTextLayout = 
nullptr );
+  vcl::TextLayoutCommon* _pTextLayout 
= nullptr );
 
 static void ImplDrawText( OutputDevice& rTargetDevice, 
const tools::Rectangle& rRect,
   const OUString& rOrigStr, 
DrawTextFlags nStyle,
-  std::vector< tools::Rectangle >* 
pVector, OUString* pDisplayText, vcl::ITextLayout& _rLayout );
+  std::vector< tools::Rectangle >* 
pVector, OUString* pDisplayText, vcl::TextLayoutCommon& _rLayout );
 
 voidImplDrawText( SalLayout& );
 
@@ -904,7 +904,7 @@ public:
 tools::Rectangle   GetTextRect( const tools::Rectangle& 
rRect,
  const OUString& rStr, 
DrawTextFlags nStyle = DrawTextFlags::WordBreak,
  TextRectInfo* pInfo = nullptr,
- const vcl::ITextLayout* 
_pTextLayout = nullptr ) const;
+ const vcl::TextLayoutCommon* 
_pTextLayout = nullptr ) const;
 
 /** Return the exact bounding rectangle of rStr.
 
@@ -1073,17 +1073,6 @@ public:
 protected:
 SAL_DLLPRIVATE void ImplInitTextLineSize();
 SAL_DLLPRIVATE void ImplInitAboveTextLineSize();
-static
-SAL_DLLPRIVATE tools::Long  ImplGetTextLines( const tools::Rectangle& 
rRect, tools::Long nTextHeight, ImplMultiTextLineInfo& rLineInfo, tools::Long 
nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& 
_rLayout );
-static
-SAL_DLLPRIVATE sal_Int32ImplBreakLinesWithIterator(const tools::Long 
nWidth, const OUString& rStr, const vcl::ITextLayout& _rLayout,
-const 
css::uno::Reference& xHyph,
-const 
css::uno::Reference& xBI,
-const bool bHyphenate,
-const sal_Int32 nPos, sal_Int32 nBreakPos);
-static
-SAL_DLLPRIVATE sal_Int32ImplBreakLinesSimple( const tools::Long 
nWidth, const OUString& rStr,
-const vcl::ITextLayout& _rLayout, const 
sal_Int32 nPos, sal_Int32 nBreakPos, tools::Long& nLineWidth );
 SAL_DLLPRIVATE floatapproximate_char_width() const;
 
 virtual bool shouldDrawWavePixelAsRect(tools::Long nLineWidth) const;
@@ -1200,10 +1189,6 @@ private:
 
 SAL_DLLPRIVATE static void  ImplUpdateFontDataForAllFrames( 
FontUpdateHandler_t pHdl, bool bNewFontLists );
 
-static
-SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OUString& rStr,
-   

Re: Windows and 256 color displays

2023-10-10 Thread Chris Sherlock


Sent from my iPhone

> On 11 Sep 2023, at 12:45 pm, Thorsten Behrens  wrote:
> 
> Ilmari Lauhakangas wrote:
>>> On 9.9.2023 3.35, Chris Sherlock wrote:
>>> If not, we could remove a huge chunk of dithering code in
>>> ImplInitSalGDI() and vastly simplify multiplatform support.
>> 
>> Win 7 popularity relative to other Win versions is crashing finally, being
>> 3.5% now, which *is* roughly the same that Win XP was in early 2018 when
>> LibreOffice removed support for it and Vista.
>> 
> Sounds like a good plan then. Also since 24.2 will be considered a
> very visible major upgrade.
> 
> But note that there's a chunk of dither & bitmap code to retain for
> paletted images, that we still want to load & save.
> 
> Cheers,
> 
> -- Thorsten

Sorry for the massive delay in responding. So when we drop support for Windows 
7, it looks like we can revisit this code. Does this sound reasonable?

Chris

Re: Consolidating text layout code

2023-10-10 Thread Chris Sherlock
Just a polite ping to the mailing list, is anyone able to review?

Chris

Sent from my iPhone

> On 7 Oct 2023, at 8:47 pm, Chris Sherlock  wrote:
> 
> Hi all,
> 
> I have migrated text layout code from OutputDevice and into a 
> TextLayoutHelper class. This is because OutputDevice’s primary purpose is not 
> working out text layout, and in fact this is what we are attempting to do 
> with the ITextLayout interface.
> 
> Can anyone have a look at https://gerrit.libreoffice.org/c/core/+/157362 for 
> review? 
> 
> Thanks all!
> Chris
> Sent from my iPhone


Consolidating text layout code

2023-10-07 Thread Chris Sherlock
Hi all,

I have migrated text layout code from OutputDevice and into a TextLayoutHelper 
class. This is because OutputDevice’s primary purpose is not working out text 
layout, and in fact this is what we are attempting to do with the ITextLayout 
interface.

Can anyone have a look at https://gerrit.libreoffice.org/c/core/+/157362 for 
review? 

Thanks all!
Chris
Sent from my iPhone

[Libreoffice-commits] core.git: include/vcl vcl/source

2023-09-27 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |2 +-
 vcl/source/outdev/text.cxx |   14 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 47c4d0fbdc681287f2fd9f5240ca1ce7a960ec18
Author: Chris Sherlock 
AuthorDate: Sun Sep 24 02:52:32 2023 +1000
Commit: Noel Grandin 
CommitDate: Wed Sep 27 16:55:10 2023 +0200

vcl: remove rTargetDevice from OutputDevice::ImplGetEllipsisString()

Change-Id: I886510af06bbfb77e24ea004cc3abfd6ff3a8832
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157194
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f2fdf7ab7db7..9b9a80af0fc9 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1201,7 +1201,7 @@ private:
 SAL_DLLPRIVATE static void  ImplUpdateFontDataForAllFrames( 
FontUpdateHandler_t pHdl, bool bNewFontLists );
 
 static
-SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OutputDevice& 
rTargetDevice, const OUString& rStr,
+SAL_DLLPRIVATE OUString ImplGetEllipsisString( const OUString& rStr,
tools::Long nMaxWidth, 
DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout );
 
 SAL_DLLPRIVATE void ImplDrawEmphasisMark( tools::Long nBaseX, 
tools::Long nX, tools::Long nY, const tools::PolyPolygon& rPolyPoly, bool 
bPolyLine, const tools::Rectangle& rRect1, const tools::Rectangle& rRect2 );
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index d5509650900a..6e9aacbb4567 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1641,7 +1641,7 @@ void OutputDevice::ImplDrawText( OutputDevice& 
rTargetDevice, const tools::Recta
 aLastLineBuffer[ i ] = ' ';
 }
 aLastLine = aLastLineBuffer.makeStringAndClear();
-aLastLine = ImplGetEllipsisString( rTargetDevice, 
aLastLine, nWidth, nStyle, _rLayout );
+aLastLine = ImplGetEllipsisString( aLastLine, nWidth, 
nStyle, _rLayout );
 nStyle &= ~DrawTextFlags(DrawTextFlags::VCenter | 
DrawTextFlags::Bottom);
 nStyle |= DrawTextFlags::Top;
 }
@@ -1728,7 +1728,7 @@ void OutputDevice::ImplDrawText( OutputDevice& 
rTargetDevice, const tools::Recta
 {
 if ( nStyle & TEXT_DRAW_ELLIPSIS )
 {
-aStr = ImplGetEllipsisString( rTargetDevice, aStr, nWidth, 
nStyle, _rLayout );
+aStr = ImplGetEllipsisString( aStr, nWidth, nStyle, _rLayout );
 nStyle &= ~DrawTextFlags(DrawTextFlags::Center | 
DrawTextFlags::Right);
 nStyle |= DrawTextFlags::Left;
 nTextWidth = _rLayout.GetTextWidth( aStr, 0, aStr.getLength() 
);
@@ -2018,10 +2018,10 @@ OUString OutputDevice::GetEllipsisString( const 
OUString& rOrigStr, tools::Long
 DrawTextFlags nStyle ) const
 {
 vcl::DefaultTextLayout aTextLayout( *const_cast< OutputDevice* >( this ) );
-return ImplGetEllipsisString( *this, rOrigStr, nMaxWidth, nStyle, 
aTextLayout );
+return ImplGetEllipsisString( rOrigStr, nMaxWidth, nStyle, aTextLayout );
 }
 
-OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& 
rTargetDevice, const OUString& rOrigStr, tools::Long nMaxWidth,
+OUString OutputDevice::ImplGetEllipsisString( const OUString& rOrigStr, 
tools::Long nMaxWidth,
DrawTextFlags nStyle, const 
vcl::ITextLayout& _rLayout )
 {
 OUString aStr = rOrigStr;
@@ -2085,7 +2085,7 @@ OUString OutputDevice::ImplGetEllipsisString( const 
OutputDevice& rTargetDevice,
 OUString aLastStr = aStr.copy(nLastContent);
 OUString aTempLastStr1 = "..." + aLastStr;
 if ( _rLayout.GetTextWidth( aTempLastStr1, 0, 
aTempLastStr1.getLength() ) > nMaxWidth )
-aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, 
aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
+aStr = OutputDevice::ImplGetEllipsisString( aStr, nMaxWidth, 
nStyle | DrawTextFlags::EndEllipsis, _rLayout );
 else
 {
 sal_Int32 nFirstContent = 0;
@@ -2100,7 +2100,7 @@ OUString OutputDevice::ImplGetEllipsisString( const 
OutputDevice& rTargetDevice,
 nFirstContent++;
 // MEM continue here
 if ( nFirstContent >= nLastContent )
-aStr = OutputDevice::ImplGetEllipsisString( rTargetDevice, 
aStr, nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
+aStr = OutputDevice::ImplGetEllipsisString( aStr, 
nMaxWidth, nStyle | DrawTextFlags::EndEllipsis, _rLayout );
 else
 {
   

Windows and 256 color displays

2023-09-08 Thread Chris Sherlock
Do we still support Windows on a 256 color display?

If not, we could remove a huge chunk of dithering code in ImplInitSalGDI() and 
vastly simplify multiplatform support.

Chris

Sent from my iPhone

[Libreoffice-commits] core.git: vcl/source

2022-11-30 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/clipping.cxx   |4 +---
 vcl/source/outdev/curvedshapes.cxx   |6 ++
 vcl/source/outdev/gradient.cxx   |9 -
 vcl/source/outdev/hatch.cxx  |7 ++-
 vcl/source/outdev/map.cxx|6 +++---
 vcl/source/outdev/mask.cxx   |6 ++
 vcl/source/outdev/nativecontrols.cxx |   13 ++---
 vcl/source/outdev/outdev.cxx |   11 +--
 vcl/source/outdev/pixel.cxx  |6 ++
 vcl/source/outdev/polygon.cxx|   10 --
 vcl/source/outdev/polyline.cxx   |8 +++-
 vcl/source/outdev/rect.cxx   |7 +++
 vcl/source/outdev/stack.cxx  |1 -
 vcl/source/outdev/text.cxx   |   20 ++--
 vcl/source/outdev/textline.cxx   |   19 ---
 15 files changed, 55 insertions(+), 78 deletions(-)

New commits:
commit 1a5d548b96d86ad7ca04c2b23dc18517a538a998
Author: Chris Sherlock 
AuthorDate: Sun Nov 27 03:06:22 2022 +1100
Commit: Tomaž Vajngerl 
CommitDate: Thu Dec 1 05:01:12 2022 +0100

vcl: remove unnecessary includes

Change-Id: I41cb0b38857ddeef7cb7f82c1b523a9c7fcf2413
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143324
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx
index 0570719a15fa..ad45b08e1f87 100644
--- a/vcl/source/outdev/clipping.cxx
+++ b/vcl/source/outdev/clipping.cxx
@@ -19,12 +19,10 @@
 
 #include 
 #include 
-
 #include 
+
 #include 
 #include 
-#include 
-#include 
 
 #include 
 
diff --git a/vcl/source/outdev/curvedshapes.cxx 
b/vcl/source/outdev/curvedshapes.cxx
index de7379dd32bb..b5a13fb721d9 100644
--- a/vcl/source/outdev/curvedshapes.cxx
+++ b/vcl/source/outdev/curvedshapes.cxx
@@ -17,15 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
 #include 
-#include 
 #include 
 
 #include 
 
+#include 
+
 void OutputDevice::DrawEllipse( const tools::Rectangle& rRect )
 {
 assert(!is_double_buffered_window());
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 707ca47d960a..5a60184abfff 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -17,20 +17,19 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
-
 #include 
-#include 
+
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 
+#include 
+#include 
+
 #define GRADIENT_DEFAULT_STEPCOUNT  0
 
 void OutputDevice::DrawGradient( const tools::Rectangle& rRect,
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 3b92f6df5de9..0fc755864a5d 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -17,24 +17,21 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-#include 
-
 #include 
 #include 
 #include 
-
 #include 
 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
+#include 
+#include 
 #include 
 
 #define HATCH_MAXPOINTS 1024
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 85b5512a4416..67414cb2976c 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -19,16 +19,16 @@
 
 #include 
 
+#include 
+#include 
 #include 
 #include 
+
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx
index c1c3e3b018f5..004b248785b5 100644
--- a/vcl/source/outdev/mask.cxx
+++ b/vcl/source/outdev/mask.cxx
@@ -17,16 +17,14 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
 #include 
-#include 
 #include 
 
 #include 
 #include 
 
+#include 
+
 void OutputDevice::DrawMask( const Point& rDestPt,
  const Bitmap& rBitmap, const Color& rMaskColor )
 {
diff --git a/vcl/source/outdev/nativecontrols.cxx 
b/vcl/source/outdev/nativecontrols.cxx
index a8557259adc7..cee9408d6cfb 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -17,18 +17,17 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
-#include 
-#include 
-#include 
 #include 
-#include 
 
-#include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
+#include 
+
+#include 
 
 ImplControlValue::~ImplControlValue()
 {
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index ab677b468f73..b4c1eac4499e 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -18,19 +18,18 @@
  */
 
 #include 
-#include 
 
+#include 
+#include 
 #include 
-#include 
+
 #include 
+#include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/vcl/sourc

[Libreoffice-commits] core.git: vcl/source

2022-11-28 Thread Chris Sherlock (via logerrit)
 vcl/source/outdev/map.cxx |   48 +-
 1 file changed, 18 insertions(+), 30 deletions(-)

New commits:
commit 845dd688e5032c83db889cbf2ca033144dd1de32
Author: Chris Sherlock 
AuthorDate: Sun Nov 27 02:35:42 2022 +1100
Commit: Noel Grandin 
CommitDate: Mon Nov 28 11:12:12 2022 +0100

tdf#123419 vcl: remove unneeded ImplMakeFraction() in map.cxx

Change-Id: Iedb33bca9ee1119baafb92a3191960be41ccaffc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143323
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx
index 02221c345862..85b5512a4416 100644
--- a/vcl/source/outdev/map.cxx
+++ b/vcl/source/outdev/map.cxx
@@ -37,16 +37,6 @@
 #include 
 #include 
 
-/*
-Reduces accuracy until it is a fraction (should become
-ctor fraction once); we could also do this with BigInts
-*/
-
-static Fraction ImplMakeFraction( tools::Long nN1, tools::Long nN2, 
tools::Long nD1, tools::Long nD2 )
-{
-return Fraction::MakeFraction(nN1, nN2, nD1, nD2);
-}
-
 static auto setMapRes(ImplMapRes& rMapRes, const o3tl::Length eUnit)
 {
 const auto [nNum, nDen] = o3tl::getConversionMulDiv(eUnit, 
o3tl::Length::in);
@@ -178,11 +168,11 @@ static void ImplCalcMapResolution( const MapMode& 
rMapMode,
 
 // calculate scaling factor according to MapMode
 // aTemp? = rMapRes.mnMapSc? * aScale?
-Fraction aTempX = ImplMakeFraction( rMapRes.mnMapScNumX,
+Fraction aTempX = Fraction::MakeFraction( rMapRes.mnMapScNumX,
 aScaleX.GetNumerator(),
 rMapRes.mnMapScDenomX,
 aScaleX.GetDenominator() );
-Fraction aTempY = ImplMakeFraction( rMapRes.mnMapScNumY,
+Fraction aTempY = Fraction::MakeFraction( rMapRes.mnMapScNumY,
 aScaleY.GetNumerator(),
 rMapRes.mnMapScDenomY,
 aScaleY.GetDenominator() );
@@ -699,24 +689,22 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode 
)
 }
 
 // set new MapMode
-if ( bRelMap )
+if (bRelMap)
 {
-Point aOrigin( maMapRes.mnMapOfsX, maMapRes.mnMapOfsY );
-// aScale? = maMapMode.GetScale?() * rNewMapMode.GetScale?()
-Fraction aScaleX = ImplMakeFraction( 
maMapMode.GetScaleX().GetNumerator(),
- 
rNewMapMode.GetScaleX().GetNumerator(),
- 
maMapMode.GetScaleX().GetDenominator(),
- 
rNewMapMode.GetScaleX().GetDenominator() );
-Fraction aScaleY = ImplMakeFraction( 
maMapMode.GetScaleY().GetNumerator(),
- 
rNewMapMode.GetScaleY().GetNumerator(),
- 
maMapMode.GetScaleY().GetDenominator(),
- 
rNewMapMode.GetScaleY().GetDenominator() );
-maMapMode.SetOrigin( aOrigin );
-maMapMode.SetScaleX( aScaleX );
-maMapMode.SetScaleY( aScaleY );
+maMapMode.SetScaleX(Fraction::MakeFraction(
+maMapMode.GetScaleX().GetNumerator(), 
rNewMapMode.GetScaleX().GetNumerator(),
+maMapMode.GetScaleX().GetDenominator(), 
rNewMapMode.GetScaleX().GetDenominator()));
+
+maMapMode.SetScaleY(Fraction::MakeFraction(
+maMapMode.GetScaleY().GetNumerator(), 
rNewMapMode.GetScaleY().GetNumerator(),
+maMapMode.GetScaleY().GetDenominator(), 
rNewMapMode.GetScaleY().GetDenominator()));
+
+maMapMode.SetOrigin(Point(maMapRes.mnMapOfsX, maMapRes.mnMapOfsY));
 }
 else
+{
 maMapMode = rNewMapMode;
+}
 
 // create new objects (clip region are not re-scaled)
 mbNewFont   = true;
@@ -753,11 +741,11 @@ void OutputDevice::SetRelativeMapMode( const MapMode& 
rNewMapMode )
 MapUnit eNew = rNewMapMode.GetMapUnit();
 
 // a?F = rNewMapMode.GetScale?() / maMapMode.GetScale?()
-Fraction aXF = ImplMakeFraction( rNewMapMode.GetScaleX().GetNumerator(),
+Fraction aXF = Fraction::MakeFraction( 
rNewMapMode.GetScaleX().GetNumerator(),
  maMapMode.GetScaleX().GetDenominator(),
  rNewMapMode.GetScaleX().GetDenominator(),
  maMapMode.GetScaleX().GetNumerator() );
-Fraction aYF = ImplMakeFraction( rNewMapMode.GetScaleY().GetNumerator(),
+Fraction aYF = Fraction::MakeFraction( 
rNewMapMode.GetScaleY().GetNumerator(),
  maMapMode.GetScaleY().GetDenominator(),
  rNewMapMode.GetScaleY().GetDenominator(),
  maMapMode.GetScaleY().GetNumerator() );
@@ -781,9 +769,9 @@ void OutputDevice::SetRelativeMapMod

[Libreoffice-commits] core.git: vcl/CppunitTest_vcl_font.mk vcl/qa

2022-11-27 Thread Chris Sherlock (via logerrit)
 vcl/CppunitTest_vcl_font.mk|5 ++
 vcl/qa/cppunit/logicalfontinstance.cxx |   64 +
 2 files changed, 69 insertions(+)

New commits:
commit a22047f148c45d34c5ce08d2d9011237287b673f
Author: Chris Sherlock 
AuthorDate: Wed Oct 19 11:20:19 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 27 10:40:17 2022 +0100

vcl: test getting glyph boundary rect from LogicalFontInstance

MacOS produces a slightly different glyph height.

Quoting from Khaled in dev IRC:

"Currently GetGlyphBoundRect() calls different platform-specific
implementations on each platform, so even with the same font it is
possible to get some difference. So my suggestion is to use a large font
size and allow for some fuzziness".

Consequently I'm using a 110pt font, and taking into account some
fuzziness.

Change-Id: I0dace6bfa0d1f4e6f3b8852e957d2d518d37795b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143322
Tested-by: Jenkins
Reviewed-by: خالد حسني 
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/CppunitTest_vcl_font.mk b/vcl/CppunitTest_vcl_font.mk
index 891352508a1c..813ab1c9c009 100644
--- a/vcl/CppunitTest_vcl_font.mk
+++ b/vcl/CppunitTest_vcl_font.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_font, \
vcl/qa/cppunit/physicalfontfacecollection \
vcl/qa/cppunit/physicalfontfamily \
vcl/qa/cppunit/physicalfontcollection \
+   vcl/qa/cppunit/logicalfontinstance \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,vcl_font,\
@@ -56,4 +57,8 @@ $(eval $(call gb_CppunitTest_use_components,vcl_font,\
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_font))
 
+$(eval $(call gb_CppunitTest_use_more_fonts,vcl_font))
+
+$(eval $(call gb_CppunitTest_set_non_application_font_use,vcl_font,abort))
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/qa/cppunit/logicalfontinstance.cxx 
b/vcl/qa/cppunit/logicalfontinstance.cxx
new file mode 100644
index ..2a7a5c83ac27
--- /dev/null
+++ b/vcl/qa/cppunit/logicalfontinstance.cxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+class VclLogicalFontInstanceTest : public test::BootstrapFixture
+{
+public:
+VclLogicalFontInstanceTest()
+: BootstrapFixture(true, false)
+{
+}
+
+void testglyphboundrect();
+
+CPPUNIT_TEST_SUITE(VclLogicalFontInstanceTest);
+CPPUNIT_TEST(testglyphboundrect);
+
+CPPUNIT_TEST_SUITE_END();
+};
+
+void VclLogicalFontInstanceTest::testglyphboundrect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 110)));
+
+const LogicalFontInstance* pFontInstance = device->GetFontInstance();
+
+tools::Rectangle aBoundRect;
+const auto LATIN_SMALL_LETTER_B = 0x0062;
+
pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(LATIN_SMALL_LETTER_B),
 aBoundRect,
+ false);
+
+const tools::Long nExpectedX = 7;
+const tools::Long nExpectedY = -80;
+
+CPPUNIT_ASSERT_EQUAL_MESSAGE("x of glyph is wrong", nExpectedX, 
aBoundRect.getX());
+CPPUNIT_ASSERT_EQUAL_MESSAGE("y of glyph is wrong", nExpectedY, 
aBoundRect.getY());
+CPPUNIT_ASSERT_MESSAGE("height of glyph of wrong",
+   aBoundRect.GetWidth() == 50 || 
aBoundRect.GetWidth() == 51);
+CPPUNIT_ASSERT_MESSAGE("width of glyph of wrong",
+   aBoundRect.GetHeight() == 82 || 
aBoundRect.GetHeight() == 83);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VclLogicalFontInstanceTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: include/vcl Repository.mk vcl/Executable_listglyphs.mk vcl/Module_vcl.mk vcl/workben

2022-11-25 Thread Chris Sherlock (via logerrit)
 Repository.mk|1 
 include/vcl/outdev.hxx   |2 
 vcl/Executable_listglyphs.mk |   41 +++
 vcl/Module_vcl.mk|1 
 vcl/workben/listglyphs.cxx   |  231 +++
 5 files changed, 275 insertions(+), 1 deletion(-)

New commits:
commit 42da7674685c1a82fd655f19c2665030f41d5929
Author: Chris Sherlock 
AuthorDate: Wed Oct 19 21:32:49 2022 +1100
Commit: Michael Stahl 
CommitDate: Fri Nov 25 14:04:20 2022 +0100

vcl: list the glyphs and bound rects of a specified font

Change-Id: Ia635d83a5d3dd257948777e9f6976fecfeb4ee98
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141526
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/Repository.mk b/Repository.mk
index 35c7a8e25295..15a75405ee23 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -81,6 +81,7 @@ $(eval $(call gb_Helper_register_executables,NONE, \
mtfdemo \
visualbackendtest \
listfonts \
+   listglyphs \
$(if $(and $(ENABLE_GTK3), $(filter LINUX %BSD SOLARIS,$(OS))), 
gtktiledviewer) \
$(if $(and $(ENABLE_GTKTILEDVIEWER), $(filter WNT,$(OS))), 
gtktiledviewer) \
 $(if $(filter EMSCRIPTEN,$(OS)),wasm-qt5-mandelbrot) \
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 14c1675e7eed..39bf4f667164 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1176,7 +1176,7 @@ public:
 //If bNewFontLists is true then drop and refetch lists of system fonts
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
-SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
+LogicalFontInstance const* GetFontInstance() const;
 
 protected:
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
diff --git a/vcl/Executable_listglyphs.mk b/vcl/Executable_listglyphs.mk
new file mode 100644
index ..acd1fd9b00c1
--- /dev/null
+++ b/vcl/Executable_listglyphs.mk
@@ -0,0 +1,41 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Executable_Executable,listglyphs))
+
+$(eval $(call gb_Executable_use_api,listglyphs,\
+offapi \
+udkapi \
+))
+
+$(eval $(call gb_Executable_set_include,listglyphs,\
+$$(INCLUDE) \
+-I$(SRCDIR)/vcl/inc \
+))
+
+$(eval $(call gb_Executable_use_externals,listglyphs,\
+   harfbuzz \
+   graphite \
+))
+
+$(eval $(call gb_Executable_use_libraries,listglyphs,\
+tl \
+sal \
+vcl \
+cppu \
+cppuhelper \
+comphelper \
+i18nlangtag \
+))
+
+$(eval $(call gb_Executable_add_exception_objects,listglyphs,\
+vcl/workben/listglyphs \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk
index 81f28dcfdd68..596ed5b8c03a 100644
--- a/vcl/Module_vcl.mk
+++ b/vcl/Module_vcl.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
 Executable_fftester \
 Executable_svptest \
 Executable_listfonts \
+Executable_listglyphs \
 Executable_svpclient) \
 ))
 
diff --git a/vcl/workben/listglyphs.cxx b/vcl/workben/listglyphs.cxx
new file mode 100644
index ..def2ff818122
--- /dev/null
+++ b/vcl/workben/listglyphs.cxx
@@ -0,0 +1,231 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+namespace
+{
+class ListGlyphsWin : public WorkWindow
+{
+public:
+explicit ListGlyphsWin()
+: WorkWindow(nullptr, WB_HIDE)
+{
+}
+};
+
+class ListGlyphs : public Application
+{
+public:
+virtual int Main() override;
+
+private:
+static void showHelp()
+{
+std::cerr << "Usage: listglyphs --help |  FILE\n";
+std::cerr << "Lists the current glyphs in a font installed on the 
system.\n";
+std::cerr << "If outputting to stdout, use -- for FILE.\n";
+std::exit(0);
+}
+
+void Init() override;
+void DeInit() override;
+
+css::uno::Reference xServiceManager;
+bool mbStdOut = false;
+OUString maFilename;
+OUString maFontname;
+};
+
+int ListGlyphs::Main()

[Libreoffice-commits] core.git: vcl/qa

2022-11-20 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |  102 
 1 file changed, 102 insertions(+)

New commits:
commit e535da3b6d72c0aca312dcf1ca38a3fcc3532a38
Author: Chris Sherlock 
AuthorDate: Sun Oct 2 19:11:11 2022 +1100
Commit: خالد حسني 
CommitDate: Sun Nov 20 16:25:25 2022 +0100

vcl: add unit tests for OutputDevice::GetTextRect()

Change-Id: Ic36d42b0b38083c6a9ce3b6af4d80d5acf3e96e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140906
Tested-by: Jenkins
Reviewed-by: خالد حسني 

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index a450c99ee3df..ee7ab8cd5859 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -66,6 +66,13 @@ public:
 void testGetStringWithEndEllpsis();
 void testGetStringWithNewsEllpsis();
 void testGetTextBreak();
+void testGetSingleLineTextRect();
+void testGetSingleLineTextRectWithEndEllipsis();
+void testGetRightBottomAlignedSingleLineTextRect();
+void testGetMultiLineTextRect();
+void testGetMultiLineTextRectWithEndEllipsis();
+void testGetRightBottomAlignedMultiLineTextRect();
+void testGetRotatedSingleLineTextRect();
 
 CPPUNIT_TEST_SUITE(VclTextTest);
 CPPUNIT_TEST(testSimpleText);
@@ -82,6 +89,13 @@ public:
 CPPUNIT_TEST(testGetStringWithEndEllpsis);
 CPPUNIT_TEST(testGetStringWithNewsEllpsis);
 CPPUNIT_TEST(testGetTextBreak);
+CPPUNIT_TEST(testGetSingleLineTextRect);
+CPPUNIT_TEST(testGetSingleLineTextRectWithEndEllipsis);
+CPPUNIT_TEST(testGetRightBottomAlignedSingleLineTextRect);
+CPPUNIT_TEST(testGetMultiLineTextRect);
+CPPUNIT_TEST(testGetMultiLineTextRectWithEndEllipsis);
+CPPUNIT_TEST(testGetRightBottomAlignedMultiLineTextRect);
+CPPUNIT_TEST(testGetRotatedSingleLineTextRect);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -671,6 +685,94 @@ void VclTextTest::testGetTextBreak()
  device->GetTextBreak(sTestStr, nTextWidth, 13, nLen));
 }
 
+void VclTextTest::testGetSingleLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(
+tools::Rectangle(Point(), Size(75, 12)),
+device->GetTextRect(tools::Rectangle(Point(), Point(100, 100)), "This 
is test text"));
+}
+
+void VclTextTest::testGetSingleLineTextRectWithEndEllipsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(
+tools::Rectangle(Point(), Size(52, 12)),
+device->GetTextRect(tools::Rectangle(Point(), Point(50, 50)), "This is 
test text",
+DrawTextFlags::WordBreak | 
DrawTextFlags::EndEllipsis));
+}
+
+void VclTextTest::testGetRightBottomAlignedSingleLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(926, 989), Size(75, 12)),
+ device->GetTextRect(tools::Rectangle(Point(), 
Point(1000, 1000)),
+ "This is test text",
+ DrawTextFlags::Right | 
DrawTextFlags::Bottom));
+}
+
+void VclTextTest::testGetRotatedSingleLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+vcl::Font aFont(device->GetFont());
+aFont.SetOrientation(45_deg10);
+device->SetFont(aFont);
+
+CPPUNIT_ASSERT_EQUAL(
+tools::Rectangle(Point(0, -3), Size(75, 18)),
+device->GetTextRect(tools::Rectangle(Point(), Point(100, 100)), "This 
is test text"));
+}
+
+void VclTextTest::testGetMultiLineTextRect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(), Size(75, 12)),
+ device->GetTextRect(tools::Rectangle(Point(), 
Point(100, 100)),
+ "This is test text",
+ DrawTextFlags::WordBreak | 
DrawTextFlags::MultiLine));
+}
+
+void VclTextTest::testGetMultiLineTextRectWithEndEllipsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("

[Libreoffice-commits] core.git: include/vcl vcl/CppunitTest_vcl_font.mk vcl/qa

2022-11-17 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |2 -
 vcl/CppunitTest_vcl_font.mk|5 ++
 vcl/qa/cppunit/logicalfontinstance.cxx |   59 +
 3 files changed, 65 insertions(+), 1 deletion(-)

New commits:
commit 0cef06f0a2c0963e8c1579b78975710e6af4471c
Author: Chris Sherlock 
AuthorDate: Wed Oct 19 11:20:19 2022 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Nov 18 07:40:46 2022 +0100

vcl: test getting glyph boundary rect from LogicalFontInstance

MacOS produces a slightly different glyph height.

Quoting from Khaled in dev IRC:

"Currently GetGlyphBoundRect() calls different platform-specific
implementations on each platform, so even with the same font it is
possible to get some difference. So my suggestion is to use a large font
size and allow for some fuzziness".

Consequently I'm using a 110pt font.

Change-Id: I939e633eb1e45a16171ad0675216246b31966454
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141234
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 14c1675e7eed..b4fdd82e1ab9 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1176,7 +1176,7 @@ public:
 //If bNewFontLists is true then drop and refetch lists of system fonts
 SAL_DLLPRIVATE static void  ImplUpdateAllFontData( bool bNewFontLists );
 
-SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
+const LogicalFontInstance* GetFontInstance() const;
 
 protected:
 SAL_DLLPRIVATE tools::Long GetEmphasisAscent() const { return 
mnEmphasisAscent; }
diff --git a/vcl/CppunitTest_vcl_font.mk b/vcl/CppunitTest_vcl_font.mk
index 891352508a1c..813ab1c9c009 100644
--- a/vcl/CppunitTest_vcl_font.mk
+++ b/vcl/CppunitTest_vcl_font.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_font, \
vcl/qa/cppunit/physicalfontfacecollection \
vcl/qa/cppunit/physicalfontfamily \
vcl/qa/cppunit/physicalfontcollection \
+   vcl/qa/cppunit/logicalfontinstance \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,vcl_font,\
@@ -56,4 +57,8 @@ $(eval $(call gb_CppunitTest_use_components,vcl_font,\
 
 $(eval $(call gb_CppunitTest_use_configuration,vcl_font))
 
+$(eval $(call gb_CppunitTest_use_more_fonts,vcl_font))
+
+$(eval $(call gb_CppunitTest_set_non_application_font_use,vcl_font,abort))
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/qa/cppunit/logicalfontinstance.cxx 
b/vcl/qa/cppunit/logicalfontinstance.cxx
new file mode 100644
index ..56b9897f0589
--- /dev/null
+++ b/vcl/qa/cppunit/logicalfontinstance.cxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+class VclLogicalFontInstanceTest : public test::BootstrapFixture
+{
+public:
+VclLogicalFontInstanceTest()
+: BootstrapFixture(true, false)
+{
+}
+
+void testglyphboundrect();
+
+CPPUNIT_TEST_SUITE(VclLogicalFontInstanceTest);
+CPPUNIT_TEST(testglyphboundrect);
+
+CPPUNIT_TEST_SUITE_END();
+};
+
+void VclLogicalFontInstanceTest::testglyphboundrect()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("Liberation Sans", Size(0, 110)));
+
+const LogicalFontInstance* pFontInstance = device->GetFontInstance();
+
+tools::Rectangle aBoundRect;
+const auto LATIN_SMALL_LETTER_B = 0x0062;
+
pFontInstance->GetGlyphBoundRect(pFontInstance->GetGlyphIndex(LATIN_SMALL_LETTER_B),
 aBoundRect,
+ false);
+#ifdef MACOSX
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(7, -80), Size(51, 83)), 
aBoundRect);
+#else
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(Point(7, -80), Size(51, 82)), 
aBoundRect);
+#endif
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VclLogicalFontInstanceTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */


[Libreoffice-commits] core.git: include/vcl vcl/source

2022-11-13 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |2 ++
 vcl/source/animate/Animation.cxx  |   35 ---
 2 files changed, 22 insertions(+), 15 deletions(-)

New commits:
commit 5ccba00d2007d664b9ffd0f956323a8180cb8e66
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:57:41 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 13 14:04:02 2022 +0100

vcl: extract functions AllRenderersPaused() and PruneMarkedRenderers()

Change-Id: I0fc55e829e22b81a076f2b66d78bb2b90abdfc41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136413
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 307fed73c222..11bb3c894058 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -113,6 +113,8 @@ private:
 SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
 SAL_DLLPRIVATE void PopulateRenderers();
 SAL_DLLPRIVATE void RenderNextFrameInAllRenderers();
+SAL_DLLPRIVATE void PruneMarkedRenderers();
+SAL_DLLPRIVATE bool IsAnyRendererActive();
 
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index e1bd5ba042fc..5d4a208a6b30 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -361,6 +361,24 @@ void Animation::RenderNextFrameInAllRenderers()
 ImplRestartTimer(pCurrentFrameBmp->mnWait);
 }
 
+void Animation::PruneMarkedRenderers()
+{
+// delete all unmarked views
+auto removeStart = std::remove_if(maRenderers.begin(), maRenderers.end(),
+  [](const auto& pRenderer) { return 
!pRenderer->isMarked(); });
+maRenderers.erase(removeStart, maRenderers.cend());
+
+// reset marked state
+std::for_each(maRenderers.cbegin(), maRenderers.cend(),
+  [](const auto& pRenderer) { pRenderer->setMarked(false); });
+}
+
+bool Animation::IsAnyRendererActive()
+{
+return std::any_of(maRenderers.cbegin(), maRenderers.cend(),
+   [](const auto& pRenderer) { return 
!pRenderer->isPaused(); });
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -373,21 +391,8 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 maNotifyLink.Call(this);
 PopulateRenderers();
-
-// delete all unmarked views
-auto removeStart
-= std::remove_if(maRenderers.begin(), maRenderers.end(),
- [](const auto& pRenderer) { return 
!pRenderer->isMarked(); });
-maRenderers.erase(removeStart, maRenderers.cend());
-
-// check if every remaining view is paused
-bIsAnyRendererActive
-= std::any_of(maRenderers.cbegin(), maRenderers.cend(),
-  [](const auto& pRenderer) { return 
!pRenderer->isPaused(); });
-
-// reset marked state
-std::for_each(maRenderers.cbegin(), maRenderers.cend(),
-  [](const auto& pRenderer) { 
pRenderer->setMarked(false); });
+PruneMarkedRenderers();
+bIsAnyRendererActive = IsAnyRendererActive();
 }
 
 if (maRenderers.empty())


[Libreoffice-commits] core.git: vcl/source

2022-11-13 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit d773da0c083b4ee1cf12bd7846cbdbe37ed8
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:44:56 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Sun Nov 13 13:43:50 2022 +0100

vcl: small optimization determining if any renderers are active

Currently we look at every renderer to see if it is paused. However, you
can think of this differently - instead of using a universal quantifier
we can actually use an existential quantifier - if even one renderer is
not paused, then we can say that not every renderer is paused - thus no
global pause. Hence switch to any_of(), which stops the loop at the
first instance of a non-paused renderer.

Change-Id: I3b35bc41e86432374e4bc5fae0a2927ec8cc2309
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136412
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index c6547f9e7852..e1bd5ba042fc 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -367,7 +367,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (nAnimCount)
 {
-bool bGlobalPause = false;
+bool bIsAnyRendererActive = true;
 
 if (maNotifyLink.IsSet())
 {
@@ -381,8 +381,9 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 maRenderers.erase(removeStart, maRenderers.cend());
 
 // check if every remaining view is paused
-bGlobalPause = std::all_of(maRenderers.cbegin(), 
maRenderers.cend(),
-   [](const auto& pRenderer) { return 
pRenderer->isPaused(); });
+bIsAnyRendererActive
+= std::any_of(maRenderers.cbegin(), maRenderers.cend(),
+  [](const auto& pRenderer) { return 
!pRenderer->isPaused(); });
 
 // reset marked state
 std::for_each(maRenderers.cbegin(), maRenderers.cend(),
@@ -391,13 +392,15 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (maRenderers.empty())
 Stop();
-else if (bGlobalPause)
+else if (!bIsAnyRendererActive)
 ImplRestartTimer(10);
 else
 RenderNextFrameInAllRenderers();
 }
 else
+{
 Stop();
+}
 }
 
 bool Animation::Insert(const AnimationFrame& rStepBmp)


Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-11-06 Thread Chris Sherlock
On Sun, Oct 30, 2022 at 2:26 AM Chris Sherlock 
wrote:

>
>
> Sent from my iPhone
>
> On 23 Oct 2022, at 5:20 am, Caolán McNamara  wrote:
>
> On Sat, 2022-10-22 at 01:42 +1100, Chris Sherlock wrote:
>
> Test name: VclLogicalFontInstanceTest::testglyphboundrect
>
> equality assertion failed
>
> - Expected: 51x82@(7,-80)
>
> - Actual  : 51x83@(7,-80)
>
>
> I’ve had another look at the code, with some help from Khaled. The
>
> issue is the way in which we do our final rounding.
>
>
> On Freetype, it uses 26.6 fixed point, and thus needs it’s own
>
> special FreeType ceil and floor functions. CoreText appears to using
>
> floating point, but the std::ceil and std::floor functions give
>
> slight different results.
>
>
> I presume that for mac its CoreTextStyle::ImplGetGlyphoundRect and the
> CTFontGetBoundingRectsForGlyphs so could print the numbers we get there
> vs the ones we get in FreeTypeFont::GetGlyphBoundRect to verify that.
>
>
> I’ve added some debugging statements. the Freetype library does its own
> floor and ceil calculations. it’s looking like it isn’t a risky a rounding
> error, it is just that Freetype calculates one value and MacOS framework
> for glyphs calculates it differently.
>
> Patch is https://gerrit.libreoffice.org/c/core/+/142006 if anyone would
> like to review :-)
>
> Chris
>

A polite ping to the mailing list as people are now asking me for the
rationale behind the patch, could someone please advise the way forward?

Chris


Re: [BUG] [Libetonyek Build Failed] Please consider updating autotool scripts.

2022-10-30 Thread Chris Sherlock



> On 17 Oct 2022, at 4:17 pm, 南国 微雪  wrote:
> 
> Hello, I'm from ArchRISC-V Team, a community porting Arch Linux software to 
> RISC-V architecture.
>  
> # Description 
>  
> While packaging `Libetonyek`, we found an error.
> (This link is the log about building processing our lord maintained.)
> The `config.guess` file is too old to work.
> So our team gives this advice.
>  
> ## Advice
>  
> - You can find the patch here that how we fix it.
> - Please consider updating the configure script tools(Especially 
> `config.guess` file). As part of our duty, we do suggest our upstreams doing 
> this once and for all instead.
>  
> Sincerely thanks.
> :)
>  
> Sent from Mail for Windows

I ran this through Google Translate. It reads:

"config.guess: unable to guess system type

solution:

1. First report upstream that their config.guessand config.subfiles are too old.
2. Then try to update config.guess with autoreconf -ficommand
3. If the upstream config.guess file is too old to be updated 
/usr/share/autoconf/build-aux/, copy the config.guess and config.subfiles in 
the directory to the local.
4. Submit a PR with a link to your upstream report.
5. Keep track of your upstream reports, and delete patches after upstream 
updates to concurrent releases.”

I checked libetonyek on opengrok, and there doesn’t seem to be a config.guess 
file?

Chris




Re: Date errors in LibreOffice

2022-10-29 Thread Chris Sherlock


Sent from my iPhone

> On 25 Oct 2022, at 9:39 am, Juan C. Sanz  wrote:
> 
> Hi
> 
> A few weeks ago I proposed a patch 
> https://gerrit.libreoffice.org/c/core/+/138845 related to bug tdf#150587, 
> which removed what I felt was an artificial limitation on the range of dates 
> that can be entered in some LibreOffice form controls.
> 
> Due to some comments, I reverted the patch and started to do some testing of 
> the behavior of dates in LibreOffice.
> 

That is some excellent testing! Kudos to you for the hard work. I wonder if it 
might not be best to log the bugs anyway?

FWIW, your proposal to use the Gregorian calendar seems pretty reasonable to 
me.  However, it’s not an area of the code I have any experience with, so take 
this with a grain of salt.

Chris

Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-29 Thread Chris Sherlock


Sent from my iPhone

> On 23 Oct 2022, at 5:20 am, Caolán McNamara  wrote:
> 
> On Sat, 2022-10-22 at 01:42 +1100, Chris Sherlock wrote:
>>> Test name: VclLogicalFontInstanceTest::testglyphboundrect
>>> equality assertion failed
>>> - Expected: 51x82@(7,-80)
>>> - Actual  : 51x83@(7,-80)
>> 
>> I’ve had another look at the code, with some help from Khaled. The
>> issue is the way in which we do our final rounding. 
>> 
>> On Freetype, it uses 26.6 fixed point, and thus needs it’s own
>> special FreeType ceil and floor functions. CoreText appears to using
>> floating point, but the std::ceil and std::floor functions give
>> slight different results. 
> 
> I presume that for mac its CoreTextStyle::ImplGetGlyphoundRect and the
> CTFontGetBoundingRectsForGlyphs so could print the numbers we get there
> vs the ones we get in FreeTypeFont::GetGlyphBoundRect to verify that. 

I’ve added some debugging statements. the Freetype library does its own floor 
and ceil calculations. it’s looking like it isn’t a risky a rounding error, it 
is just that Freetype calculates one value and MacOS framework for glyphs 
calculates it differently.

Patch is https://gerrit.libreoffice.org/c/core/+/142006 if anyone would like to 
review :-)

Chris

[Libreoffice-commits] core.git: include/vcl vcl/source

2022-10-28 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |1 
 vcl/source/animate/Animation.cxx  |   92 ++
 2 files changed, 46 insertions(+), 47 deletions(-)

New commits:
commit 91bc1e6a8c92a7c895f0ba9dcad9ac4d35f3f791
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:21:17 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Oct 28 11:09:32 2022 +0200

vcl: extract function Animation::RenderNextFrameInAllRenderers()

Change-Id: Iaccf12b251ffe06e24813c48ba3a169d0eaaa61c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76416
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index b9d9d69e401f..307fed73c222 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -112,6 +112,7 @@ private:
 
 SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
 SAL_DLLPRIVATE void PopulateRenderers();
+SAL_DLLPRIVATE void RenderNextFrameInAllRenderers();
 
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 4ae010c54332..c6547f9e7852 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -317,6 +317,50 @@ void Animation::PopulateRenderers()
 }
 }
 
+void Animation::RenderNextFrameInAllRenderers()
+{
+AnimationFrame* pCurrentFrameBmp
+= (++mnFrameIndex < maFrames.size()) ? maFrames[mnFrameIndex].get() : 
nullptr;
+
+if (!pCurrentFrameBmp)
+{
+if (mnLoops == 1)
+{
+Stop();
+mbLoopTerminated = true;
+mnFrameIndex = mnAnimCount - 1;
+maBitmapEx = maFrames[mnFrameIndex]->maBitmapEx;
+return;
+}
+else
+{
+if (mnLoops)
+mnLoops--;
+
+mnFrameIndex = 0;
+pCurrentFrameBmp = maFrames[mnFrameIndex].get();
+}
+}
+
+// Paint all views.
+std::for_each(maRenderers.cbegin(), maRenderers.cend(),
+  [this](const auto& pRenderer) { 
pRenderer->draw(mnFrameIndex); });
+/*
+ * If a view is marked, remove the view, because
+ * area of output lies out of display area of window.
+ * Mark state is set from view itself.
+ */
+auto removeStart = std::remove_if(maRenderers.begin(), maRenderers.end(),
+  [](const auto& pRenderer) { return 
pRenderer->isMarked(); });
+maRenderers.erase(removeStart, maRenderers.cend());
+
+// stop or restart timer
+if (maRenderers.empty())
+Stop();
+else
+ImplRestartTimer(pCurrentFrameBmp->mnWait);
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -346,57 +390,11 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 }
 
 if (maRenderers.empty())
-{
 Stop();
-}
 else if (bGlobalPause)
-{
 ImplRestartTimer(10);
-}
 else
-{
-AnimationFrame* pCurrentFrameBmp
-= (++mnFrameIndex < maFrames.size()) ? 
maFrames[mnFrameIndex].get() : nullptr;
-
-if (!pCurrentFrameBmp)
-{
-if (mnLoops == 1)
-{
-Stop();
-mbLoopTerminated = true;
-mnFrameIndex = nAnimCount - 1;
-maBitmapEx = maFrames[mnFrameIndex]->maBitmapEx;
-return;
-}
-else
-{
-if (mnLoops)
-mnLoops--;
-
-mnFrameIndex = 0;
-pCurrentFrameBmp = maFrames[mnFrameIndex].get();
-}
-}
-
-// Paint all views.
-std::for_each(maRenderers.cbegin(), maRenderers.cend(),
-  [this](const auto& pRenderer) { 
pRenderer->draw(mnFrameIndex); });
-/*
- * If a view is marked, remove the view, because
- * area of output lies out of display area of window.
- * Mark state is set from view itself.
- */
-auto removeStart
-= std::remove_if(maRenderers.begin(), maRenderers.end(),
- [](const auto& pRenderer) { return 
pRenderer->isMarked(); });
-maRenderers.erase(removeStart, maRenderers.cend());
-
-// stop or restart timer
-if (maRenderers.empty())
-Stop();
-else
-ImplRestartTimer(pCurrentFrameBmp->mnWait);
-}
+RenderNextFrameInAllRenderers();
 }
 else
 Stop();


Re: (was: ESC meeting minutes: 2022-10-20)

2022-10-22 Thread Chris Sherlock
On 22 Oct 2022, at 9:36 pm, Paolo Vecchi  
wrote:
> 
> Hi Noel,
> 
> On 22/10/2022 08:27, Noel Grandin wrote:
>> 
>> 
>> On Fri, 21 Oct 2022 at 23:32, Andreas Mantke > > wrote:
>> The whole action was driven by members of the board with a (potential?)
>> Conflict of Interest (CoI) on just this topic.
>> 
>> 
>> This is just another way of attempting to exclude everybody you disagree 
>> with.
>> 
>> The way you define COI, everybody involved with LibreOiffce has a conflict 
>> of interest, so nobody should be commenting.
>> 
> Andreas actually didn't define what a CoI is, laws and regulations do.
> 
Hi Paolo, 

So that I can understand correctly, and as an outside party, are you alleging 
there *was* a conflict of interest in the actions taken by members of the Board?

Chris

Re: (was: ESC meeting minutes: 2022-10-20)

2022-10-22 Thread Chris Sherlock
On Sat, Oct 22, 2022 at 8:24 PM Andreas Mantke  wrote:

> it would have been great, if you'd explained that you are  working for
> the company which forked away from LibreOffice Online
> (https://www.documentfoundation.org/gethelp/developers/).
>
> Thus you have on this specific topic (the online version of LibreOffice
> and the work on that project) a (potential?) CoI.
>

 Sorry to butt in again, but Noel has never made it unclear he works for
Collabora. I don't believe there is any undisclosed conflict of interest.

Chris


Re: (was: ESC meeting minutes: 2022-10-20)

2022-10-21 Thread Chris Sherlock
On 21 Oct 2022, at 11:29 pm, Andreas Mantke  wrote:
> 
> Hi,
> 
> I find it very shameful how much efford the board and it's members with
> a known and possible CoI on this topic invest to not enable further
> contributions and throw away a project which is evaluated important for
> the future of LibreOffice and TDF.
> 
> And this whole topic shows that this board members use other
> contributors and the staff to get their work done. It's a great pity.
> 
> Regards,
> Andreas

I’m not a board member, and I can’t understand why you say that. Stephan is 
correct from what I can see, there aren’t enough significant commits. 

As someone who has made my fair share of insignificant commits, I think I know 
what I’m talking about :-) j/k

Chris



Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-21 Thread Chris Sherlock
On 16 Oct 2022, at 9:03 am, Chris Sherlock  wrote:
> 
> 
> 
> On Sun, Oct 16, 2022 at 2:07 AM Caolán McNamara  <mailto:caol...@redhat.com>> wrote:
> On Sat, 2022-10-15 at 22:13 +1100, Chris Sherlock wrote:
> > So an update… after I shifted to using Liberation Sans as the font
> > face and added gb_CppunitTest_use_more_fonts the only platform that
> > varies is MacOS.
> > 
> > Test name: VclLogicalFontInstanceTest::testglyphboundrect
> > equality assertion failed
> > - Expected: 7x9@(0,-8)
> > - Actual  : 7x10@(0,-8)
> 
> And what if you use a larger font size. say font size 110 instead of
> 11, maybe its a hinting related thing.
> 
> Just tried, looks like it is out by 1. 
> 
> Test name: VclLogicalFontInstanceTest::testglyphboundrect
> equality assertion failed
> - Expected: 51x82@(7,-80)
> - Actual  : 51x83@(7,-80)

I’ve had another look at the code, with some help from Khaled. The issue is the 
way in which we do our final rounding. 

On Freetype, it uses 26.6 fixed point, and thus needs it’s own special FreeType 
ceil and floor functions. CoreText appears to using floating point, but the 
std::ceil and std::floor functions give slight different results. 

I am confused why this might be… does anyone have any ideas?

FWIW, the reasoning for using 26.6 in Freetype can be found here: 
https://lists.nongnu.org/archive/html/freetype/2002-09/msg00076.html 
<https://lists.nongnu.org/archive/html/freetype/2002-09/msg00076.html>

The floor and ceiling functions used are defined here:

https://gitlab.com/freetype/freetype/-/blob/master/include/freetype/internal/ftobjs.h#L91
 
<https://gitlab.com/freetype/freetype/-/blob/master/include/freetype/internal/ftobjs.h#L91>

And the control box function that gets the bounding box is FT_Glyph_Get_CBox(), 
which can be found here:

https://gitlab.com/freetype/freetype/-/blob/master/src/base/ftglyph.c#L733 
<https://gitlab.com/freetype/freetype/-/blob/master/src/base/ftglyph.c#L733>

We basically copied the ceil and floor used in Freetype in an attempt to get 
CoreText as close as possible to FreeType. It’s a pity it is off by 1 in many 
cases… would love it if something with more knowledge than me can see why this 
differs!

I’ve written a utility to get the bounding boxes of all the glyphs of a 
particular font, incidentally. It can be found here:

https://gerrit.libreoffice.org/c/core/+/141526 
<https://gerrit.libreoffice.org/c/core/+/141526>

Chris



[Libreoffice-commits] core.git: include/vcl vcl/source

2022-10-17 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |4 +-
 vcl/source/animate/Animation.cxx  |   52 +++---
 2 files changed, 29 insertions(+), 27 deletions(-)

New commits:
commit 6125be0aa10113d840a1fdbe33cf3174d5896fcb
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 10:04:14 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 10:28:02 2022 +0200

vcl: extract variable and rename Animation::mnPos to mnFrameIndex

Change-Id: I889a33718da0984bd9230a9b93fe90403272888b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76415
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 249159a36179..b9d9d69e401f 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -92,7 +92,7 @@ public:
 public:
 SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; }
 SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; }
-SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; }
+SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnFrameIndex; }
 
 private:
 SAL_DLLPRIVATE static sal_uLong mnAnimCount;
@@ -106,7 +106,7 @@ private:
 Size maGlobalSize;
 sal_uInt32 mnLoopCount;
 sal_uInt32 mnLoops;
-size_t mnPos;
+size_t mnFrameIndex;
 bool mbIsInAnimation;
 bool mbLoopTerminated;
 
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 43583a4a33f5..4ae010c54332 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -37,7 +37,7 @@ Animation::Animation()
 : maTimer("vcl::Animation")
 , mnLoopCount(0)
 , mnLoops(0)
-, mnPos(0)
+, mnFrameIndex(0)
 , mbIsInAnimation(false)
 , mbLoopTerminated(false)
 {
@@ -49,7 +49,7 @@ Animation::Animation(const Animation& rAnimation)
 , maTimer("vcl::Animation")
 , maGlobalSize(rAnimation.maGlobalSize)
 , mnLoopCount(rAnimation.mnLoopCount)
-, mnPos(rAnimation.mnPos)
+, mnFrameIndex(rAnimation.mnFrameIndex)
 , mbIsInAnimation(false)
 , mbLoopTerminated(rAnimation.mbLoopTerminated)
 {
@@ -78,7 +78,7 @@ Animation& Animation::operator=(const Animation& rAnimation)
 maGlobalSize = rAnimation.maGlobalSize;
 maBitmapEx = rAnimation.maBitmapEx;
 mnLoopCount = rAnimation.mnLoopCount;
-mnPos = rAnimation.mnPos;
+mnFrameIndex = rAnimation.mnFrameIndex;
 mbLoopTerminated = rAnimation.mbLoopTerminated;
 mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
 }
@@ -169,7 +169,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 if (!maFrames.empty())
 {
 if ((rOut.GetOutDevType() == OUTDEV_WINDOW) && !mbLoopTerminated
-&& (ANIMATION_TIMEOUT_ON_CLICK != maFrames[mnPos]->mnWait))
+&& (ANIMATION_TIMEOUT_ON_CLICK != maFrames[mnFrameIndex]->mnWait))
 {
 bool differs = true;
 
@@ -197,7 +197,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 {
 maTimer.Stop();
 mbIsInAnimation = false;
-mnPos = 0;
+mnFrameIndex = 0;
 }
 
 if (differs)
@@ -206,7 +206,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 
 if (!mbIsInAnimation)
 {
-ImplRestartTimer(maFrames[mnPos]->mnWait);
+ImplRestartTimer(maFrames[mnFrameIndex]->mnWait);
 mbIsInAnimation = true;
 }
 }
@@ -247,7 +247,7 @@ void Animation::Draw(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDest
 if (!nCount)
 return;
 
-AnimationFrame* pObj = maFrames[std::min(mnPos, nCount - 1)].get();
+AnimationFrame* pObj = maFrames[std::min(mnFrameIndex, nCount - 1)].get();
 
 if (rOut.GetConnectMetaFile() || (rOut.GetOutDevType() == OUTDEV_PRINTER))
 {
@@ -259,15 +259,15 @@ void Animation::Draw(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDest
 }
 else
 {
-const size_t nOldPos = mnPos;
+const size_t nOldPos = mnFrameIndex;
 if (mbLoopTerminated)
-const_cast(this)->mnPos = nCount - 1;
+const_cast(this)->mnFrameIndex = nCount - 1;
 
 {
 AnimationRenderer{ const_cast(this), &rOut, rDestPt, 
rDestSz, 0 };
 }
 
-const_cast(this)->mnPos = nOldPos;
+const_cast(this)->mnFrameIndex = nOldPos;
 }
 }
 
@@ -355,17 +355,17 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 }
 else
 {
-AnimationFrame* pStepBmp
-= (++mnPos < maFrames.size()) ? maFrames[mnPos].

[Libreoffice-commits] core.git: include/vcl vcl/source

2022-10-17 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |2 +
 vcl/source/animate/Animation.cxx  |   45 --
 2 files changed, 26 insertions(+), 21 deletions(-)

New commits:
commit 12ebfc4f6d7b77cd77ac9028dddf0554df05c91e
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 09:53:07 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 17 10:27:19 2022 +0200

vcl: extract Animation function PopulateRenderers()

Change-Id: I6e490d13ee23faf4536c930264f71354382a08d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76410
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 2f13052d084b..249159a36179 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -111,6 +111,8 @@ private:
 bool mbLoopTerminated;
 
 SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
+SAL_DLLPRIVATE void PopulateRenderers();
+
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
 };
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 8217978d26ef..43583a4a33f5 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -294,6 +294,29 @@ std::vector> 
Animation::CreateAnimationDataItems(
 return aDataItems;
 }
 
+void Animation::PopulateRenderers()
+{
+for (auto& pDataItem : CreateAnimationDataItems())
+{
+AnimationRenderer* pRenderer = nullptr;
+if (!pDataItem->mpRendererData)
+{
+pRenderer = new AnimationRenderer(this, pDataItem->mpRenderContext,
+  pDataItem->maOriginStartPt, 
pDataItem->maStartSize,
+  pDataItem->mnRendererId);
+
+
maRenderers.push_back(std::unique_ptr(pRenderer));
+}
+else
+{
+pRenderer = 
static_cast(pDataItem->mpRendererData);
+}
+
+pRenderer->pause(pDataItem->mbIsPaused);
+pRenderer->setMarked(true);
+}
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -305,27 +328,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 if (maNotifyLink.IsSet())
 {
 maNotifyLink.Call(this);
-
-// set view state from AnimationData structure
-for (auto& pDataItem : CreateAnimationDataItems())
-{
-AnimationRenderer* pRenderer = nullptr;
-if (!pDataItem->mpRendererData)
-{
-pRenderer = new AnimationRenderer(
-this, pDataItem->mpRenderContext, 
pDataItem->maOriginStartPt,
-pDataItem->maStartSize, pDataItem->mnRendererId);
-
-
maRenderers.push_back(std::unique_ptr(pRenderer));
-}
-else
-{
-pRenderer = 
static_cast(pDataItem->mpRendererData);
-}
-
-pRenderer->pause(pDataItem->mbIsPaused);
-pRenderer->setMarked(true);
-}
+PopulateRenderers();
 
 // delete all unmarked views
 auto removeStart


Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-15 Thread Chris Sherlock
On Sun, Oct 16, 2022 at 2:07 AM Caolán McNamara  wrote:

> On Sat, 2022-10-15 at 22:13 +1100, Chris Sherlock wrote:
> > So an update… after I shifted to using Liberation Sans as the font
> > face and added gb_CppunitTest_use_more_fonts the only platform that
> > varies is MacOS.
> >
> > Test name: VclLogicalFontInstanceTest::testglyphboundrect
> > equality assertion failed
> > - Expected: 7x9@(0,-8)
> > - Actual  : 7x10@(0,-8)
>
> And what if you use a larger font size. say font size 110 instead of
> 11, maybe its a hinting related thing.
>

Just tried, looks like it is out by 1.

Test name: VclLogicalFontInstanceTest::testglyphboundrect
equality assertion failed
- Expected: 51x82@(7,-80)
- Actual  : 51x83@(7,-80)


Re: Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-15 Thread Chris Sherlock


> On 15 Oct 2022, at 8:12 pm, Chris Sherlock  wrote:
> 
> 
> I've done some testing of LogicalFontInstance::GetGlyphBoundRect(). Each 
> platform seems to give different values!
> 
> The commit in gerrit is: https://gerrit.libreoffice.org/c/core/+/141234

So an update… after I shifted to using Liberation Sans as the font face and 
added gb_CppunitTest_use_more_fonts the only platform that varies is MacOS.

Test name: VclLogicalFontInstanceTest::testglyphboundrect
equality assertion failed
- Expected: 7x9@(0,-8)
- Actual  : 7x10@(0,-8)



[Libreoffice-commits] core.git: vcl/qa

2022-10-15 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |   71 
 1 file changed, 71 insertions(+)

New commits:
commit 5c2e1c894e6d0ef846d3643ef96c56ab548ef0d0
Author: Chris Sherlock 
AuthorDate: Sun Oct 2 18:33:12 2022 +1100
Commit: Noel Grandin 
CommitDate: Sat Oct 15 12:55:43 2022 +0200

vcl: test generating ellipses

Change-Id: Ic985bd9bbee4319243c01fff6dffa46e860581a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140905
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index 8ec7597e6a65..a450c99ee3df 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -62,6 +62,9 @@ public:
 void testImplLayoutArgsBiDiRtl();
 void testImplLayoutArgsRightAlign();
 void testImplLayoutArgs_PrepareFallback_precalculatedglyphs();
+void testGetStringWithCenterEllpsis();
+void testGetStringWithEndEllpsis();
+void testGetStringWithNewsEllpsis();
 void testGetTextBreak();
 
 CPPUNIT_TEST_SUITE(VclTextTest);
@@ -75,6 +78,9 @@ public:
 CPPUNIT_TEST(testImplLayoutArgsBiDiRtl);
 CPPUNIT_TEST(testImplLayoutArgsRightAlign);
 CPPUNIT_TEST(testImplLayoutArgs_PrepareFallback_precalculatedglyphs);
+CPPUNIT_TEST(testGetStringWithCenterEllpsis);
+CPPUNIT_TEST(testGetStringWithEndEllpsis);
+CPPUNIT_TEST(testGetStringWithNewsEllpsis);
 CPPUNIT_TEST(testGetTextBreak);
 CPPUNIT_TEST_SUITE_END();
 };
@@ -576,6 +582,71 @@ void 
VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
 CPPUNIT_ASSERT(!bRTL);
 }
 
+void VclTextTest::testGetStringWithCenterEllpsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b c d ...v w x y z"),
+device->GetEllipsisString(u"a b c d e f g h i j k l m n o p q r s t u 
v w x y z", 100,
+  DrawTextFlags::CenterEllipsis));
+}
+
+void VclTextTest::testGetStringWithEndEllpsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(OUString(u"a"), device->GetEllipsisString(u"abcde. f 
g h i j ...", 10,
+   
DrawTextFlags::EndEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b c d e f g h i j ..."),
+device->GetEllipsisString(u"a b c d e f g h i j k l m n o p q r s t u 
v w x y z", 100,
+  DrawTextFlags::EndEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(OUString(u"a"), device->GetEllipsisString(u"abcde. f 
g h i j ...", 1,
+   
DrawTextFlags::EndEllipsis
+   | 
DrawTextFlags::Clip));
+}
+
+void VclTextTest::testGetStringWithNewsEllpsis()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+CPPUNIT_ASSERT_EQUAL(OUString(u"a"), device->GetEllipsisString(u"abcde. f 
g h i j ...", 10,
+   
DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b  x y z"),
+device->GetEllipsisString(u"a b c d. e f g. h i j k l m n o p q r s t 
u v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b  x y z"),
+device->GetEllipsisString(u"a b c d. e f g h i j k l m n o p q r s t u 
v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a b c d e f g h i j ..."),
+device->GetEllipsisString(u"a b c d e f g h i j k l m n o p q r s t u 
v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"a. x y z"),
+device->GetEllipsisString(u"a. b c d e f g h i j k l m n o p q r s t u 
v w. x y z", 100,
+  DrawTextFlags::NewsEllipsis));
+
+CPPUNIT_ASSERT_EQUAL(
+OUString(u"ab. cde..."),
+device->GetEllipsisString(u"ab. cde. x y z", 50, 
DrawTextFlags::NewsEllipsis));
+}
+
 void VclTextTest::testGetTextBreak()
 {
 ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);


Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms

2022-10-15 Thread Chris Sherlock
I've done some testing of LogicalFontInstance::GetGlyphBoundRect(). Each
platform seems to give different values!

The commit in gerrit is: https://gerrit.libreoffice.org/c/core/+/141234

(many thanks to Hossein for some suggestions in a different gerrit patch
about some things around unit tests I didn't know - see comments at
https://gerrit.libreoffice.org/c/core/+/141103/)

Ultimately, the differences boil down to the pure function
LogicalFontInstance::ImplGetGlyphBoundRect(), which each platform must
implement to get the glyph's bounding rect.

To try to understand the differences, I've looked at each platform's
implementation with some notes, if this is at all helpful. Any comments
would be appreciated! I'd love to standardize this function :-)

Chris
---

Comparion of LogicalFontInstance::ImplGetGlyphBoundRect() between platforms


WIN32
-

ImplGetGlyphBoundRect() is implemented in WinFontInstance, derived by
from LogicalFontInstance

Located in vcl/win/gdi/salfont.cxx

Process:

Step 1: select the font
---

1. Get the HDC of the current graphics
2. Get the current GDI font's HFONT
3. Get the the HFONT of the font referenced by the WinFontInstance
4. If the current GDI HFONT is not the WinFontInstance's HFONT then
   explicitly select the WinFontInstance's HFONT
5. Setup a guard to restore the original font after
   ImplGetGlyphBoundRect() finishes

Step 2: Setup transformation matrix
---

MAT2 is a 3x3 transformation matrix

If using horizontal text, setup an identity matrix (means that nothing
happens when applying the matrix)

If using vertical writing then matrix appropriately rotates the glyph

Step 3: Setup to get the glyph's bounding rect
--

1. Set the flag for GetGlyphOutlineW to use GGO_METRICS and
   GGO_GLYPH_INDEX

   - GGO_METRICS indicates to retrieve the GLYPHMETRICS structure
   - GGO_GLYPH_INDEX indicates that we use the TrueType glyph index
 instead of the character code

2. Zero initialize the GLYPHMETRICS fields

3. Call on GetGlyphOutlineW using the transformation matrix to
   populate the glyph metrics

Step 4: Get the bounding rect of the glyph
--

The next bit takes the glyph metrics from the previous step.

1. Populate the glyph rectangle with the origin being the x- and y-
   coords of the upper left corner of the smallest rectangle that
   completely encloses the glyph, and the width and height of the
   glyph's "black box", which is the smallest rectangle that
   encloses the glyph

2. Scale the bounding rectangle, adding a point to the right and
   bottom coords of the rectangle

SUMMARY:

Basically, we call on Win32's GetGlyphOutlineW() to get the GLYPHMETRICS.
It is important to quote Microsoft on this structure:

   The GLYPHMETRICS structure specifies the width of the character cell
   and the location of a glyph within the character cell. The origin of
   the character cell is located at the left side of the cell at the
   baseline of the font. The location of the glyph origin is relative to
   the character cell origin. The height of a character cell, the
   baseline, and other metrics global to the font are given by the
   OUTLINETEXTMETRIC structure.

https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getglyphoutlinew


MAC
---

ImplGetGlyphBoundRect() is implemented in CoreTextStyle, derived from
LogicalFontInstance

Located in vcl/quartz/ctfont.cxx

Process:

Step 1: Get the glyph rectangle
---

1. Set the CGGlyph variable nCGGlyph the glyph index
2. Get the font by looking up the mpStyleDict dictionary for the
   kCTFontAttributeName, which gives the font of the text to
   which this attribute applies

Note: Currently does not handle vertical text

3. Get the glyph rectangle in a CGRect by calling on
   CTFontGetBoundingRectsForGlyphs()
4. Apply any font rotation for horizontal text

Step 2: Return the tools::Rectangle bounding rect
-

1. std::floor() the origin x, y (i.e. the top left)
2. std::ceil() the bottom right of the rectangle
   i.e. to get this, aCGRect.origin.x + aCGRect.size.width
 aCGRect.origin.y + aCGRect.size.height

3. so the rectangle gets the positive x origin and a negative y origin (???)
   and for the bottom left a positive x and a negative y (???)

SUMMARY:

Use CTFontGetBoundRectsForGlyphs() to get the bounding rect of
the glyph.

Note that the Core Text documentation says the following:

  The bounding rectangles of the individual glyphs are returned through
  the boundingRects parameter. These are the design metrics from the
  font transformed in font space.

https://developer.apple.com/documentation/coretext/1509419-ctfontgetboundingrectsforglyphs


UNIX


Note there are two variants: Qt and Freetype

Q

[Libreoffice-commits] core.git: vcl/source

2022-10-13 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 65b2aa877dd8a9fd42992faf532144d22ae93182
Author: Chris Sherlock 
AuthorDate: Fri Oct 14 04:53:38 2022 +1100
Commit: Miklos Vajna 
CommitDate: Fri Oct 14 08:35:49 2022 +0200

vcl: followup 'vcl: extract function CreateAnimationDataItems'

Change-Id: I25d2057477dae952e2ded966cf2f7feedf6d90f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141341
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 5582c3b9a848..8217978d26ef 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -304,10 +304,6 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (maNotifyLink.IsSet())
 {
-std::vector> aDataItems;
-for (auto const& i : maRenderers)
-aDataItems.emplace_back(i->createAnimationData());
-
 maNotifyLink.Call(this);
 
 // set view state from AnimationData structure


[Libreoffice-commits] core.git: include/vcl vcl/source

2022-10-12 Thread Chris Sherlock (via logerrit)
 include/vcl/animate/Animation.hxx |2 ++
 vcl/source/animate/Animation.cxx  |   15 +--
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 5f88c66b835718c5cc5f07d21825a5ac6880e458
Author: Chris Sherlock 
AuthorDate: Sat Jun 25 09:31:46 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 12 10:11:25 2022 +0200

vcl: extract function CreateAnimationDataItems

Change-Id: Ifc245b570d82d2fcbcd2cbb83cbd43664b228bf2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76409
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/animate/Animation.hxx 
b/include/vcl/animate/Animation.hxx
index 6c592ba753c1..2f13052d084b 100644
--- a/include/vcl/animate/Animation.hxx
+++ b/include/vcl/animate/Animation.hxx
@@ -28,6 +28,7 @@
 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
 
 class AnimationRenderer;
+struct AnimationData;
 
 class VCL_DLLPUBLIC Animation
 {
@@ -109,6 +110,7 @@ private:
 bool mbIsInAnimation;
 bool mbLoopTerminated;
 
+SAL_DLLPRIVATE std::vector> 
CreateAnimationDataItems();
 SAL_DLLPRIVATE void ImplRestartTimer(sal_uLong nTimeout);
 DECL_DLLPRIVATE_LINK(ImplTimeoutHdl, Timer*, void);
 };
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index fb47e9698a3f..5582c3b9a848 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -282,6 +282,18 @@ void Animation::ImplRestartTimer(sal_uLong nTimeout)
 maTimer.Start();
 }
 
+std::vector> 
Animation::CreateAnimationDataItems()
+{
+std::vector> aDataItems;
+
+for (auto const& rItem : maRenderers)
+{
+aDataItems.emplace_back(rItem->createAnimationData());
+}
+
+return aDataItems;
+}
+
 IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 {
 const size_t nAnimCount = maFrames.size();
@@ -293,14 +305,13 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 if (maNotifyLink.IsSet())
 {
 std::vector> aDataItems;
-// create AnimationData-List
 for (auto const& i : maRenderers)
 aDataItems.emplace_back(i->createAnimationData());
 
 maNotifyLink.Call(this);
 
 // set view state from AnimationData structure
-for (auto& pDataItem : aDataItems)
+for (auto& pDataItem : CreateAnimationDataItems())
 {
 AnimationRenderer* pRenderer = nullptr;
 if (!pDataItem->mpRendererData)


[Libreoffice-commits] core.git: vcl/inc

2022-10-12 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit ff7dd118bdc5d017d2dec28a4e37c3e3a6b97660
Author: Chris Sherlock 
AuthorDate: Wed Jul 20 19:56:51 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Oct 12 10:10:24 2022 +0200

vcl: Animation does not need to be friend of AnimationRenderer

Change-Id: I76441d55d62b63d380417554cd236e7e3cf882e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76408
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 0466518dfb1d..f75b88e29541 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -44,9 +44,6 @@ struct AnimationData
 class VCL_DLLPUBLIC AnimationRenderer
 {
 private:
-
-friend class Animation;
-
 Animation*  mpParent;
 VclPtr  mpRenderContext;
 tools::Long mnRendererId;


Re: Minimum system version of ICU

2022-10-10 Thread Chris Sherlock



> On 10 Oct 2022, at 11:56 pm, Stephan Bergmann  wrote:
> 
> On 08/10/2022 19:57, Chris Sherlock wrote:
>> What is the minimum version of ICU that a system must run if the distro 
>> decides not to use our internal ICU?
> 
> At least the relevant configure.ac check appears to be still effectively at 
> <https://git.libreoffice.org/core/+/f20ed8959bc0a984177377a734d34f767653625b%5E!/>
>  "Require icu 4.6 or later with system icu" (however rotten that may be in 
> practice).

Thanks Stephan. Is it maybe time to increase the minimum version from this? 
That was released in 2010!

[Libreoffice-commits] core.git: vcl/source

2022-10-09 Thread Chris Sherlock (via logerrit)
 vcl/source/animate/Animation.cxx |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 0d463de3adc204af6892cc2b2c2d8a698237fb0c
Author: Chris Sherlock 
AuthorDate: Wed Jul 20 19:53:47 2022 +1000
Commit: Ilmari Lauhakangas 
CommitDate: Sun Oct 9 11:27:36 2022 +0200

vcl: pAnimView to pRenderer (clarify variable name)

Change-Id: I909aa5f3b2dd1c62d4fb1f8eb3ea0f5a2e4d7ed4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136434
Reviewed-by: Ilmari Lauhakangas 
Tested-by: Jenkins

diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 9b1165655186..fb47e9698a3f 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -175,8 +175,8 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 
 auto itAnimView = std::find_if(
 maRenderers.begin(), maRenderers.end(),
-[&rOut, nRendererId](const std::unique_ptr& 
pAnimView) -> bool {
-return pAnimView->matches(&rOut, nRendererId);
+[&rOut, nRendererId](const std::unique_ptr& 
pRenderer) -> bool {
+return pRenderer->matches(&rOut, nRendererId);
 });
 
 if (itAnimView != maRenderers.end())
@@ -188,7 +188,9 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 differs = false;
 }
 else
+{
 maRenderers.erase(itAnimView);
+}
 }
 
 if (maRenderers.empty())
@@ -221,8 +223,8 @@ void Animation::Stop(const OutputDevice* pOut, tools::Long 
nRendererId)
 {
 maRenderers.erase(
 std::remove_if(maRenderers.begin(), maRenderers.end(),
-   [=](const std::unique_ptr& 
pAnimView) -> bool {
-   return pAnimView->matches(pOut, nRendererId);
+   [=](const std::unique_ptr& 
pRenderer) -> bool {
+   return pRenderer->matches(pOut, nRendererId);
}),
 maRenderers.end());
 


Minimum system version of ICU

2022-10-08 Thread Chris Sherlock
Hey all,What is the minimum version of ICU that a system must run if the distro decides not to use our internal ICU?I ask because in 2019 we added some checks for ICU < 63 here:libreoffice/core - main, development code repositorycgit.freedesktop.orgIf we require ICU >= 63 then we could scrap the code :-)ChrisSent from my iPhone

[Libreoffice-commits] core.git: vcl/qa

2022-10-07 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/text.cxx |   26 ++
 1 file changed, 26 insertions(+)

New commits:
commit 0cf173ff4a53618e6ddd40a278f375680d92a71f
Author: Chris Sherlock 
AuthorDate: Tue Sep 27 05:37:47 2022 +1000
Commit: Michael Stahl 
CommitDate: Fri Oct 7 10:42:05 2022 +0200

vcl: test OutputDevice::GetTextBreak()

Change-Id: I1618d268ca7495d4aae1bde1a43be6bcf8811869
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140630
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/vcl/qa/cppunit/text.cxx b/vcl/qa/cppunit/text.cxx
index d233fa9d9aa3..8ec7597e6a65 100644
--- a/vcl/qa/cppunit/text.cxx
+++ b/vcl/qa/cppunit/text.cxx
@@ -62,6 +62,7 @@ public:
 void testImplLayoutArgsBiDiRtl();
 void testImplLayoutArgsRightAlign();
 void testImplLayoutArgs_PrepareFallback_precalculatedglyphs();
+void testGetTextBreak();
 
 CPPUNIT_TEST_SUITE(VclTextTest);
 CPPUNIT_TEST(testSimpleText);
@@ -74,6 +75,7 @@ public:
 CPPUNIT_TEST(testImplLayoutArgsBiDiRtl);
 CPPUNIT_TEST(testImplLayoutArgsRightAlign);
 CPPUNIT_TEST(testImplLayoutArgs_PrepareFallback_precalculatedglyphs);
+CPPUNIT_TEST(testGetTextBreak);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -574,6 +576,30 @@ void 
VclTextTest::testImplLayoutArgs_PrepareFallback_precalculatedglyphs()
 CPPUNIT_ASSERT(!bRTL);
 }
 
+void VclTextTest::testGetTextBreak()
+{
+ScopedVclPtr device = 
VclPtr::Create(DeviceFormat::DEFAULT);
+device->SetOutputSizePixel(Size(1000, 1000));
+device->SetFont(vcl::Font("DejaVu Sans", "Book", Size(0, 11)));
+
+const OUString sTestStr(u"textline_ text_");
+const auto nLen = sTestStr.getLength();
+const auto nTextWidth = device->GetTextWidth("text");
+
+CPPUNIT_ASSERT_EQUAL(static_cast(4),
+ device->GetTextBreak(sTestStr, nTextWidth, 0, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(7),
+ device->GetTextBreak(sTestStr, nTextWidth, 3, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(9),
+ device->GetTextBreak(sTestStr, nTextWidth, 6, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(12),
+ device->GetTextBreak(sTestStr, nTextWidth, 8, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(14),
+ device->GetTextBreak(sTestStr, nTextWidth, 11, nLen));
+CPPUNIT_ASSERT_EQUAL(static_cast(-1),
+ device->GetTextBreak(sTestStr, nTextWidth, 13, nLen));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VclTextTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


[Libreoffice-commits] core.git: unotools/CppunitTest_unotools_fontcvt.mk unotools/Module_unotools.mk unotools/qa

2022-10-05 Thread Chris Sherlock (via logerrit)
 unotools/CppunitTest_unotools_fontcvt.mk |   30 
 unotools/Module_unotools.mk  |1 
 unotools/qa/unit/testRecodeString.cxx|   45 +++
 3 files changed, 76 insertions(+)

New commits:
commit 379ea0bb9e4836b212e004fd93abfc8067ec8929
Author: Chris Sherlock 
AuthorDate: Tue Oct 4 19:56:52 2022 +1100
Commit: Michael Stahl 
CommitDate: Wed Oct 5 11:18:36 2022 +0200

unotools: test ConvertChar::RecodeString()

Change-Id: I1f82afe7e1ac57004723f67412f1a7007d107eff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140938
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/unotools/CppunitTest_unotools_fontcvt.mk 
b/unotools/CppunitTest_unotools_fontcvt.mk
new file mode 100644
index ..16236c16c5d1
--- /dev/null
+++ b/unotools/CppunitTest_unotools_fontcvt.mk
@@ -0,0 +1,30 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,unotools_fontcvt))
+
+$(eval $(call gb_CppunitTest_use_external,unotools_fontcvt,boost_headers))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,unotools_fontcvt))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,unotools_fontcvt, \
+unotools/qa/unit/testRecodeString \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,unotools_fontcvt, \
+   comphelper \
+   cppu \
+   cppuhelper \
+   tl \
+   sal \
+   svt \
+   utl \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/unotools/Module_unotools.mk b/unotools/Module_unotools.mk
index e069960530c3..d2e13a8520d8 100644
--- a/unotools/Module_unotools.mk
+++ b/unotools/Module_unotools.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,unotools,\
 $(eval $(call gb_Module_add_check_targets,unotools,\
 CppunitTest_unotools_configpaths \
 CppunitTest_unotools_fontdefs \
+CppunitTest_unotools_fontcvt \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/unotools/qa/unit/testRecodeString.cxx 
b/unotools/qa/unit/testRecodeString.cxx
new file mode 100644
index ..31e26257b96f
--- /dev/null
+++ b/unotools/qa/unit/testRecodeString.cxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+class Test : public CppUnit::TestFixture
+{
+public:
+void testRecodeString();
+
+CPPUNIT_TEST_SUITE(Test);
+CPPUNIT_TEST(testRecodeString);
+
+CPPUNIT_TEST_SUITE_END();
+};
+
+void Test::testRecodeString()
+{
+// note, the below won't work with mergelibs as the class is not visible to 
the linker
+#if !ENABLE_MERGELIBS
+ConvertChar const* pConversion = ConvertChar::GetRecodeData(u"starbats", 
u"opensymbol");
+OUString aStr(u"u");
+pConversion->RecodeString(aStr, 0, 1);
+CPPUNIT_ASSERT_EQUAL(OUString(u""), aStr);
+#endif
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(Test);
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: basctl/inc chart2/inc comphelper/inc cui/inc drawinglayer/source editeng/inc include/vcl reportdesign/inc sc/inc sd/inc sd/source slideshow/inc slideshow/source svtools

2022-09-16 Thread Chris Sherlock (via logerrit)
 basctl/inc/pch/precompiled_basctl.hxx|4 
 chart2/inc/pch/precompiled_chartcontroller.hxx   |4 
 comphelper/inc/pch/precompiled_comphelper.hxx|   28 +++-
 cui/inc/pch/precompiled_cui.hxx  |4 
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   32 ++---
 editeng/inc/pch/precompiled_editeng.hxx  |   52 +++-
 include/vcl/animate/Animation.hxx|   12 -
 include/vcl/animate/AnimationFrame.hxx   |   29 ++--
 reportdesign/inc/pch/precompiled_rpt.hxx |   25 ++-
 reportdesign/inc/pch/precompiled_rptui.hxx   |4 
 sc/inc/pch/precompiled_sc.hxx|6 
 sd/inc/pch/precompiled_sdui.hxx  |4 
 sd/source/ui/dlg/animobjs.cxx|   22 +--
 slideshow/inc/pch/precompiled_slideshow.hxx  |   49 +++
 slideshow/source/engine/shapes/gdimtftools.cxx   |   32 ++---
 svtools/inc/pch/precompiled_svt.hxx  |   62 ++---
 svx/inc/pch/precompiled_svxcore.hxx  |5 
 svx/source/dialog/_bmpmask.cxx   |   12 -
 svx/source/dialog/_contdlg.cxx   |2 
 svx/source/xoutdev/_xoutbmp.cxx  |   14 +-
 sw/inc/pch/precompiled_msword.hxx|   54 +---
 sw/inc/pch/precompiled_swui.hxx  |7 -
 vcl/Library_vcl.mk   |2 
 vcl/inc/animate/AnimationRenderer.hxx|6 
 vcl/qa/cppunit/animation.cxx |   12 -
 vcl/qa/cppunit/animationrenderer.cxx |   12 -
 vcl/source/animate/Animation.cxx |   70 +--
 vcl/source/animate/AnimationFrame.cxx|4 
 vcl/source/animate/AnimationRenderer.cxx |   20 +--
 vcl/source/bitmap/bitmapfilter.cxx   |2 
 vcl/source/filter/egif/egif.cxx  |6 
 vcl/source/filter/etiff/etiff.cxx|6 
 vcl/source/filter/igif/gifread.cxx   |   28 ++--
 vcl/source/filter/itiff/itiff.cxx|4 
 vcl/source/graphic/GraphicObject.cxx |   18 +-
 35 files changed, 347 insertions(+), 306 deletions(-)

New commits:
commit a2aaa6b77457041e08610eb4bced2d050ea7fa4f
Author: Chris Sherlock 
AuthorDate: Tue Jul 19 21:22:23 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Sep 16 10:08:43 2022 +0200

vcl: AnimationBitmap -> AnimationFrame

The emphasis is not quite right. An animation is made up a sequence of
*frames*, not bitmaps. A frame includes such things as position, size,
timeout till the next frame *as well as* a bitmap.

Note: had to regenerate a bunch of precompiled headers

Change-Id: Ib1959452653857555f41e01ac0151d08c41a3b1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76460
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/basctl/inc/pch/precompiled_basctl.hxx 
b/basctl/inc/pch/precompiled_basctl.hxx
index 248e8b7cbcaa..a92d3a0870f5 100644
--- a/basctl/inc/pch/precompiled_basctl.hxx
+++ b/basctl/inc/pch/precompiled_basctl.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-08-08 12:07:41 using:
+ Generated on 2022-08-13 18:00:51 using:
  ./bin/update_pch basctl basctl --cutoff=3 --exclude:system --include:module 
--exclude:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -110,7 +110,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/chart2/inc/pch/precompiled_chartcontroller.hxx 
b/chart2/inc/pch/precompiled_chartcontroller.hxx
index 5a1c5bb77f2f..b87950ae5bf1 100644
--- a/chart2/inc/pch/precompiled_chartcontroller.hxx
+++ b/chart2/inc/pch/precompiled_chartcontroller.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-06-27 18:58:36 using:
+ Generated on 2022-08-13 18:00:53 using:
  ./bin/update_pch chart2 chartcontroller --cutoff=6 --exclude:system 
--include:module --include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -102,7 +102,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/comphelper/inc/pch/precompiled_comphelper.hxx 
b/comph

[Libreoffice-commits] core.git: ucbhelper/source

2022-09-12 Thread Chris Sherlock (via logerrit)
 ucbhelper/source/client/activedatasink.cxx   |5 -
 ucbhelper/source/client/activedatastreamer.cxx   |5 -
 ucbhelper/source/client/commandenvironment.cxx   |7 ---
 ucbhelper/source/provider/cancelcommandexecution.cxx |6 --
 ucbhelper/source/provider/contentidentifier.cxx  |   10 --
 ucbhelper/source/provider/contentinfo.cxx|5 -
 ucbhelper/source/provider/interactionrequest.cxx |6 --
 ucbhelper/source/provider/propertyvalueset.cxx   |7 ---
 ucbhelper/source/provider/registerucb.cxx|4 
 ucbhelper/source/provider/resultset.cxx  |6 --
 ucbhelper/source/provider/resultsethelper.cxx|7 ++-
 ucbhelper/source/provider/resultsetmetadata.cxx  |7 ---
 12 files changed, 2 insertions(+), 73 deletions(-)

New commits:
commit 247bbdf7e071344564af70743eeb5e30f4113601
Author: Chris Sherlock 
AuthorDate: Sun Sep 11 18:49:48 2022 +1000
Commit: Julien Nabet 
CommitDate: Mon Sep 12 18:49:28 2022 +0200

ucb: remove unnecessary comments

Change-Id: I56b8766526972bbf75425baabcecab9f45510fd6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139763
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/ucbhelper/source/client/activedatasink.cxx 
b/ucbhelper/source/client/activedatasink.cxx
index fdbcbdccb977..96e75f565bee 100644
--- a/ucbhelper/source/client/activedatasink.cxx
+++ b/ucbhelper/source/client/activedatasink.cxx
@@ -17,11 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-/**
-TODO
- **
-
- */
 #include 
 
 using namespace com::sun::star;
diff --git a/ucbhelper/source/client/activedatastreamer.cxx 
b/ucbhelper/source/client/activedatastreamer.cxx
index 8438cae49f53..fe6be13536d2 100644
--- a/ucbhelper/source/client/activedatastreamer.cxx
+++ b/ucbhelper/source/client/activedatastreamer.cxx
@@ -17,11 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-/**
-TODO
- **
-
- */
 #include "activedatastreamer.hxx"
 
 using namespace com::sun::star;
diff --git a/ucbhelper/source/client/commandenvironment.cxx 
b/ucbhelper/source/client/commandenvironment.cxx
index 13bc254e029e..37956b2c468f 100644
--- a/ucbhelper/source/client/commandenvironment.cxx
+++ b/ucbhelper/source/client/commandenvironment.cxx
@@ -17,13 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-/**
-TODO
- **
-
- */
-
 #include 
 #include 
 
diff --git a/ucbhelper/source/provider/cancelcommandexecution.cxx 
b/ucbhelper/source/provider/cancelcommandexecution.cxx
index 90c0168c6508..42850c5ee306 100644
--- a/ucbhelper/source/provider/cancelcommandexecution.cxx
+++ b/ucbhelper/source/provider/cancelcommandexecution.cxx
@@ -17,12 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-/**
-TODO
- **
-
- */
 #include 
 #include 
 #include 
diff --git a/ucbhelper/source/provider/contentidentifier.cxx 
b/ucbhelper/source/provider/contentidentifier.cxx
index d4c13b2c0144..2a5da953d99c 100644
--- a/ucbhelper/source/provider/contentidentifier.cxx
+++ b/ucbhelper/source/provider/contentidentifier.cxx
@@ -17,12 +17,6 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-
-/**
-TODO
- **
-
- */
 #include 
 
 using namespace com::sun::star::uno;
@@ -33,10 +27,6 @@ using namespace com::sun::star::ucb;
 namespace ucbhelper
 {
 
-
-// struct ContentIdentifier_Impl.
-
-
 struct ContentIdentifier_Impl
 {
 OUString  m_aContentId;
diff --git a/ucbhelper/source/provider/contentinfo.cxx 
b/ucbhelper/source/provider/contentinfo.cxx
index 561a80e77e1c..1e513604eb19 100644
--- a

[Libreoffice-commits] core.git: include/vcl solenv/clang-format vcl/inc vcl/Library_vcl.mk vcl/qa vcl/source

2022-09-07 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx|2 
 solenv/clang-format/excludelist   |1 
 vcl/Library_vcl.mk|1 
 vcl/inc/font/EmphasisMark.hxx |   45 +
 vcl/qa/cppunit/font.cxx   |   71 ++
 vcl/source/font/EmphasisMark.cxx  |  174 +++
 vcl/source/gdi/pdfwriter_impl.cxx |   45 +++--
 vcl/source/outdev/font.cxx|  188 ++
 8 files changed, 319 insertions(+), 208 deletions(-)

New commits:
commit 5791c779635b5d42de3c5691bdbadf4a079e096e
Author: Chris Sherlock 
AuthorDate: Sat Aug 13 17:20:32 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Sep 7 15:26:55 2022 +0200

vcl: convert ImplGetEmphasisMark() to EmphasisMark class

It makes more sense for an emphasis mark to be an object that can be
queried, than it is for it to be a function with lots of output
parameters.

I have added a unit test, note that for now something doesn't seem right
with polypolygon equality checks (test fails, but the disc is generated
the same way) so not testing the shape creation.

Change-Id: I7597603419b69639b8d9764afdb68e266da7a56b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122601
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 1162ef3c116e..66cd10f2a53f 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1133,8 +1133,6 @@ public:
 
 bool GetFontFeatures(std::vector& rFontFeatures) const;
 
-SAL_DLLPRIVATE void ImplGetEmphasisMark( tools::PolyPolygon& 
rPolyPoly, bool& rPolyLine, tools::Rectangle& rRect1, tools::Rectangle& rRect2,
- tools::Long& rYOff, 
tools::Long& rWidth, FontEmphasisMark eEmphasis, tools::Long nHeight );
 boolGetGlyphBoundRects( const Point& rOrigin, 
const OUString& rStr, int nIndex,
 int nLen, std::vector< 
tools::Rectangle >& rVector ) const;
 
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 4802408e4117..d1239f3a09fa 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14808,6 +14808,7 @@ vcl/source/filter/wmf/wmf.cxx
 vcl/source/filter/wmf/wmfwr.cxx
 vcl/source/filter/wmf/wmfwr.hxx
 vcl/source/font/DirectFontSubstitution.cxx
+vcl/source/font/EmphasisMark.cxx
 vcl/source/font/FontSelectPattern.cxx
 vcl/source/font/PhysicalFontCollection.cxx
 vcl/source/font/PhysicalFontFamily.cxx
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index b4135d502b2e..10907d6c420c 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -476,6 +476,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
 vcl/source/filter/webp/reader \
 vcl/source/filter/webp/writer \
 vcl/source/font/DirectFontSubstitution \
+vcl/source/font/EmphasisMark \
 vcl/source/font/Feature \
 vcl/source/font/FeatureCollector \
 vcl/source/font/FeatureParser \
diff --git a/vcl/inc/font/EmphasisMark.hxx b/vcl/inc/font/EmphasisMark.hxx
new file mode 100644
index ..5e902da26294
--- /dev/null
+++ b/vcl/inc/font/EmphasisMark.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+namespace vcl::font
+{
+class VCL_DLLPUBLIC EmphasisMark
+{
+public:
+EmphasisMark(FontEmphasisMark eEmphasis, tools::Long nHeight, sal_Int32 
nDPIY);
+
+tools::PolyPolygon GetShape() const { return maPolyPoly; }
+bool IsShapePolyLine() const { return mbIsPolyLine; }
+tools::Rectangle GetRect1() const { return maRect1; }
+tools::Rectangle GetRect2() const { return maRect2; }
+tools::Long GetYOffset() const { return mnYOff; }
+tools::Long GetWidth() const { return mnWidth; }
+
+private:
+tools::PolyPolygon maPolyPoly;
+bool mbIsPolyLine;
+tools::Rectangle maRect1;
+tools::Rectangle maRect2;
+tools::Long mnYOff;
+tools::Long mnWidth;
+};
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index 8023de9d6f07..d989b01cb051 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -12,6 +12,8 @@
 
 #include 
 
+#include 
+
 class VclFontTest : public test::BootstrapFixture
 {
 public:
@@ -27,6 +29,11 @@ public:
 void testSymbolFlagAndCharSet();
 void testEmphasisMar

[Libreoffice-commits] core.git: 2 commits - accessibility/source dbaccess/source include/vcl sfx2/source vcl/Library_vcl.mk vcl/qa vcl/source

2022-08-25 Thread Chris Sherlock (via logerrit)
 accessibility/source/standard/accessiblemenuitemcomponent.cxx |5 
 accessibility/source/standard/vclxaccessibleedit.cxx  |3 
 accessibility/source/standard/vclxaccessibletabpage.cxx   |3 
 accessibility/source/standard/vclxaccessibletextcomponent.cxx |5 
 dbaccess/source/ui/misc/datasourceconnector.cxx   |3 
 include/vcl/mnemonic.hxx  |2 
 include/vcl/outdev.hxx|5 
 include/vcl/window.hxx|2 
 sfx2/source/control/thumbnailviewitem.cxx |3 
 vcl/Library_vcl.mk|1 
 vcl/qa/cppunit/mnemonic.cxx   |   70 ++
 vcl/source/control/ctrl.cxx   |5 
 vcl/source/control/tabctrl.cxx|3 
 vcl/source/gdi/pdfwriter_impl.cxx |3 
 vcl/source/outdev/text.cxx|   46 --
 vcl/source/text/mnemonic.cxx  |   53 +++
 vcl/source/window/accessibility.cxx   |3 
 vcl/source/window/menu.cxx|3 
 vcl/source/window/menuitemlist.cxx|4 
 19 files changed, 160 insertions(+), 62 deletions(-)

New commits:
commit 83e53d664f3c4a476e6e855119b019a2ae691a7c
Author: Chris Sherlock 
AuthorDate: Tue Aug 23 22:25:28 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Aug 25 13:05:39 2022 +0200

vcl: test removeMnemonicsFromString()

Change-Id: Id0a84fb5cb9fa2f6f286ffeab1e1baea641d677a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138728
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/qa/cppunit/mnemonic.cxx b/vcl/qa/cppunit/mnemonic.cxx
index 5a2131da2e3b..fc95fc527068 100644
--- a/vcl/qa/cppunit/mnemonic.cxx
+++ b/vcl/qa/cppunit/mnemonic.cxx
@@ -24,9 +24,23 @@ public:
 }
 
 void testMnemonic();
+void testRemoveMnemonicFromString();
+void testRemoveDoubleMarkedMnemonicFromString();
+void testRemoveMultipleMnemonicsFromString();
+void testRemoveDoubleMarkingsThenMnemonicFromString();
+void testRemoveMnemonicThenDoubleMarkingsFromString();
+void testRemoveMnemonicFromEndOfString();
+void testRemoveNoMnemonicFromString();
 
 CPPUNIT_TEST_SUITE(VclMnemonicTest);
 CPPUNIT_TEST(testMnemonic);
+CPPUNIT_TEST(testRemoveMnemonicFromString);
+CPPUNIT_TEST(testRemoveDoubleMarkedMnemonicFromString);
+CPPUNIT_TEST(testRemoveMultipleMnemonicsFromString);
+CPPUNIT_TEST(testRemoveDoubleMarkingsThenMnemonicFromString);
+CPPUNIT_TEST(testRemoveMnemonicThenDoubleMarkingsFromString);
+CPPUNIT_TEST(testRemoveMnemonicFromEndOfString);
+CPPUNIT_TEST(testRemoveNoMnemonicFromString);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -54,6 +68,62 @@ void VclMnemonicTest::testMnemonic()
 }
 }
 
+void VclMnemonicTest::testRemoveMnemonicFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("this is a ~test", 
nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(10), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveDoubleMarkedMnemonicFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("this ~~is a test", 
nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this ~is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(-1), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveMultipleMnemonicsFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("t~his is a ~test", 
nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveDoubleMarkingsThenMnemonicFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("t~~his is a 
~test", nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("t~his is a test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(11), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveMnemonicThenDoubleMarkingsFromString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("t~his is a 
~~test", nMnemonicIndex);
+CPPUNIT_ASSERT_EQUAL(OUString("this is a ~test"), sNonMnemonicString);
+CPPUNIT_ASSERT_EQUAL(static_cast(1), nMnemonicIndex);
+}
+
+void VclMnemonicTest::testRemoveMnemonicFromEndOfString()
+{
+sal_Int32 nMnemonicIndex;
+OUString sNonMnemonicString = removeMnemonicFromString("this

[Libreoffice-commits] core.git: 2 commits - editeng/source emfio/source filter/source formula/source include/tools sc/source sd/source svtools/source svx/source toolkit/source tools/qa tools/source vc

2022-08-24 Thread Chris Sherlock (via logerrit)
 editeng/source/editeng/editview.cxx  |2 
 editeng/source/editeng/impedit2.cxx  |4 
 editeng/source/editeng/impedit3.cxx  |6 
 emfio/source/reader/emfreader.cxx|2 
 emfio/source/reader/wmfreader.cxx|8 
 filter/source/msfilter/eschesdo.cxx  |2 
 formula/source/ui/dlg/formula.cxx|4 
 include/tools/gen.hxx|   14 -
 sc/source/core/data/drwlayer.cxx |2 
 sc/source/core/data/postit.cxx   |2 
 sc/source/core/tool/detfunc.cxx  |8 
 sc/source/filter/excel/xichart.cxx   |2 
 sc/source/ui/condformat/condformatdlg.cxx|2 
 sc/source/ui/miscdlgs/optsolver.cxx  |2 
 sc/source/ui/miscdlgs/simpref.cxx|2 
 sc/source/ui/pagedlg/areasdlg.cxx|2 
 sc/source/ui/view/gridwin4.cxx   |4 
 sc/source/ui/view/output2.cxx|4 
 sd/source/filter/eppt/epptso.cxx |2 
 sd/source/ui/func/fuzoom.cxx |2 
 sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx |2 
 svtools/source/brwbox/brwbox2.cxx|2 
 svx/source/customshapes/EnhancedCustomShape2d.cxx|6 
 svx/source/dialog/contwnd.cxx|2 
 svx/source/engine3d/scene3d.cxx  |6 
 svx/source/svdraw/svdmrkv.cxx|8 
 svx/source/svdraw/svdoashp.cxx   |2 
 svx/source/svdraw/svdobj.cxx |   14 -
 svx/source/svdraw/svdocirc.cxx   |4 
 svx/source/svdraw/svdomeas.cxx   |2 
 svx/source/svdraw/svdopath.cxx   |2 
 svx/source/svdraw/svdorect.cxx   |2 
 svx/source/svdraw/svdotext.cxx   |2 
 svx/source/svdraw/svdotxdr.cxx   |4 
 svx/source/svdraw/svdotxtr.cxx   |2 
 svx/source/svdraw/svdtrans.cxx   |2 
 svx/source/table/svdotable.cxx   |4 
 toolkit/source/hatchwindow/ipwin.cxx |4 
 tools/qa/cppunit/test_rectangle.cxx  |   98 +++
 tools/source/generic/gen.cxx |8 
 tools/source/generic/poly.cxx|6 
 vcl/source/bitmap/BitmapEx.cxx   |2 
 vcl/source/bitmap/bitmappaint.cxx|2 
 vcl/source/control/edit.cxx  |   22 +-
 vcl/source/control/field.cxx |2 
 vcl/source/control/field2.cxx|   14 -
 vcl/source/control/fmtfield.cxx  |4 
 vcl/source/control/imivctl1.cxx  |6 
 vcl/source/control/scrbar.cxx|6 
 vcl/source/control/slider.cxx|2 
 vcl/source/control/spinbtn.cxx   |2 
 vcl/source/gdi/gdimtf.cxx|2 
 vcl/source/gdi/gradient.cxx  |2 
 vcl/source/gdi/metaact.cxx   |2 
 vcl/source/gdi/print.cxx |4 
 vcl/source/outdev/eps.cxx|2 
 vcl/source/outdev/gradient.cxx   |2 
 vcl/source/outdev/rect.cxx   |4 
 vcl/source/outdev/transparent.cxx|2 
 vcl/source/outdev/wallpaper.cxx  |   10 -
 vcl/source/window/window2.cxx|2 
 vcl/source/window/winproc.cxx|2 
 vcl/unx/generic/window/salframe.cxx  |2 
 63 files changed, 227 insertions(+), 129 deletions(-)

New commits:
commit 6c0bb0f9b846b3f1fee3ff07fb67409708449e0a
Author: Chris Sherlock 
AuthorDate: Tue Aug 23 19:30:02 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Aug 24 10:55:29 2022 +0200

tools: test Rectangle::Normalize()

Change-Id: Ia3fec45b2b6dd0011910c8db5819e161485336c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138713
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/tools/qa/cppunit/test_rectangle.cxx 
b/tools/qa/cppunit/test_rectangle.cxx

[Libreoffice-commits] core.git: include/vcl vcl/qa vcl/source

2022-08-22 Thread Chris Sherlock (via logerrit)
 include/vcl/font.hxx  |1 +
 include/vcl/outdev.hxx|3 ---
 vcl/qa/cppunit/font.cxx   |   24 
 vcl/source/font/font.cxx  |   30 ++
 vcl/source/gdi/pdfwriter_impl.cxx |2 +-
 vcl/source/outdev/font.cxx|   30 ++
 6 files changed, 58 insertions(+), 32 deletions(-)

New commits:
commit fe2fcbf0e564e2b0d8f3dbec326d3423bc5fbcf5
Author: Chris Sherlock 
AuthorDate: Thu Aug 11 21:46:56 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Aug 23 08:30:39 2022 +0200

vcl: move ImplEmphasisMarkStyle() to vcl::Font and add unit test

Change-Id: I958296225c5491a2cd78d64fb16d079272d7c28d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138140
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 824d5c0666c4..b371990ba11c 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -70,6 +70,7 @@ public:
 FontWidth   GetWidthType() const;
 TextAlign   GetAlignment() const;
 rtl_TextEncodingGetCharSet() const;
+FontEmphasisMarkGetEmphasisMarkStyle() const;
 
 boolIsSymbolFont() const;
 
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 9cef5f435aaf..5dab75f230d4 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1145,9 +1145,6 @@ public:
 
 SAL_DLLPRIVATE void ImplGetEmphasisMark( tools::PolyPolygon& 
rPolyPoly, bool& rPolyLine, tools::Rectangle& rRect1, tools::Rectangle& rRect2,
  tools::Long& rYOff, 
tools::Long& rWidth, FontEmphasisMark eEmphasis, tools::Long nHeight );
-SAL_DLLPRIVATE static FontEmphasisMark
-ImplGetEmphasisMarkStyle( const vcl::Font& 
rFont );
-
 boolGetGlyphBoundRects( const Point& rOrigin, 
const OUString& rStr, int nIndex,
 int nLen, std::vector< 
tools::Rectangle >& rVector ) const;
 
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index e99bf12a5124..8023de9d6f07 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -25,6 +25,8 @@ public:
 void testAlignment();
 void testQuality();
 void testSymbolFlagAndCharSet();
+void testEmphasisMarkShouldBePosAboveWhenSimplifiedChinese();
+void testEmphasisMarkShouldBePosAboveWhenNotSimplifiedChinese();
 
 CPPUNIT_TEST_SUITE(VclFontTest);
 CPPUNIT_TEST(testName);
@@ -35,6 +37,8 @@ public:
 CPPUNIT_TEST(testAlignment);
 CPPUNIT_TEST(testQuality);
 CPPUNIT_TEST(testSymbolFlagAndCharSet);
+CPPUNIT_TEST(testEmphasisMarkShouldBePosAboveWhenSimplifiedChinese);
+CPPUNIT_TEST(testEmphasisMarkShouldBePosAboveWhenNotSimplifiedChinese);
 CPPUNIT_TEST_SUITE_END();
 };
 
@@ -154,6 +158,26 @@ void VclFontTest::testSymbolFlagAndCharSet()
 RTL_TEXTENCODING_UNICODE, aFont.GetCharSet() );
 }
 
+void VclFontTest::testEmphasisMarkShouldBePosAboveWhenSimplifiedChinese()
+{
+vcl::Font aFont;
+aFont.SetLanguage(LANGUAGE_CHINESE_SIMPLIFIED);
+aFont.SetEmphasisMark(FontEmphasisMark::Accent);
+
+CPPUNIT_ASSERT_MESSAGE("Emphasis not positioned below", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::PosBelow));
+CPPUNIT_ASSERT_MESSAGE("Accent mark not kept", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::Accent));
+}
+
+void VclFontTest::testEmphasisMarkShouldBePosAboveWhenNotSimplifiedChinese()
+{
+vcl::Font aFont;
+aFont.SetLanguage(LANGUAGE_ENGLISH);
+aFont.SetEmphasisMark(FontEmphasisMark::Accent);
+
+CPPUNIT_ASSERT_MESSAGE("Emphasis not positioned above", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::PosAbove));
+CPPUNIT_ASSERT_MESSAGE("Accent mark not kept", 
(aFont.GetEmphasisMarkStyle() & FontEmphasisMark::Accent));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(VclFontTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index 7aff5af1f7f8..941fe3d6fc0a 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -324,6 +325,35 @@ Font& Font::operator=( vcl::Font&& rFont ) noexcept
 return *this;
 }
 
+FontEmphasisMark Font::GetEmphasisMarkStyle() const
+{
+FontEmphasisMark nEmphasisMark = GetEmphasisMark();
+
+// If no Position is set, then calculate the default position, which
+// depends on the language
+if (!(nEmphasisMark & (FontEmphasisMark::PosAbove | 
FontEmphasisMark::PosBelow)))
+{
+LanguageType eLang = GetLanguage();
+// In Chinese Simplified the EmphasisMarks are below/left
+if (MsLangId::isS

[Libreoffice-commits] core.git: include/vcl

2022-08-19 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |   79 -
 1 file changed, 40 insertions(+), 39 deletions(-)

New commits:
commit 44f64ca9e71bd15e385ac40bf4e726472b107f70
Author: Chris Sherlock 
AuthorDate: Sat Jul 30 22:15:59 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 13:00:59 2022 +0200

vcl: make mapping functions private in OutputDevice

Change-Id: If19db43248d9144f83a205890b3a00a23fcb6267
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138040
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index af55ebd3d614..9cef5f435aaf 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1710,34 +1710,6 @@ public:
 SAL_DLLPRIVATE tools::Long ImplLogicWidthToDevicePixel( 
tools::Long nWidth ) const;
 SAL_DLLPRIVATE double  
ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const;
 
-SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( tools::Long 
nWidth ) const;
-
-/** Convert a logical X coordinate to a device pixel's X coordinate.
-
- To get the device's X coordinate, it must calculate the mapping offset
- coordinate X position (if there is one - if not then it just adds
- the pseudo-window offset to the logical X coordinate), the X-DPI of
- the device and the mapping's X scaling factor.
-
- @param nX  Logical X coordinate
-
- @returns Device's X pixel coordinate
- */
-SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX 
) const;
-
-/** Convert a logical Y coordinate to a device pixel's Y coordinate.
-
- To get the device's Y coordinate, it must calculate the mapping offset
- coordinate Y position (if there is one - if not then it just adds
- the pseudo-window offset to the logical Y coordinate), the Y-DPI of
- the device and the mapping's Y scaling factor.
-
- @param nY  Logical Y coordinate
-
- @returns Device's Y pixel coordinate
- */
-SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel( tools::Long nY 
) const;
-
 /** Convert a logical height to a height in units of device pixels.
 
  To get the number of device pixels, it must calculate the Y-DPI of the 
device and
@@ -1772,17 +1744,6 @@ public:
  */
 SAL_DLLPRIVATE tools::Long ImplDevicePixelToLogicHeight( 
tools::Long nHeight ) const;
 
-/** Convert logical height to device pixels, with exact sub-pixel value.
-
- To get the \em exact pixel height, it must calculate the Y-DPI of the 
device and the
- map scaling factor.
-
- @param fLogicHeight Exact height in logical units.
-
- @returns Exact height in pixels - returns as a float to provide for 
subpixel value.
- */
-SAL_DLLPRIVATE floatImplFloatLogicHeightToDevicePixel( float 
fLogicHeight ) const;
-
 /** Convert a logical size to the size on the physical device.
 
  @param rLogicSize  Const reference to a size in logical units
@@ -1850,6 +1811,46 @@ public:
  @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212)
  */
 SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const;
+
+private:
+SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( tools::Long 
nWidth ) const;
+
+/** Convert a logical X coordinate to a device pixel's X coordinate.
+
+ To get the device's X coordinate, it must calculate the mapping offset
+ coordinate X position (if there is one - if not then it just adds
+ the pseudo-window offset to the logical X coordinate), the X-DPI of
+ the device and the mapping's X scaling factor.
+
+ @param nX  Logical X coordinate
+
+ @returns Device's X pixel coordinate
+ */
+SAL_DLLPRIVATE tools::Long ImplLogicXToDevicePixel( tools::Long nX 
) const;
+
+/** Convert a logical Y coordinate to a device pixel's Y coordinate.
+
+ To get the device's Y coordinate, it must calculate the mapping offset
+ coordinate Y position (if there is one - if not then it just adds
+ the pseudo-window offset to the logical Y coordinate), the Y-DPI of
+ the device and the mapping's Y scaling factor.
+
+ @param nY  Logical Y coordinate
+
+ @returns Device's Y pixel coordinate
+ */
+SAL_DLLPRIVATE tools::Long ImplLogicYToDevicePixel( tools::Long nY 
) const;
+
+/** Convert logical height to device pixels, with exact sub-pixel value.
+
+ To get the \em exact pixel height, it must calculate the Y-DPI of the 
device and the
+ map scaling factor.
+
+ @param fLogicHeight Exact height in logical units.
+
+ @returns Exact height in pixels - returns as a float to provide for 
subpixel value.
+ */
+SAL_DLLPRIVATE floatImplFloatLogicHeightToDevicePixel( float 
fLogicHeight ) const;
 ///@}
 
 


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

2022-08-19 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|   12 ++--
 vcl/source/animate/Animation.cxx |   16 
 vcl/source/animate/AnimationRenderer.cxx |   10 +-
 3 files changed, 19 insertions(+), 19 deletions(-)

New commits:
commit c61d9e70b1bf4948408392217b9fbed9a2dc5ab1
Author: Chris Sherlock 
AuthorDate: Fri Jul 1 17:28:21 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:20:55 2022 +0200

vcl: rename AnimationData fields to more sane names

Change-Id: I5b3ae32b562f300fb33ba8daf5ef438268725a3a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76431
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 95de08014a21..bd4bdc61019e 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -30,12 +30,12 @@ struct AnimationBitmap;
 
 struct AnimationData
 {
-Point   aStartOrg;
-SizeaStartSize;
-VclPtr   pOutDev;
-void*   pRendererData;
-tools::Long nRendererId;
-boolmbIsPaused;
+Point maOriginStartPt;
+Size maStartSize;
+VclPtr mpRenderContext;
+void* mpRendererData;
+tools::Long mnRendererId;
+bool mbIsPaused;
 
 AnimationData();
 };
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 831532d5977a..baa9c186023d 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -301,17 +301,17 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 for (auto& pDataItem : aDataItems)
 {
 AnimationRenderer* pRenderer = nullptr;
-if (!pDataItem->pRendererData)
+if (!pDataItem->mpRendererData)
 {
-pRenderer
-= new AnimationRenderer(this, pDataItem->pOutDev, 
pDataItem->aStartOrg,
-pDataItem->aStartSize, 
pDataItem->nRendererId);
+pRenderer = new AnimationRenderer(
+this, pDataItem->mpRenderContext, 
pDataItem->maOriginStartPt,
+pDataItem->maStartSize, pDataItem->mnRendererId);
 
 
maRenderers.push_back(std::unique_ptr(pRenderer));
 }
 else
 {
-pRenderer = 
static_cast(pDataItem->pRendererData);
+pRenderer = 
static_cast(pDataItem->mpRendererData);
 }
 
 pRenderer->pause(pDataItem->mbIsPaused);
@@ -682,9 +682,9 @@ SvStream& ReadAnimation(SvStream& rIStm, Animation& 
rAnimation)
 }
 
 AnimationData::AnimationData()
-: pOutDev(nullptr)
-, pRendererData(nullptr)
-, nRendererId(0)
+: mpRenderContext(nullptr)
+, mpRendererData(nullptr)
+, mnRendererId(0)
 , mbIsPaused(false)
 {
 }
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index 9bb5efc38ae9..21b43c3c08d6 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -311,11 +311,11 @@ AnimationData* AnimationRenderer::createAnimationData() 
const
 {
 AnimationData* pDataItem = new AnimationData;
 
-pDataItem->aStartOrg = maOriginPt;
-pDataItem->aStartSize = maLogicalSize;
-pDataItem->pOutDev = mpRenderContext;
-pDataItem->pRendererData = const_cast(this);
-pDataItem->nRendererId = mnRendererId;
+pDataItem->maOriginStartPt = maOriginPt;
+pDataItem->maStartSize = maLogicalSize;
+pDataItem->mpRenderContext = mpRenderContext;
+pDataItem->mpRendererData = const_cast(this);
+pDataItem->mnRendererId = mnRendererId;
 pDataItem->mbIsPaused = mbIsPaused;
 
 return pDataItem;


[Libreoffice-commits] core.git: include/tools

2022-08-19 Thread Chris Sherlock (via logerrit)
 include/tools/gen.hxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit f57a7b374e0f2d878cee1fa020af3323145b56a8
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 18:55:34 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:19:48 2022 +0200

tools: use std::swap() in gen.hxx

Change-Id: I01df93aa825ab7a023cd4beb385b5fb41c2847ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137389
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 8182676e0731..ea2c8de2c0e7 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -377,11 +377,7 @@ inline bool Range::Contains( tools::Long nIs ) const
 inline void Range::Justify()
 {
 if ( mnA > mnB )
-{
-tools::Long nHelp = mnA;
-mnA = mnB;
-mnB = nHelp;
-}
+std::swap(mnA, mnB);
 }
 
 inline bool operator ==(Range const & r1, Range const & r2)
@@ -444,11 +440,7 @@ inline bool Selection::Contains( tools::Long nIs ) const
 inline void Selection::Justify()
 {
 if ( mnA > mnB )
-{
-tools::Long nHelp = mnA;
-mnA = mnB;
-mnB = nHelp;
-}
+std::swap(mnA, mnB);
 }
 
 inline bool operator ==(Selection const & s1, Selection const & s2)


[Libreoffice-commits] core.git: include/svl svl/source

2022-08-19 Thread Chris Sherlock (via logerrit)
 include/svl/rectitem.hxx  |4 +--
 svl/source/items/rectitem.cxx |   44 +-
 2 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit e1ab83cbc47ff581dd826d757dd2997743f47d58
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 00:00:12 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Fri Aug 19 10:18:35 2022 +0200

svl: rename SfxRectangleItem::aVal to maVal

Change-Id: I7bc86de644749fb42eba89872828b15be47bb0dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137380
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/svl/rectitem.hxx b/include/svl/rectitem.hxx
index 94465bad4149..26c2acd37b65 100644
--- a/include/svl/rectitem.hxx
+++ b/include/svl/rectitem.hxx
@@ -27,7 +27,7 @@ class SvStream;
 
 class SVL_DLLPUBLIC SfxRectangleItem final : public SfxPoolItem
 {
-tools::RectangleaVal;
+tools::RectanglemaVal;
 
 public:
  static SfxPoolItem* CreateDefault();
@@ -43,7 +43,7 @@ public:
 virtual bool operator==( const SfxPoolItem& ) const override;
 virtual SfxRectangleItem* Clone( SfxItemPool *pPool = nullptr ) const 
override;
 
-const tools::Rectangle& GetValue() const { return aVal; }
+const tools::Rectangle& GetValue() const { return maVal; }
 virtual bool QueryValue( css::uno::Any& rVal,
   sal_uInt8 nMemberId = 0 ) const 
override;
 virtual bool PutValue( const css::uno::Any& rVal,
diff --git a/svl/source/items/rectitem.cxx b/svl/source/items/rectitem.cxx
index 9f6789d3b707..f6a5db309d4b 100644
--- a/svl/source/items/rectitem.cxx
+++ b/svl/source/items/rectitem.cxx
@@ -37,7 +37,7 @@ SfxRectangleItem::SfxRectangleItem()
 
 SfxRectangleItem::SfxRectangleItem( sal_uInt16 nW, const tools::Rectangle& 
rVal ) :
 SfxPoolItem( nW ),
-aVal( rVal )
+maVal( rVal )
 {
 }
 
@@ -51,10 +51,10 @@ bool SfxRectangleItem::GetPresentation
 const IntlWrapper&
 )   const
 {
-rText = OUString::number(aVal.Top())+ ", " +
-OUString::number(aVal.Left())   + ", " +
-OUString::number(aVal.Bottom()) + ", " +
-OUString::number(aVal.Right());
+rText = OUString::number(maVal.Top())+ ", " +
+OUString::number(maVal.Left())   + ", " +
+OUString::number(maVal.Bottom()) + ", " +
+OUString::number(maVal.Right());
 return true;
 }
 
@@ -62,7 +62,7 @@ bool SfxRectangleItem::GetPresentation
 bool SfxRectangleItem::operator==( const SfxPoolItem& rItem ) const
 {
 assert(SfxPoolItem::operator==(rItem));
-return static_cast(rItem).aVal == aVal;
+return static_cast(rItem).maVal == maVal;
 }
 
 SfxRectangleItem* SfxRectangleItem::Clone(SfxItemPool *) const
@@ -78,16 +78,16 @@ bool SfxRectangleItem::QueryValue( css::uno::Any& rVal,
 {
 case 0:
 {
-rVal <<= css::awt::Rectangle( aVal.Left(),
- aVal.Top(),
- aVal.getOpenWidth(),
- aVal.getOpenHeight() );
+rVal <<= css::awt::Rectangle( maVal.Left(),
+ maVal.Top(),
+ maVal.getOpenWidth(),
+ maVal.getOpenHeight() );
 break;
 }
-case MID_RECT_LEFT:  rVal <<= aVal.Left(); break;
-case MID_RECT_RIGHT: rVal <<= aVal.Top(); break;
-case MID_WIDTH: rVal <<= aVal.getOpenWidth(); break;
-case MID_HEIGHT: rVal <<= aVal.getOpenHeight(); break;
+case MID_RECT_LEFT:  rVal <<= maVal.Left(); break;
+case MID_RECT_RIGHT: rVal <<= maVal.Top(); break;
+case MID_WIDTH: rVal <<= maVal.getOpenWidth(); break;
+case MID_HEIGHT: rVal <<= maVal.getOpenHeight(); break;
 default: OSL_FAIL("Wrong MemberID!"); return false;
 }
 
@@ -112,15 +112,15 @@ bool SfxRectangleItem::PutValue( const css::uno::Any& 
rVal,
 switch ( nMemberId )
 {
 case 0:
-aVal.SetLeft( aValue.X );
-aVal.SetTop( aValue.Y );
-aVal.setWidth( aValue.Width );
-aVal.setHeight( aValue.Height );
+maVal.SetLeft( aValue.X );
+maVal.SetTop( aValue.Y );
+maVal.setWidth( aValue.Width );
+maVal.setHeight( aValue.Height );
 break;
-case MID_RECT_LEFT:  aVal.SetPosX( nVal ); break;
-case MID_RECT_RIGHT: aVal.SetPosY( nVal ); break;
-case MID_WIDTH: aVal.setWidth( nVal ); break;
-case

[Libreoffice-commits] core.git: include/vcl

2022-08-10 Thread Chris Sherlock (via logerrit)
 include/vcl/outdev.hxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit bdf98cbb55aa89a15e194a48a7f248abb9465cb7
Author: Chris Sherlock 
AuthorDate: Sat Jul 30 22:01:42 2022 +1000
Commit: Caolán McNamara 
CommitDate: Wed Aug 10 11:46:09 2022 +0200

vcl: remove unused GLYPH_FONT_HEIGHT

GLYPH_FONT_HEIGHT not used since:

Commit: d538d3d84172a74dfe97d59a6d3daf9a45459cab
Short title: This fallback code makes no sense any more

Change-Id: I9c87e2fb2eb33abbc2a7e4d82435704f1a895c75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137631
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index ea14e3d018b7..2595415db1b5 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -138,12 +138,6 @@ namespace com::sun::star::i18n {
 class XBreakIterator;
 }
 
-#if defined UNX
-#define GLYPH_FONT_HEIGHT   128
-#else
-#define GLYPH_FONT_HEIGHT   256
-#endif
-
 // OutputDevice-Types
 
 enum OutDevType { OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV, OUTDEV_PDF };


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

2022-08-09 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|   10 ++---
 vcl/source/animate/Animation.cxx |2 -
 vcl/source/animate/AnimationRenderer.cxx |   62 +++
 3 files changed, 37 insertions(+), 37 deletions(-)

New commits:
commit 91d77d65190e7cf11dd7cd0b29d5de6b66061faf
Author: Chris Sherlock 
AuthorDate: Fri Jul 1 17:16:21 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Aug 10 07:53:08 2022 +0200

vcl: AnimationRenderer::getOutPos() -> GetOriginPosition()

Change-Id: I23275aa9915ea47cb91a8511b219869a4d62b96a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137352
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index bc98f9ac3093..95de08014a21 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -50,11 +50,11 @@ private:
 Animation*  mpParent;
 VclPtr  mpRenderContext;
 tools::Long mnRendererId;
-Point   maPt;
+Point   maOriginPt;
 Point   maDispPt;
 Point   maRestPt;
-SizemaSz;
-SizemaSzPix;
+SizemaLogicalSize;
+SizemaSizePx;
 SizemaDispSz;
 SizemaRestSz;
 vcl::Region maClip;
@@ -82,9 +82,9 @@ public:
 
 voidgetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, 
Size& rSizePix );
 
-const Point&getOutPos() const { return maPt; }
+const Point&getOriginPosition() const { return maOriginPt; }
 
-const Size& getOutSizePix() const { return maSzPix; }
+const Size& getOutSizePix() const { return maSizePx; }
 
 voidpause( bool bIsPaused ) { mbIsPaused = bIsPaused; }
 boolisPaused() const { return mbIsPaused; }
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index 0922dec2bf37..831532d5977a 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -181,7 +181,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& 
rDestPt, const Size& rDes
 
 if (itAnimView != maRenderers.end())
 {
-if ((*itAnimView)->getOutPos() == rDestPt
+if ((*itAnimView)->getOriginPosition() == rDestPt
 && (*itAnimView)->getOutSizePix() == 
rOut.LogicToPixel(rDestSz))
 {
 (*itAnimView)->repaint();
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index e4ce509a694d..9bb5efc38ae9 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -32,10 +32,10 @@ AnimationRenderer::AnimationRenderer( Animation* pParent, 
OutputDevice* pOut,
 OutputDevice* pFirstFrameOutDev ) :
 mpParent( pParent ),
 mpRenderContext ( pFirstFrameOutDev ? pFirstFrameOutDev : pOut ),
-mnRendererId ( nRendererId ),
-maPt( rPt ),
-maSz( rSz ),
-maSzPix ( mpRenderContext->LogicToPixel( maSz ) ),
+mnRendererId( nRendererId ),
+maOriginPt  ( rPt ),
+maLogicalSize   ( rSz ),
+maSizePx( mpRenderContext->LogicToPixel( maLogicalSize ) ),
 maClip  ( mpRenderContext->GetClipRegion() ),
 mpBackground( VclPtr::Create() ),
 mpRestore   ( VclPtr::Create() ),
@@ -43,40 +43,40 @@ AnimationRenderer::AnimationRenderer( Animation* pParent, 
OutputDevice* pOut,
 meLastDisposal  ( Disposal::Back ),
 mbIsPaused  ( false ),
 mbIsMarked  ( false ),
-mbIsMirroredHorizontally ( maSz.Width() < 0 ),
-mbIsMirroredVertically ( maSz.Height() < 0 )
+mbIsMirroredHorizontally( maLogicalSize.Width() < 0 ),
+mbIsMirroredVertically( maLogicalSize.Height() < 0 )
 {
 Animation::ImplIncAnimCount();
 
 // Mirrored horizontally?
 if( mbIsMirroredHorizontally )
 {
-maDispPt.setX( maPt.X() + maSz.Width() + 1 );
-maDispSz.setWidth( -maSz.Width() );
-maSzPix.setWidth( -maSzPix.Width() );
+maDispPt.setX( maOriginPt.X() + maLogicalSize.Width() + 1 );
+maDispSz.setWidth( -maLogicalSize.Width() );
+maSizePx.setWidth( -maSizePx.Width() );
 }
 else
 {
-maDispPt.setX( maPt.X() );
-maDispSz.setWidth( maSz.Width() );
+maDispPt.setX( maOriginPt.X() );
+maDispSz.setWidth( maLogicalSize.Width() );
 }
 
 // Mirrored vertically?
 if( mbIsMirroredVertically )
 {
-maDispPt.setY( maPt.Y() + maSz.Height() + 1 );
-maDispSz.setHeight( -maSz.Height() );
-maSzPix.setHeight( -maS

[Libreoffice-commits] core.git: tools/qa

2022-08-09 Thread Chris Sherlock (via logerrit)
 tools/qa/cppunit/test_json_writer.cxx |   12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

New commits:
commit 57fddf3e644c99715fb3bdf2e107aa2495c0ecf9
Author: Chris Sherlock 
AuthorDate: Sun Jun 19 20:38:44 2022 +1000
Commit: Stephan Bergmann 
CommitDate: Tue Aug 9 15:28:30 2022 +0200

tools: json writer test does not need to use test::BootstrapFixture

Change-Id: Iea7fa63ca7a3208d065ac2960998041672fc8d7c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136231
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/tools/qa/cppunit/test_json_writer.cxx 
b/tools/qa/cppunit/test_json_writer.cxx
index 188b22f9c617..2e0706605745 100644
--- a/tools/qa/cppunit/test_json_writer.cxx
+++ b/tools/qa/cppunit/test_json_writer.cxx
@@ -9,24 +9,18 @@
 
 #include 
 
+#include 
 #include 
+
 #include 
-#include 
 #include 
 #include 
 
 namespace
 {
-class JsonWriterTest : public test::BootstrapFixture
+class JsonWriterTest : public CppUnit::TestFixture
 {
 public:
-JsonWriterTest()
-: BootstrapFixture(true, false)
-{
-}
-
-virtual void setUp() override {}
-
 void test1();
 void test2();
 void testArray();


[Libreoffice-commits] core.git: include/tools solenv/gdb solenv/vs tools/source

2022-08-09 Thread Chris Sherlock (via logerrit)
 include/tools/gen.hxx|  260 +--
 solenv/gdb/libreoffice/tl.py |   16 +-
 solenv/vs/LibreOffice.natvis |   18 +-
 tools/source/generic/gen.cxx |   74 ++--
 4 files changed, 184 insertions(+), 184 deletions(-)

New commits:
commit fd9763cb7ecb05c43bcd23f6aedf73489e1bccb8
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 18:52:21 2022 +1000
Commit: Michael Stahl 
CommitDate: Tue Aug 9 10:51:53 2022 +0200

tools: prefix member variables with an 'm'

Also updated debug pretty-printers

Change-Id: I5204bb8f1c6a47677ad3c49d6579c090ea69aedc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137388
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 35a510124749..8182676e0731 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -42,14 +42,14 @@ enum TriState { TRISTATE_FALSE, TRISTATE_TRUE, 
TRISTATE_INDET };
 class SAL_WARN_UNUSED Pair
 {
 public:
-constexpr Pair() : nA(0), nB(0) {}
-constexpr Pair( tools::Long _nA, tools::Long _nB ) : nA(_nA), nB(_nB) {}
+constexpr Pair() : mnA(0), mnB(0) {}
+constexpr Pair( tools::Long nA, tools::Long nB ) : mnA(nA), mnB(nB) {}
 
-tools::LongA() const { return nA; }
-tools::LongB() const { return nB; }
+tools::LongA() const { return mnA; }
+tools::LongB() const { return mnB; }
 
-tools::Long&   A() { return nA; }
-tools::Long&   B() { return nB; }
+tools::Long&   A() { return mnA; }
+tools::Long&   B() { return mnB; }
 
 TOOLS_DLLPUBLIC rtl::OStringtoString() const;
 
@@ -57,8 +57,8 @@ public:
 TOOLS_DLLPUBLIC size_t GetHashValue() const;
 
 protected:
-tools::LongnA;
-tools::LongnB;
+tools::LongmnA;
+tools::LongmnB;
 };
 
 namespace tools::detail {
@@ -80,13 +80,13 @@ public:
 constexpr Point() {}
 constexpr Point( tools::Long nX, tools::Long nY ) : Pair( nX, nY ) {}
 
-constexpr tools::Long  X() const { return nA; }
-constexpr tools::Long  Y() const { return nB; }
+constexpr tools::Long  X() const { return mnA; }
+constexpr tools::Long  Y() const { return mnB; }
 
 voidMove( tools::Long nHorzMove, tools::Long nVertMove );
 voidMove( Size const & s );
-tools::LongAdjustX( tools::Long nHorzMove ) { nA += 
nHorzMove; return nA; }
-tools::LongAdjustY( tools::Long nVertMove ) { nB += 
nVertMove; return nB; }
+tools::LongAdjustX( tools::Long nHorzMove ) { mnA += 
nHorzMove; return mnA; }
+tools::LongAdjustY( tools::Long nVertMove ) { mnB += 
nVertMove; return mnB; }
 
 voidRotateAround( tools::Long& rX, tools::Long& rY, 
Degree10 nOrientation ) const;
 voidRotateAround( Point&, Degree10 nOrientation ) const;
@@ -103,8 +103,8 @@ public:
 
 constexpr tools::Long  getX() const { return X(); }
 constexpr tools::Long  getY() const { return Y(); }
-voidsetX(tools::Long nX)  { nA = nX; }
-voidsetY(tools::Long nY)  { nB = nY; }
+voidsetX(tools::Long nX)  { mnA = nX; }
+voidsetY(tools::Long nY)  { mnB = nY; }
 
 Pair const &toPair() const { return *this; }
 Pair &  toPair() { return *this; }
@@ -119,56 +119,56 @@ public:
 
 inline void Point::Move( tools::Long nHorzMove, tools::Long nVertMove )
 {
-nA += nHorzMove;
-nB += nVertMove;
+mnA += nHorzMove;
+mnB += nVertMove;
 }
 
 inline Point& Point::operator += ( const Point& rPoint )
 {
-nA += rPoint.nA;
-nB += rPoint.nB;
+mnA += rPoint.mnA;
+mnB += rPoint.mnB;
 return *this;
 }
 
 inline Point& Point::operator -= ( const Point& rPoint )
 {
-nA -= rPoint.nA;
-nB -= rPoint.nB;
+mnA -= rPoint.mnA;
+mnB -= rPoint.mnB;
 return *this;
 }
 
 inline Point& Point::operator *= ( const tools::Long nVal )
 {
-nA *= nVal;
-nB *= nVal;
+mnA *= nVal;
+mnB *= nVal;
 return *this;
 }
 
 inline Point& Point::operator /= ( const tools::Long nVal )
 {
-nA /= nVal;
-nB /= nVal;
+mnA /= nVal;
+mnB /= nVal;
 return *this;
 }
 
 inline Point operator+( const Point &rVal1, const Point &rVal2 )
 {
-return Point( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB );
+return Point( rVal1.mnA+rVal2.mnA, rVal1.mnB+rVal2.mnB );
 }
 
 inline Point operator-( const Point &rVal1, const Point &rVal2 )
 {
-return Point( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
+return Point( rVal1.mnA-rVal2.mnA, rVal1.mnB-rVal2.mnB );
 }
 
 inline Point operator*( co

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

2022-07-28 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|4 ++--
 vcl/source/animate/Animation.cxx |6 +++---
 vcl/source/animate/AnimationRenderer.cxx |2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 756ff6f6dfb24048c43b682a95241d5548a1bb8f
Author: Chris Sherlock 
AuthorDate: Fri Jul 1 17:25:37 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 28 16:27:19 2022 +0200

vcl: Animation - cleanup pause functions and fields

Change-Id: I8a338a92823bd4e4c1f8123d52711d0925357ee6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76430
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 6b86d07bb2de..bc98f9ac3093 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -35,7 +35,7 @@ struct AnimationData
 VclPtr   pOutDev;
 void*   pRendererData;
 tools::Long nRendererId;
-boolbPause;
+boolmbIsPaused;
 
 AnimationData();
 };
@@ -87,7 +87,7 @@ public:
 const Size& getOutSizePix() const { return maSzPix; }
 
 voidpause( bool bIsPaused ) { mbIsPaused = bIsPaused; }
-boolisPause() const { return mbIsPaused; }
+boolisPaused() const { return mbIsPaused; }
 
 voidsetMarked( bool bIsMarked ) { mbIsMarked = bIsMarked; }
 boolisMarked() const { return mbIsMarked; }
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index f7d6a4f27a93..0922dec2bf37 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -314,7 +314,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 pRenderer = 
static_cast(pDataItem->pRendererData);
 }
 
-pRenderer->pause(pDataItem->bPause);
+pRenderer->pause(pDataItem->mbIsPaused);
 pRenderer->setMarked(true);
 }
 
@@ -326,7 +326,7 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 // check if every remaining view is paused
 bGlobalPause = std::all_of(maRenderers.cbegin(), 
maRenderers.cend(),
-   [](const auto& pRenderer) { return 
pRenderer->isPause(); });
+   [](const auto& pRenderer) { return 
pRenderer->isPaused(); });
 
 // reset marked state
 std::for_each(maRenderers.cbegin(), maRenderers.cend(),
@@ -685,7 +685,7 @@ AnimationData::AnimationData()
 : pOutDev(nullptr)
 , pRendererData(nullptr)
 , nRendererId(0)
-, bPause(false)
+, mbIsPaused(false)
 {
 }
 
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index 51aaa590d24b..e4ce509a694d 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -316,7 +316,7 @@ AnimationData* AnimationRenderer::createAnimationData() 
const
 pDataItem->pOutDev = mpRenderContext;
 pDataItem->pRendererData = const_cast(this);
 pDataItem->nRendererId = mnRendererId;
-pDataItem->bPause = mbIsPaused;
+pDataItem->mbIsPaused = mbIsPaused;
 
 return pDataItem;
 }


[Libreoffice-commits] core.git: include/tools

2022-07-28 Thread Chris Sherlock (via logerrit)
 include/tools/gen.hxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 2732115080036e4333fd025ca00396b3ff48c624
Author: Chris Sherlock 
AuthorDate: Sun Jul 24 18:56:34 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Thu Jul 28 16:24:28 2022 +0200

tdf#143148 tools: Use pragma once instead of include guards

Change-Id: Ie34bc66eb1dc475566b315db698976913c8aa37b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137390
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 5ed473c62857..35a510124749 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -16,8 +16,8 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
-#ifndef INCLUDED_TOOLS_GEN_HXX
-#define INCLUDED_TOOLS_GEN_HXX
+
+#pragma once
 
 #include 
 
@@ -823,6 +823,4 @@ inline std::basic_ostream & operator <<(
 }
 }
 
-#endif
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


Justify() vs Normalize()

2022-07-24 Thread Chris Sherlock
Hi all,

I only recently discovered that tools::Rectangle::Justify() really means that 
the 
rectangle is normalized (I.e. the points are arranged in such a way that the 
width is always positive, and the x and y coordinates are in the the top left 
corner).

Would it be possible to rename it to Normalize(), or at least add Normalize() 
as an an alias that calls on Justify()?

Chris


[Libreoffice-commits] core.git: accessibility/inc basctl/inc basic/inc basic/source chart2/inc cui/inc dbaccess/inc forms/source framework/source include/dbaccess include/svtools include/svx include/t

2022-07-20 Thread Chris Sherlock (via logerrit)
 accessibility/inc/helper/IComboListBoxHelper.hxx |2 
 accessibility/inc/pch/precompiled_acc.hxx|   13 ++-
 basctl/inc/pch/precompiled_basctl.hxx|9 ++
 basic/inc/pch/precompiled_sb.hxx |   51 +++---
 basic/source/runtime/methods.cxx |2 
 chart2/inc/pch/precompiled_chartcontroller.hxx   |   25 +++
 cui/inc/pch/precompiled_cui.hxx  |   33 -
 dbaccess/inc/pch/precompiled_dbu.hxx |   11 +--
 forms/source/richtext/richtextcontrol.hxx|2 
 framework/source/helper/tagwindowasmodified.cxx  |2 
 include/dbaccess/dataview.hxx|2 
 include/svtools/valueset.hxx |2 
 include/svx/fmgridif.hxx |2 
 include/vcl/builder.hxx  |2 
 include/vcl/stdtext.hxx  |2 
 include/vcl/toolkit/vclmedit.hxx |2 
 include/vcl/window.hxx   |2 
 include/vcl/wintypes.hxx |6 -
 reportdesign/inc/pch/precompiled_rptui.hxx   |   21 --
 sc/inc/pch/precompiled_sc.hxx|   17 +++-
 sd/inc/pch/precompiled_sd.hxx|   57 +++-
 sd/inc/pch/precompiled_sdui.hxx  |   28 
 sfx2/source/control/listview.cxx |2 
 solenv/clang-format/excludelist  |2 
 svx/inc/pch/precompiled_svxcore.hxx  |   16 +++-
 sw/inc/pch/precompiled_swui.hxx  |   53 +++
 sw/inc/pch/precompiled_vbaswobj.hxx  |   79 +++
 toolkit/inc/helper/imagealign.hxx|2 
 toolkit/source/awt/vclxtoolkit.cxx   |2 
 vcl/source/treelist/svimpbox.cxx |2 
 30 files changed, 247 insertions(+), 204 deletions(-)

New commits:
commit 845393b9aa9057c5ace3c41ad5ac629b895d7f7f
Author: Chris Sherlock 
AuthorDate: Mon Jun 27 19:04:24 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Wed Jul 20 12:20:59 2022 +0200

move wintypes.hxx from tools to vcl

Change-Id: Ief9949fd4252de9e33df172af07aa7ed097b5520
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136560
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/accessibility/inc/helper/IComboListBoxHelper.hxx 
b/accessibility/inc/helper/IComboListBoxHelper.hxx
index e786311fd0df..eed2a757c1e4 100644
--- a/accessibility/inc/helper/IComboListBoxHelper.hxx
+++ b/accessibility/inc/helper/IComboListBoxHelper.hxx
@@ -21,7 +21,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 namespace com::sun::star::datatransfer::clipboard {
diff --git a/accessibility/inc/pch/precompiled_acc.hxx 
b/accessibility/inc/pch/precompiled_acc.hxx
index 33dcf9125def..07f6fa2c8e8d 100644
--- a/accessibility/inc/pch/precompiled_acc.hxx
+++ b/accessibility/inc/pch/precompiled_acc.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2021-11-29 09:45:37 using:
+ Generated on 2022-06-27 18:57:49 using:
  ./bin/update_pch accessibility acc --cutoff=4 --exclude:system 
--include:module --include:local
 
  If after updating build fails, use the following command to locate 
conflicting headers:
@@ -52,6 +52,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #endif // PCH_LEVEL >= 1
@@ -69,6 +70,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,6 +94,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -142,7 +145,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -157,6 +160,7 @@
 #include 
 #include 
 #include 
+#include 
 #endif // PCH_LEVEL >= 2
 #if PCH_LEVEL >= 3
 #include 
@@ -166,6 +170,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -238,7 +243,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -291,7 +295,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -316,7 +319,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -336,7 +338,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/basctl/inc/pch/precompiled_basctl.hxx 
b/basctl/inc/pch/precompiled_basctl.hxx
index 30f9f2560029..9728e1df71b2 100644
--- a/basctl/inc/pch/precompiled_basctl.hxx
+++ b/basctl/inc/pch/precompiled_basctl.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which 
presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2022-01-26 09:11:03 using:
+ Generated on 2022-06-27 18:59:37 using:
  ./bin/update_pch basctl basctl --cutoff=3 --exclude:syst

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

2022-07-19 Thread Chris Sherlock (via logerrit)
 vcl/inc/animate/AnimationRenderer.hxx|6 +++---
 vcl/source/animate/Animation.cxx |   23 ---
 vcl/source/animate/AnimationRenderer.cxx |   18 +-
 3 files changed, 24 insertions(+), 23 deletions(-)

New commits:
commit 44422b97e9d6398919445363b81b4cd1ab184ce3
Author: Chris Sherlock 
AuthorDate: Fri Jun 24 18:16:07 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 19:52:11 2022 +0200

vcl: AInfo -> AnimationData

Change-Id: I4a4f8e2e346010edd1fde004eb9f14b67fc8487a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/76407
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/inc/animate/AnimationRenderer.hxx 
b/vcl/inc/animate/AnimationRenderer.hxx
index 18128558a44e..6b86d07bb2de 100644
--- a/vcl/inc/animate/AnimationRenderer.hxx
+++ b/vcl/inc/animate/AnimationRenderer.hxx
@@ -28,7 +28,7 @@ class OutputDevice;
 class VirtualDevice;
 struct AnimationBitmap;
 
-struct AInfo
+struct AnimationData
 {
 Point   aStartOrg;
 SizeaStartSize;
@@ -37,7 +37,7 @@ struct AInfo
 tools::Long nRendererId;
 boolbPause;
 
-AInfo();
+AnimationData();
 };
 
 
@@ -78,7 +78,7 @@ public:
 voiddrawToIndex( sal_uLong nIndex );
 voiddraw( sal_uLong nIndex, VirtualDevice* pVDev=nullptr );
 voidrepaint();
-AInfo*  createAInfo() const;
+AnimationData*  createAnimationData() const;
 
 voidgetPosSize( const AnimationBitmap& rAnm, Point& rPosPix, 
Size& rSizePix );
 
diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx
index b0270c194c95..f7d6a4f27a93 100644
--- a/vcl/source/animate/Animation.cxx
+++ b/vcl/source/animate/Animation.cxx
@@ -290,30 +290,31 @@ IMPL_LINK_NOARG(Animation, ImplTimeoutHdl, Timer*, void)
 
 if (maNotifyLink.IsSet())
 {
-std::vector> aAInfoList;
-// create AInfo-List
+std::vector> aDataItems;
+// create AnimationData-List
 for (auto const& i : maRenderers)
-aAInfoList.emplace_back(i->createAInfo());
+aDataItems.emplace_back(i->createAnimationData());
 
 maNotifyLink.Call(this);
 
-// set view state from AInfo structure
-for (auto& pAInfo : aAInfoList)
+// set view state from AnimationData structure
+for (auto& pDataItem : aDataItems)
 {
 AnimationRenderer* pRenderer = nullptr;
-if (!pAInfo->pRendererData)
+if (!pDataItem->pRendererData)
 {
-pRenderer = new AnimationRenderer(this, pAInfo->pOutDev, 
pAInfo->aStartOrg,
-  pAInfo->aStartSize, 
pAInfo->nRendererId);
+pRenderer
+= new AnimationRenderer(this, pDataItem->pOutDev, 
pDataItem->aStartOrg,
+pDataItem->aStartSize, 
pDataItem->nRendererId);
 
 
maRenderers.push_back(std::unique_ptr(pRenderer));
 }
 else
 {
-pRenderer = 
static_cast(pAInfo->pRendererData);
+pRenderer = 
static_cast(pDataItem->pRendererData);
 }
 
-pRenderer->pause(pAInfo->bPause);
+pRenderer->pause(pDataItem->bPause);
 pRenderer->setMarked(true);
 }
 
@@ -680,7 +681,7 @@ SvStream& ReadAnimation(SvStream& rIStm, Animation& 
rAnimation)
 return rIStm;
 }
 
-AInfo::AInfo()
+AnimationData::AnimationData()
 : pOutDev(nullptr)
 , pRendererData(nullptr)
 , nRendererId(0)
diff --git a/vcl/source/animate/AnimationRenderer.cxx 
b/vcl/source/animate/AnimationRenderer.cxx
index 59843e19c893..51aaa590d24b 100644
--- a/vcl/source/animate/AnimationRenderer.cxx
+++ b/vcl/source/animate/AnimationRenderer.cxx
@@ -307,18 +307,18 @@ void AnimationRenderer::repaint()
 mbIsPaused = bOldPause;
 }
 
-AInfo* AnimationRenderer::createAInfo() const
+AnimationData* AnimationRenderer::createAnimationData() const
 {
-AInfo* pAInfo = new AInfo;
+AnimationData* pDataItem = new AnimationData;
 
-pAInfo->aStartOrg = maPt;
-pAInfo->aStartSize = maSz;
-pAInfo->pOutDev = mpRenderContext;
-pAInfo->pRendererData = const_cast(this);
-pAInfo->nRendererId = mnRendererId;
-pAInfo->bPause = mbIsPaused;
+pDataItem->aStartOrg = maPt;
+pDataItem->aStartSize = maSz;
+pDataItem->pOutDev = mpRenderContext;
+pDataItem->pRendererData = const_cast(this);
+pDataItem->nRendererId = mnRendererId;
+pDataItem->bPause = mbIsPaused;
 
-return pAInfo;
+return pDataItem;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: vcl/qa vcl/source

2022-07-19 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/complextext.cxx |   14 +++---
 vcl/source/outdev/text.cxx |8 
 2 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 4d9e9ff5f4cb199844eb1d2b4000bb837089347f
Author: Chris Sherlock 
AuthorDate: Thu Jun 30 21:07:26 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 12:59:54 2022 +0200

vcl: allow OutputDevice::GetTextRect() cater for rotated fonts

Change-Id: I52bdfe75ef1dd7973d14cad72e31a1e559bb7876
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136667
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a7cf83d4edfd..d6c624fa7406 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -98,27 +98,19 @@ void VclComplexTextTest::testArabic()
 CPPUNIT_ASSERT_DOUBLES_EQUAL(71, aBoundRect.GetWidth(), 2); // This 
sometimes equals to 70
 CPPUNIT_ASSERT_DOUBLES_EQUAL(15, aBoundRect.getOpenHeight(), 1);
 
-#if 0
-// FIXME: This seems to be wishful thinking, GetTextRect() does not take
-// rotation into account.
-
 // normal orientation
 tools::Rectangle aInput;
 tools::Rectangle aRect = pOutDev->GetTextRect( aInput, aOneTwoThree );
 
 // now rotate 270 degrees
 vcl::Font aRotated( aFont );
-aRotated.SetOrientation( 2700 );
+aRotated.SetOrientation( 2700_deg10 );
 pOutDev->SetFont( aRotated );
 tools::Rectangle aRectRot = pOutDev->GetTextRect( aInput, aOneTwoThree );
 
 // Check that we did do the rotation...
-fprintf( stderr, "%" SAL_PRIdINT64 " %" SAL_PRIdINT64 " %" SAL_PRIdINT64 " 
%" SAL_PRIdINT64 "\n",
- sal_Int64(aRect.GetWidth()), sal_Int64(aRect.GetHeight()),
- sal-Int64(aRectRot.GetWidth()), sal_Int64(aRectRot.GetHeight()) );
-CPPUNIT_ASSERT( aRectRot.GetWidth() == aRect.GetHeight() );
-CPPUNIT_ASSERT( aRectRot.GetHeight() == aRect.GetWidth() );
-#endif
+CPPUNIT_ASSERT_EQUAL( aRectRot.GetWidth(), aRect.GetHeight() );
+CPPUNIT_ASSERT_EQUAL( aRectRot.GetHeight(), aRect.GetWidth() );
 #endif
 }
 
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index e82d89930b6d..2f7199fa3fa3 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2042,6 +2042,14 @@ tools::Rectangle OutputDevice::GetTextRect( const 
tools::Rectangle& rRect,
 aRect.AdjustLeft( -1 );
 else
 aRect.AdjustRight( 1 );
+
+if (maFont.GetOrientation() != 0_deg10)
+{
+tools::Polygon aRotatedPolygon(aRect);
+aRotatedPolygon.Rotate(Point(aRect.GetWidth() / 2, aRect.GetHeight() / 
2), maFont.GetOrientation());
+return aRotatedPolygon.GetBoundRect();
+}
+
 return aRect;
 }
 


[Libreoffice-commits] core.git: vcl/qa vcl/source

2022-07-19 Thread Chris Sherlock (via logerrit)
 vcl/qa/cppunit/complextext.cxx |2 +-
 vcl/source/app/svapp.cxx   |2 +-
 vcl/source/control/scrbar.cxx  |4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9e7aee7c85b5ef341705d2969461bc96743fcbcc
Author: Chris Sherlock 
AuthorDate: Mon Jul 18 19:46:22 2022 +1000
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 12:05:10 2022 +0200

vcl: migrate from getOpenHeight/Width() to GetWidth/Height()

Change-Id: Ia51d6a6f2e9dcb6ba6193f7617848e7bd560dabb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137170
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/vcl/qa/cppunit/complextext.cxx b/vcl/qa/cppunit/complextext.cxx
index a79fe420884d..a7cf83d4edfd 100644
--- a/vcl/qa/cppunit/complextext.cxx
+++ b/vcl/qa/cppunit/complextext.cxx
@@ -95,7 +95,7 @@ void VclComplexTextTest::testArabic()
 pOutDev->GetTextBoundRect(aBoundRect, aOneTwoThree);
 CPPUNIT_ASSERT_DOUBLES_EQUAL(0, aBoundRect.Left(), 1); // This sometimes 
equals to 1
 CPPUNIT_ASSERT_DOUBLES_EQUAL(1, aBoundRect.Top(), 1);
-CPPUNIT_ASSERT_DOUBLES_EQUAL(71, aBoundRect.getOpenWidth(), 1); // This 
sometimes equals to 70
+CPPUNIT_ASSERT_DOUBLES_EQUAL(71, aBoundRect.GetWidth(), 2); // This 
sometimes equals to 70
 CPPUNIT_ASSERT_DOUBLES_EQUAL(15, aBoundRect.getOpenHeight(), 1);
 
 #if 0
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c315c35f0fd1..36beccb6bcb5 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1375,7 +1375,7 @@ tools::Rectangle Application::GetScreenPosSizePixel( 
unsigned int nScreen )
 return tools::Rectangle();
 }
 tools::Rectangle aRect = pSys->GetDisplayScreenPosSizePixel(nScreen);
-if (aRect.getOpenHeight() == 0)
+if (aRect.GetHeight() == 0)
 SAL_WARN("vcl", "Requesting screen size/pos for screen #" << nScreen 
<< " returned 0 height.");
 return aRect;
 }
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 7ef7174ee714..79fb1d4c11df 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1118,12 +1118,12 @@ IMPL_LINK_NOARG(ScrollBar, ImplAutoTimerHdl, Timer *, 
void)
 void ScrollBar::ImplInvert()
 {
 tools::Rectangle aRect( maThumbRect );
-if( aRect.getOpenWidth() > 4 )
+if( aRect.GetWidth() > 5 )
 {
 aRect.AdjustLeft(2 );
 aRect.AdjustRight( -2 );
 }
-if( aRect.getOpenHeight() > 4 )
+if( aRect.GetHeight() > 5 )
 {
 aRect.AdjustTop(2 );
 aRect.AdjustBottom( -2 );


[Libreoffice-commits] core.git: basegfx/source include/basegfx sc/inc sc/source sd/source svx/source sw/source

2022-07-13 Thread Chris Sherlock (via logerrit)
 basegfx/source/tools/zoomtools.cxx |   16 
 include/basegfx/utils/zoomtools.hxx|5 ++---
 sc/inc/global.hxx  |4 ++--
 sc/source/ui/view/prevwsh.cxx  |   10 +-
 sc/source/ui/view/tabview.cxx  |8 
 sc/source/ui/view/tabvwsh3.cxx |8 
 sd/source/ui/view/viewshel.cxx |8 
 svx/source/stbctrls/zoomsliderctrl.cxx |4 ++--
 sw/source/uibase/uiview/view2.cxx  |2 +-
 sw/source/uibase/uiview/viewport.cxx   |6 +++---
 10 files changed, 35 insertions(+), 36 deletions(-)

New commits:
commit ac2a6ee9618e377806e529ed641f67e88684f7e7
Author: Chris Sherlock 
AuthorDate: Mon Jun 13 17:20:15 2022 +1000
Commit: Thorsten Behrens 
CommitDate: Wed Jul 13 18:54:28 2022 +0200

basegfx: zoomIn() and zoomOut() should be sal_uInt16

All zoom functions use sal_uInt16 values. For some reason, basegfx used
long when zoomIn and zoomOut were created in 2012 (see commit
315d2ddc16: "optimized zoom to use more common intervals"), this then
got mass converted to tools::Long in commit 387a88fa25: "use tools::Long
in basegfx..chart2".

So fix is to change zoomIn/Out() to use sal_uInt16.

Change-Id: I2a56d6f58e14f77aeb8741d332fe9bc282eb969f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135715
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/basegfx/source/tools/zoomtools.cxx 
b/basegfx/source/tools/zoomtools.cxx
index 4fedb8ee848c..dd4c7a6cbbd3 100644
--- a/basegfx/source/tools/zoomtools.cxx
+++ b/basegfx/source/tools/zoomtools.cxx
@@ -26,7 +26,7 @@ const double ZOOM_FACTOR = 1.12246205;
 * @param nCurrent current value
 * @param nMultiple multiple against which the current value is rounded
 */
-static tools::Long roundMultiple(tools::Long nCurrent, int nMultiple)
+static sal_uInt16 roundMultiple(sal_uInt16 nCurrent, int nMultiple)
 {
 // round zoom to a multiple of nMultiple
 return (( nCurrent + nMultiple / 2 ) - ( nCurrent + nMultiple / 2 ) % 
nMultiple);
@@ -39,10 +39,10 @@ static tools::Long roundMultiple(tools::Long nCurrent, int 
nMultiple)
 *
 * @param nCurrent current zoom factor
 */
-static tools::Long roundZoom(double nCurrent)
+static sal_uInt16 roundZoom(double nCurrent)
 {
 // convert nCurrent properly to int
-tools::Long nNew = nCurrent + 0.5;
+sal_uInt16 nNew = nCurrent + 0.5;
 
 // round to more common numbers above 50
 if (nNew > 1000) {
@@ -66,7 +66,7 @@ static tools::Long roundZoom(double nCurrent)
 * @param nPrevious previous zoom factor
 * @param nStep step which shouldn't be skipped
 */
-static tools::Long enforceStep(tools::Long nCurrent, tools::Long nPrevious, 
int nStep)
+static sal_uInt16 enforceStep(sal_uInt16 nCurrent, sal_uInt16 nPrevious, 
unsigned int nStep)
 {
 if ((( nCurrent > nStep ) && ( nPrevious < nStep ))
 || (( nCurrent < nStep ) && ( nPrevious > nStep )))
@@ -80,9 +80,9 @@ static tools::Long enforceStep(tools::Long nCurrent, 
tools::Long nPrevious, int
 *
 * @param nCurrent current zoom factor
 */
-tools::Long zoomIn(tools::Long nCurrent)
+sal_uInt16 zoomIn(sal_uInt16 nCurrent)
 {
-tools::Long nNew = roundZoom( nCurrent * ZOOM_FACTOR );
+sal_uInt16 nNew = roundZoom( nCurrent * ZOOM_FACTOR );
 // make sure some values are not skipped
 nNew = enforceStep(nNew, nCurrent, 200);
 nNew = enforceStep(nNew, nCurrent, 100);
@@ -97,9 +97,9 @@ tools::Long zoomIn(tools::Long nCurrent)
 *
 * @param nCurrent current zoom factor
 */
-tools::Long zoomOut(tools::Long nCurrent)
+sal_uInt16 zoomOut(sal_uInt16 nCurrent)
 {
-tools::Long nNew = roundZoom( nCurrent / ZOOM_FACTOR );
+sal_uInt16 nNew = roundZoom( nCurrent / ZOOM_FACTOR );
 // make sure some values are not skipped
 nNew = enforceStep(nNew, nCurrent, 200);
 nNew = enforceStep(nNew, nCurrent, 100);
diff --git a/include/basegfx/utils/zoomtools.hxx 
b/include/basegfx/utils/zoomtools.hxx
index 242c10e6dafc..16a36448af49 100644
--- a/include/basegfx/utils/zoomtools.hxx
+++ b/include/basegfx/utils/zoomtools.hxx
@@ -10,14 +10,13 @@
 #pragma once
 
 #include 
-#include 
 
 namespace basegfx::zoomtools
 {
 /** This namespace provides functions for optimized geometric zooming
 */
-BASEGFX_DLLPUBLIC tools::Long zoomOut(tools::Long nCurrent);
-BASEGFX_DLLPUBLIC tools::Long zoomIn(tools::Long nCurrent);
+BASEGFX_DLLPUBLIC sal_uInt16 zoomOut(sal_uInt16 nCurrent);
+BASEGFX_DLLPUBLIC sal_uInt16 zoomIn(sal_uInt16 nCurrent);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 47b93c845296..8401ca4c6f7e 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -75,8 +75,8 @@ const sal_Unicode CHAR_NNBSP= 0x202F; //NARROW NO-BREAK 
SPACE
 #define MINDOUBLE   1.7e-307
 #define MAXDOUBLE   1.7e307
 
-#define MINZOOM 20
-#define MAXZOOM 400
+const sal_uInt16

  1   2   3   4   5   6   7   8   9   10   >