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

2022-11-18 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx  |5 +
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx|   14 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |   11 ---
 include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx |   29 ++
 4 files changed, 37 insertions(+), 22 deletions(-)

New commits:
commit 785aa638acb920316fe78bedab3a512fb384535a
Author: Armin Le Grand (allotropia) 
AuthorDate: Fri Nov 18 11:01:23 2022 +0100
Commit: Armin Le Grand 
CommitDate: Fri Nov 18 20:59:47 2022 +0100

Turn around usage of TextHierarchyEditPrimitive2D

This primitive is created if a text edit is active
and contains it's current content, not from model
data itself.
Pixel renderers need to suppress that content, it
gets displayed by the active TextEdit in the EditView.
Suppression is done by decomposing to nothing by
default.
MetaFile renderers have to show it, so that the
edited text is part of the MetaFile, e.g. needed
for presentation previews and exports.
So take action here and process it's content.
Note: Former error was #i97628#

Change-Id: I32c83c0ad7883a79fc40f5a21ac6ed7b1055b7df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142910
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx 
b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx
index c7af9562adc1..93cb4e455d76 100644
--- a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx
@@ -136,8 +136,9 @@ namespace drawinglayer::primitive2d
 }
 
 
-
TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(Primitive2DContainer&&
 aChildren)
-:   GroupPrimitive2D(std::move(aChildren))
+
TextHierarchyEditPrimitive2D::TextHierarchyEditPrimitive2D(Primitive2DContainer&&
 aContent)
+:   BasePrimitive2D()
+,   maContent(std::move(aContent))
 {
 }
 
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 539e01282a2f..eb5f32e0c678 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -926,6 +926,20 @@ void VclMetafileProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimi
 static_cast(rCandidate));
 break;
 }
+case PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D:
+{
+// This primitive is created if a text edit is active and contains 
it's
+// current content, not from model data itself.
+// Pixel renderers need to suppress that content, it gets 
displayed by the active
+// TextEdit in the EditView. Suppression is done by decomposing to 
nothing.
+// MetaFile renderers have to show it, so that the edited text is 
part of the
+// MetaFile, e.g. needed for presentation previews and exports.
+// So take action here and process it's content:
+// Note: Former error was #i97628#
+process(static_cast(rCandidate)
+.getContent());
+break;
+}
 case PRIMITIVE2D_ID_EPSPRIMITIVE2D:
 {
 RenderEpsPrimitive2D(static_cast(rCandidate));
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index f701ad9bbeeb..7852131ee98f 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -355,17 +355,6 @@ void VclPixelProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimitiv
 static_cast(rCandidate));
 break;
 }
-case PRIMITIVE2D_ID_TEXTHIERARCHYEDITPRIMITIVE2D:
-{
-// #i97628#
-// This primitive means that the content is derived from an active 
text edit,
-// not from model data itself. Some renderers need to suppress 
this content, e.g.
-// the pixel renderer used for displaying the edit view (like this 
one). It's
-// not to be suppressed by the MetaFile renderers, so that the 
edited text is
-// part of the MetaFile, e.g. needed for presentation previews.
-// Action: Ignore here, do nothing.
-break;
-}
 case PRIMITIVE2D_ID_INVERTPRIMITIVE2D:
 {
 processInvertPrimitive2D(rCandidate);
diff --git a/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx 
b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
index 00972a2843df..da388d935eac 100644
--- a/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
+++ 

[Libreoffice-commits] core.git: drawinglayer/source filter/source include/drawinglayer svgio/source svx/source

2022-11-15 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/bitmapprimitive2d.cxx |   19 ++
 drawinglayer/source/primitive2d/controlprimitive2d.cxx|2 -
 drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx |2 -
 drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx |   16 
 drawinglayer/source/primitive2d/glowprimitive2d.cxx   |9 ++--
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx  |4 +-
 drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx|2 -
 drawinglayer/source/primitive2d/patternfillprimitive2d.cxx|2 -
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx  |2 -
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx |7 +--
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx   |7 +--
 drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx  |4 +-
 drawinglayer/source/processor2d/hittestprocessor2d.cxx|2 -
 drawinglayer/source/processor2d/vclprocessor2d.cxx|2 -
 drawinglayer/source/tools/emfphelperdata.cxx  |2 -
 drawinglayer/source/tools/primitive2dxmldump.cxx  |2 -
 drawinglayer/source/tools/wmfemfhelper.cxx|2 -
 filter/source/pdf/pdfdecomposer.cxx   |3 -
 include/drawinglayer/primitive2d/bitmapprimitive2d.hxx|   17 ++--
 svgio/source/svgreader/svgimagenode.cxx   |2 -
 svx/source/sdr/contact/viewcontactofgraphic.cxx   |2 -
 svx/source/sdr/overlay/overlaytools.cxx   |2 -
 22 files changed, 45 insertions(+), 67 deletions(-)

New commits:
commit 8011b16e05c97a92efee2debb23f5eae60f1236b
Author: Noel Grandin 
AuthorDate: Tue Nov 15 19:12:43 2022 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 16 07:57:00 2022 +0100

Use BitmapEx in BitmapPrimitive2D

we no longer need to wrap it in the framework XBitmap
implemenation

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

diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx 
b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
index 519ad153696b..7dc58c3fe00a 100644
--- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
@@ -26,9 +26,8 @@ using namespace com::sun::star;
 
 namespace drawinglayer::primitive2d
 {
-BitmapPrimitive2D::BitmapPrimitive2D(css::uno::Reference 
xXBitmap,
- basegfx::B2DHomMatrix aTransform)
-: maXBitmap(std::move(xXBitmap))
+BitmapPrimitive2D::BitmapPrimitive2D(BitmapEx xXBitmap, basegfx::B2DHomMatrix 
aTransform)
+: maBitmap(std::move(xXBitmap))
 , maTransform(std::move(aTransform))
 {
 }
@@ -39,7 +38,7 @@ bool BitmapPrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
 {
 const BitmapPrimitive2D& rCompare = static_cast(rPrimitive);
 
-return (getXBitmap() == rCompare.getXBitmap() && getTransform() == 
rCompare.getTransform());
+return (getBitmap() == rCompare.getBitmap() && getTransform() == 
rCompare.getTransform());
 }
 
 return false;
@@ -55,19 +54,11 @@ BitmapPrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& /*rViewInforma
 
 sal_Int64 BitmapPrimitive2D::estimateUsage()
 {
-if (!getXBitmap().is())
+if (getBitmap().IsEmpty())
 {
 return 0;
 }
-
-uno::Reference const xAcc(getXBitmap(), uno::UNO_QUERY);
-
-if (!xAcc.is())
-{
-return 0;
-}
-
-return xAcc->estimateUsage();
+return getBitmap().GetSizeBytes();
 }
 
 // provide unique ID
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx 
b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 14d4f7b69446..c776319e86f5 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -198,7 +198,7 @@ namespace drawinglayer::primitive2d
 
 // create primitive
 xRetval = new BitmapPrimitive2D(
-VCLUnoHelper::CreateVCLXBitmap(aContent),
+aContent,
 aBitmapTransform);
 }
 catch( const uno::Exception& )
diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx 
b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
index 8a86f83204bd..7ec7040ff2a1 100644
--- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
@@ -66,7 +66,7 @@ namespace drawinglayer::primitive2d
 // create BitmapPrimitive2D with now object-local coordinate data
 

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

2022-11-15 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/tools/converters.cxx |   32 ++-
 include/drawinglayer/converters.hxx  |   10 +
 2 files changed, 29 insertions(+), 13 deletions(-)

New commits:
commit 3aadb8a87449c9a3141bef1e41353ec57b03ad79
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Nov 15 10:55:17 2022 +0100
Commit: Armin Le Grand 
CommitDate: Tue Nov 15 16:01:33 2022 +0100

Prepare createAlphaMask to produce mask and alpha as needed

Change-Id: Ica799419ed628f94f134433ca5b37518c5698909
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142730
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 56d5d8a5fb47..8167f8bf3f60 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -73,7 +73,7 @@ bool 
implPrepareConversion(drawinglayer::primitive2d::Primitive2DContainer& rSeq
 
 AlphaMask implcreateAlphaMask(drawinglayer::primitive2d::Primitive2DContainer& 
rSequence,
   const drawinglayer::geometry::ViewInformation2D& 
rViewInformation2D,
-  const Size& rSizePixel)
+  const Size& rSizePixel, bool bUseLuminance)
 {
 ScopedVclPtrInstance pContent;
 
@@ -98,11 +98,24 @@ AlphaMask 
implcreateAlphaMask(drawinglayer::primitive2d::Primitive2DContainer& r
 // set alpha to all white (fully transparent)
 pContent->Erase();
 
+basegfx::BColorModifierSharedPtr aBColorModifier;
+
+if (bUseLuminance)
+{
+// new mode: bUseLuminance allows simple creation of alpha channels
+//   for any content (e.g. gradients)
+aBColorModifier = 
std::make_shared();
+}
+else
+{
+// Embed primitives to paint them black
+aBColorModifier
+= 
std::make_shared(basegfx::BColor(0.0, 0.0, 
0.0));
+}
 // embed primitives to paint them black
 const drawinglayer::primitive2d::Primitive2DReference xRef(
-new drawinglayer::primitive2d::ModifiedColorPrimitive2D(
-std::move(rSequence),
-
std::make_shared(basegfx::BColor(0.0, 0.0, 
0.0;
+new 
drawinglayer::primitive2d::ModifiedColorPrimitive2D(std::move(rSequence),
+
aBColorModifier));
 const drawinglayer::primitive2d::Primitive2DContainer xSeq{ xRef };
 
 // render
@@ -121,7 +134,7 @@ namespace drawinglayer
 AlphaMask createAlphaMask(drawinglayer::primitive2d::Primitive2DContainer&& 
rSeq,
   const geometry::ViewInformation2D& 
rViewInformation2D,
   sal_uInt32 nDiscreteWidth, sal_uInt32 
nDiscreteHeight,
-  sal_uInt32 nMaxSquarePixels)
+  sal_uInt32 nMaxSquarePixels, bool bUseLuminance)
 {
 drawinglayer::primitive2d::Primitive2DContainer aSequence(std::move(rSeq));
 
@@ -132,7 +145,7 @@ AlphaMask 
createAlphaMask(drawinglayer::primitive2d::Primitive2DContainer&& rSeq
 
 const Size aSizePixel(nDiscreteWidth, nDiscreteHeight);
 
-return implcreateAlphaMask(aSequence, rViewInformation2D, aSizePixel);
+return implcreateAlphaMask(aSequence, rViewInformation2D, aSizePixel, 
bUseLuminance);
 }
 
 BitmapEx convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& 
rSeq,
@@ -182,7 +195,7 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 // This gives good results, it is in principle comparable with
 // the results using pre-multiplied alpha tooling, also reducing
 // the range of values where high alpha values are used.
-ScopedVclPtrInstance< VirtualDevice > 
pContent(*Application::GetDefaultDevice());
+ScopedVclPtrInstance 
pContent(*Application::GetDefaultDevice());
 
 // prepare vdev
 if (!pContent->SetOutputSizePixel(aSizePixel, false))
@@ -217,7 +230,8 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 OUString::createFromAscii(std::getenv("VCL_DUMP_BMP_PATH")));
 if (!sDumpPath.isEmpty())
 {
-SvFileStream aNew(sDumpPath + "test_content.bmp", 
StreamMode::WRITE | StreamMode::TRUNC);
+SvFileStream aNew(sDumpPath + "test_content.bmp",
+  StreamMode::WRITE | StreamMode::TRUNC);
 WriteDIB(aRetval, aNew, false, true);
 }
 }
@@ -226,7 +240,7 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 // Create the AlphaMask using a method that does this always correct (also 
used
 // now in GlowPrimitive2D and ShadowPrimitive2D which both only need the
 // AlphaMask to do their job, so speeding that up, too).
-AlphaMask aAlpha(implcreateAlphaMask(aSequence, rViewInformation2D, 
aSizePixel));
+AlphaMask aAlpha(implcreateAlphaMask(aSequence, 

[Libreoffice-commits] core.git: drawinglayer/source qadevOOo/tests tools/source vcl/source

2022-11-13 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/tools/converters.cxx |8 

 qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetFactory.java |2 +-
 qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetStubFactory.java |2 +-
 qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetFactory.java |2 +-
 tools/source/generic/b3dtrans.cxx|2 +-
 vcl/source/bitmap/bitmap.cxx |2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 517d05dbfd1e25e51d4b813f5a4c53b89464aa43
Author: Andrea Gelmini 
AuthorDate: Sun Nov 13 20:41:31 2022 +0100
Commit: Julien Nabet 
CommitDate: Sun Nov 13 22:21:58 2022 +0100

Fix typos

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

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 332d91dcc7c4..56d5d8a5fb47 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -151,7 +151,7 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 const Size aSizePixel(nDiscreteWidth, nDiscreteHeight);
 
 // Create target VirtualDevice. Go back to using a simple RGB
-// target version (comared with former version, see history).
+// target version (compared with former version, see history).
 // Reasons are manyfold:
 // - Avoid the RGBA mode for VirtualDevice (two VDevs)
 //   - It's not suggested to be used outside presentation engine
@@ -163,13 +163,13 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 //   than the VCL-based ones) will probably not support splitted
 //   VDevs for content/alpha, so require a method that works with
 //   RGB targeting (for now)
-// - Less ressource usage, better speed (no 2 VDevs, no merge of
+// - Less resource usage, better speed (no 2 VDevs, no merge of
 //   AlphaChannels)
 // As long as not all our mechanisms are changed to RGBA completely,
 // mixing these is just too dangerous and expensive and may to wrong
 // or deliver bad quality results.
 // Nonetheless we need a RGBA result here. Luckily we are able to
-// create a copmplete and valid AlphaChannel using 'createAlphaMask'
+// create a complete and valid AlphaChannel using 'createAlphaMask'
 // above.
 // When we know the content (RGB result from renderer), alpha
 // (result from createAlphaMask) and the start condition (content
@@ -181,7 +181,7 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 // any other rendering. It could be further optimized, too.
 // This gives good results, it is in principle comparable with
 // the results using pre-multiplied alpha tooling, also reducing
-// the range of values where high alpha vlaues are used.
+// the range of values where high alpha values are used.
 ScopedVclPtrInstance< VirtualDevice > 
pContent(*Application::GetDefaultDevice());
 
 // prepare vdev
diff --git a/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetFactory.java 
b/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetFactory.java
index d3174d926703..a6dc5da82095 100644
--- a/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetFactory.java
+++ b/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetFactory.java
@@ -67,7 +67,7 @@ public class _XCachedContentResultSetFactory extends 
MultiMethodTest {
 /**
 * Creates result set from result set stub. After that number
 * of rows from result set created and its stub are retrieved
-* using their static representations and comared. 
+* using their static representations and compared. 
 * Has OK status if numbers of rows are equal and they are
 * greater than 0 (because JAR file contains at least one entry).
 */
diff --git 
a/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetStubFactory.java 
b/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetStubFactory.java
index 90f3d4688a35..afc6ce77a87f 100644
--- a/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetStubFactory.java
+++ b/qadevOOo/tests/java/ifc/ucb/_XCachedContentResultSetStubFactory.java
@@ -65,7 +65,7 @@ public class _XCachedContentResultSetStubFactory extends 
MultiMethodTest {
 /**
 * Creates cached result set stub from static result set. After that number
 * of rows in cached result set created and its source set are retrieved
-* and comared. 
+* and compared. 
 * Has OK status if numbers of rows are equal and they are
 * greater than 0 (because JAR file contains at least one entry).
 */
diff --git a/qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetFactory.java 
b/qadevOOo/tests/java/ifc/ucb/_XCachedDynamicResultSetFactory.java
index 

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

2022-11-13 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/tools/converters.cxx |  104 ---
 include/vcl/alpha.hxx|3 
 include/vcl/bitmap.hxx   |   23 ++
 vcl/source/bitmap/alpha.cxx  |   28 
 vcl/source/bitmap/bitmap.cxx |   69 
 5 files changed, 191 insertions(+), 36 deletions(-)

New commits:
commit 651142cbc6305b182a22efbdc4524e614483cf88
Author: Armin Le Grand (allotropia) 
AuthorDate: Thu Nov 10 12:03:55 2022 +0100
Commit: Armin Le Grand 
CommitDate: Sun Nov 13 10:09:20 2022 +0100

Adapted convertToBitmapEx to simpler BitmapEx creation

As long as not all our mechanisms are changed to RGBA
completely, mixing OutDev with Alpha (2x VDev) and RGB
target rendering is just too dangerous and expensive
and may to wrong or deliver bad quality results (see
comments in code for details).

Nonetheless we need a RGBA result for convert to
BitmapEx. Luckily we are able to create a copmplete
and valid AlphaChannel using 'createAlphaMask'.

Based n that we know the content (RGB result from
renderer), alpha (result from createAlphaMask) and
the start condition (content rendered usually
against COL_WHITE). Tht makes it possible to
calculate back the content, quasi 'remove' that
initial blending against COL_WHITE.

That is what the helper Bitmap::RemoveBlendedStartColor
does. Luckily we only need it for convert To BitmapEx,
not in any other rendering.

This gives good results, it is in principle comparable
with the results using pre-multiplied alpha tooling,
also slightly reducing the range of color values where
high alpha vlaues are used, but in areas that are
highly transparent anyways.

Also important is that this will work with RGB-based
system-dependent renderers, too. The method before
could only work with the VCL-based primitive renderers
by principle (only there - by coincidence - OutputDevice
with Alpha worked).

NOTE: Had to re-add usage of *unused* alpha channel
in convertToBitmapEx due to test SdPNGExportTest. It
somehow creates an Alpha in Bitmap size when I *remove*
Alpha in convertToBitmapEx, so I just keep it for now,
it is created anyways, just wanted to make it sleeker.

Change-Id: I12e47327f5793d6ed87e217a2355c608f528246f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142547
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 48a5b404b056..332d91dcc7c4 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -32,9 +32,12 @@
 
 #ifdef DBG_UTIL
 #include 
-#include 
+// #include 
+#include 
 #endif
 
+// #include 
+
 namespace
 {
 bool implPrepareConversion(drawinglayer::primitive2d::Primitive2DContainer& 
rSequence,
@@ -137,39 +140,56 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
sal_uInt32 nDiscreteWidth, sal_uInt32 
nDiscreteHeight,
sal_uInt32 nMaxSquarePixels)
 {
-BitmapEx aRetval;
 drawinglayer::primitive2d::Primitive2DContainer aSequence(std::move(rSeq));
 
 if (!implPrepareConversion(aSequence, nDiscreteWidth, nDiscreteHeight, 
nMaxSquarePixels))
 {
-return aRetval;
+return BitmapEx();
 }
 
 const Point aEmptyPoint;
 const Size aSizePixel(nDiscreteWidth, nDiscreteHeight);
 
-// Create target VirtualDevice. Use a VirtualDevice in the Alpha-mode.
-// This creates the needed alpha channel 'in parallel'. It is not
-// cheaper though since the VDev in that mode internally uses two VDevs,
-// so resource-wise it's more expensive, speed-wise pretty much the same
-// (the former two-path rendering created content & alpha separately in
-// two runs). The former method always created the correct Alpha, but
-// when transparent geometry was involved, the created content was
-// blended against white (COL_WHITE) due to the starting conditions of
-// creation.
-// There are more ways than this to do this correctly, but this is the
-// most simple for now. Due to hoping to be able to render to RGBA in the
-// future anyways there is no need to experiment trying to do the correct
-// thing using an expanded version of the former method.
-ScopedVclPtrInstance 
pContent(*Application::GetDefaultDevice(),
- DeviceFormat::DEFAULT, 
DeviceFormat::DEFAULT);
+// Create target VirtualDevice. Go back to using a simple RGB
+// target version (comared with former version, see history).
+// Reasons are manyfold:
+// - Avoid the RGBA mode for VirtualDevice (two VDevs)
+//   - It's not suggested to be used outside presentation engine
+//   - 

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

2022-11-02 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 26fef1f99185c9ec4f0278e3aa6079011a164cba
Author: Andrea Gelmini 
AuthorDate: Wed Nov 2 18:13:26 2022 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 2 22:46:25 2022 +0100

Fix typos

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

diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx 
b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index a91e87b38c1c..2fdb535f61d9 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -350,7 +350,7 @@ PolygonStrokePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewIn
 // - expanding by more (like sqrt(2) * 0.5 * LineWidth) 
immediately extends the size
 //   of e.g. geometry converted to PNG, plus many similar cases 
that cannot be thought
 //   of in advance.
-// This means that converting those thoght-experiment examples in 
(4) will and do lead
+// This means that converting those thought-experiment examples in 
(4) will and do lead
 // to bigger e.g. Bitmap conversion(s), not avoiding but painting 
the free space. That
 // could only be done by correctly and fully decomposing the 
geometry, including
 // stroke, and accepting the cost...
@@ -378,14 +378,14 @@ PolygonStrokePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewIn
 // other PrimitiveProcessors. Maybe not by the 
VclPixelProcessor2D/VclProcessor2D
 // since it handles this primitive directly - not even sure 
for all cases.
 // Sooner or later another PrimitiveProcessor will re-use this 
wrong temporary
-// decompositon, and as an error, a non-stroked line will be 
painted/used.
+// decomposition, and as an error, a non-stroked line will be 
painted/used.
 // (4) The B2DRange is not strictly defined as minimal bound for 
the geometry,
 // but it should be as small/tight as possible. Making it 
larger risks more
 // area to be invalidated (repaint) and processed (all 
geometric stuff,l may
 // include future and existing exports to other formats which 
are or will be
 // implemented as PrimitiveProcessor). It is easy to imagine 
cases with much
 // too large B2DRange - a line with a pattern that would solve 
to a single
-// small start-rectange and rest is empty, or a circle with a 
stroke that
+// small start-rectangle and rest is empty, or a circle with a 
stroke that
 // makes only a quarter of it visible.
 //
 // The reason to do this is speed, what is a good argument. But 
speed should
@@ -404,7 +404,7 @@ PolygonStrokePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewIn
 // the buffered decomposition will not be harmed.
 // Disadvantage: Same as (a), decomposition will be 
potentially done repeatedly
 // (c) Use a temporary, local PolygonStrokePrimitive2D and buffer 
B2DRange
-// locally for this Prmitive. Due to (1)/(2) this cannot 
change, so
+// locally for this Primitive. Due to (1)/(2) this cannot 
change, so
 // when calculated once it is totally legal to use it.
 //
 // Thus here I would use (c): It accepts the disadvantages of (4) 
over speed, but
@@ -446,7 +446,7 @@ PolygonStrokePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewIn
 // - either use maBufferedRange, additionally remember view-dependent
 //   factor & reset if that changes
 // - or do not buffer for hairline -> not really needed, the range is 
buffered
-//   in the B2DPolygon, no decompostion is needed and a simple grow is 
cheap
+//   in the B2DPolygon, no decomposition is needed and a simple grow is 
cheap
 basegfx::B2DRange aHairlineRange = getB2DPolygon().getB2DRange();
 
 if (!aHairlineRange.isEmpty())


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

2022-11-02 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx|  138 --
 include/drawinglayer/primitive2d/PolygonStrokePrimitive2D.hxx |3 
 2 files changed, 114 insertions(+), 27 deletions(-)

New commits:
commit 8304f44ce161f14094f724098004a1b4289685c4
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Nov 1 14:19:24 2022 +0100
Commit: Armin Le Grand 
CommitDate: Wed Nov 2 14:14:12 2022 +0100

Improved code for PolygonStrokePrimitive2D::getB2DRange

For extended discussion & background information please refer
to the comments added to the code there.

Had to handle view-dependent parts like the hairline
different, do not buffer that case. It could be, but it's not
expensive and would require to remember and check against
the view-dependent part which was used to create the
B2DRange initially.

Change-Id: I10df46207990865c667d41f56aedb8f0956a1706
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142114
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx 
b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 00ac96405b62..a91e87b38c1c 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -278,6 +278,7 @@ 
PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(basegfx::B2DPolygon aPolygon,
 : maPolygon(std::move(aPolygon))
 , maLineAttribute(rLineAttribute)
 , maStrokeAttribute(std::move(aStrokeAttribute))
+, maBufferedRange()
 {
 // MM01: keep these - these are no curve-decompposers but just checks
 // simplify curve segments: moved here to not need to use it
@@ -289,6 +290,7 @@ 
PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(basegfx::B2DPolygon aPolygon,
const 
attribute::LineAttribute& rLineAttribute)
 : maPolygon(std::move(aPolygon))
 , maLineAttribute(rLineAttribute)
+, maBufferedRange()
 {
 // MM01: keep these - these are no curve-decompposers but just checks
 // simplify curve segments: moved here to not need to use it
@@ -314,7 +316,11 @@ bool PolygonStrokePrimitive2D::operator==(const 
BasePrimitive2D& rPrimitive) con
 basegfx::B2DRange
 PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& 
rViewInformation) const
 {
-basegfx::B2DRange aRetval;
+if (!maBufferedRange.isEmpty())
+{
+// use the view-independent, buffered B2DRange
+return maBufferedRange;
+}
 
 if (getLineAttribute().getWidth())
 {
@@ -334,6 +340,20 @@ PolygonStrokePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewIn
 // the grow method below works perfectly for LineCap_ROUND since 
the grow is in
 // all directions and the rounded cap needs the same grow in all 
directions independent
 // from its orientation. Unfortunately this is not the case for 
drawing::LineCap_SQUARE
+
+// NOTE: I thought about using [sqrt(2) * 0.5] a a factor for 
LineCap_SQUARE and not
+// set bUseDecomposition. I even tried that it works. Then an 
auto-test failing showed
+// not only that view-dependent stuff needs to be considered (what 
is done for the
+// hairline case below), *BUT* also e.g. conversions to 
PNG/exports use the B2DRange
+// of the geometry, so:
+// - expanding by 1/2 LineWidth is OK for rounded
+// - expanding by more (like sqrt(2) * 0.5 * LineWidth) 
immediately extends the size
+//   of e.g. geometry converted to PNG, plus many similar cases 
that cannot be thought
+//   of in advance.
+// This means that converting those thoght-experiment examples in 
(4) will and do lead
+// to bigger e.g. Bitmap conversion(s), not avoiding but painting 
the free space. That
+// could only be done by correctly and fully decomposing the 
geometry, including
+// stroke, and accepting the cost...
 bUseDecomposition = true;
 }
 
@@ -341,44 +361,108 @@ PolygonStrokePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewIn
 {
 // get correct range by using the decomposition fallback, reasons 
see above cases
 
-// ofz#947 to optimize calculating the range, turn any slow dashes 
into a solid line
-// when just calculating bounds
-attribute::StrokeAttribute aOrigStrokeAttribute = 
maStrokeAttribute;
-const_cast(this)->maStrokeAttribute
-= attribute::StrokeAttribute();
-aRetval = 
BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
-const_cast(this)->maStrokeAttribute = 
aOrigStrokeAttribute;
+// It is not a good idea to temporarily (re)set the 
PolygonStrokePrimitive2D
+// to default. While it is 

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

2022-10-27 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit ab83d7d57d0fae106037b12651adb397b48354e4
Author: Noel Grandin 
AuthorDate: Thu Oct 27 08:46:08 2022 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 27 10:49:58 2022 +0200

tdf#123419 using glyph cache for drawinglayer rendering

speeds up rendering by 5% or so

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

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 24b71ebb1873..a8874453bd4f 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -364,8 +365,11 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 
 if (!aDXArray.empty())
 {
+const SalLayoutGlyphs* pGlyphs = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(
+mpOutputDevice, aText, nPos, nLen);
 mpOutputDevice->DrawTextArray(aStartPoint, aText, aDXArray,
-  
rTextCandidate.getKashidaArray(), nPos, nLen);
+  
rTextCandidate.getKashidaArray(), nPos, nLen,
+  SalLayoutFlags::NONE, pGlyphs);
 }
 else
 {


[Libreoffice-commits] core.git: drawinglayer/source editeng/source include/vcl sc/source sd/source sw/inc sw/source vcl/inc vcl/qa vcl/source

2022-10-25 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |3 -
 editeng/source/editeng/impedit3.cxx|2 
 include/vcl/pdfextoutdevdata.hxx   |5 +
 include/vcl/pdfwriter.hxx  |2 
 sc/source/ui/view/output2.cxx  |4 -
 sd/source/ui/dlg/tpaction.cxx  |   21 ---
 sd/source/ui/inc/tpaction.hxx  |4 -
 sd/source/ui/unoidl/unomodel.cxx   |   35 ++---
 sw/inc/EnhancedPDFExportHelper.hxx |3 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx|   32 +++
 vcl/inc/pdf/pdfwriter_impl.hxx |6 +-
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |8 ++
 vcl/source/gdi/pdfextoutdevdata.cxx|6 +-
 vcl/source/gdi/pdfwriter.cxx   |4 -
 vcl/source/gdi/pdfwriter_impl.cxx  |   13 
 15 files changed, 92 insertions(+), 56 deletions(-)

New commits:
commit fa3f04bdd4f73a1b3be70dfb709c44638ef7e3d9
Author: Michael Stahl 
AuthorDate: Tue Oct 25 13:41:05 2022 +0200
Commit: Michael Stahl 
CommitDate: Tue Oct 25 20:50:04 2022 +0200

tdf#148934 PDF/UA export: add Contents entry to Link annotations

* Specification: ISO 14289-1:2014, Clause: 7.18.5, Test number: 2
Links shall contain an alternate description via their Contents key as 
described in ISO 32000-1:2008, 14.9.3.

These links are created all over the code, in some cases it's a bit
dubious what the content/alt-text should be, but let's try to use the
most suitable looking bit of text in whatever the context is.

* Specification: ISO 14289-1:2014, Clause: 7.18.3, Test number: 1
Every page on which there is an annotation shall contain in its page 
dictionary the key Tabs, and its value shall be S.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 7b46015003fa..a231e20153ef 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1254,7 +1254,8 @@ void 
VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(
   
static_cast(ceil(aViewRange.getMaxX())),
   
static_cast(ceil(aViewRange.getMaxY(;
 vcl::PDFExtOutDevBookmarkEntry aBookmark;
-aBookmark.nLinkId = mpPDFExtOutDevData->CreateLink(aRectLogic);
+OUString const content(rFieldPrimitive.getValue("Representation"));
+aBookmark.nLinkId = mpPDFExtOutDevData->CreateLink(aRectLogic, content);
 aBookmark.aBookmark = aURL;
 std::vector& rBookmarks = 
mpPDFExtOutDevData->GetBookmarks();
 rBookmarks.push_back(aBookmark);
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 6efc74d95cfe..d98ea6e4188e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -3858,7 +3858,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, 
tools::Rectangle aClipRect, Po
 
 tools::Rectangle 
aRect( aTopLeft, rTextPortion.GetSize() );
 
vcl::PDFExtOutDevBookmarkEntry aBookmark;
-aBookmark.nLinkId = 
pPDFExtOutDevData->CreateLink( aRect );
+aBookmark.nLinkId = 
pPDFExtOutDevData->CreateLink(aRect, pUrlField->GetRepresentation());
 aBookmark.aBookmark = 
pUrlField->GetURL();
 std::vector< 
vcl::PDFExtOutDevBookmarkEntry >& rBookmarks = 
pPDFExtOutDevData->GetBookmarks();
 rBookmarks.push_back( 
aBookmark );
diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 39a8bbb30d56..45cb71682f12 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -252,11 +252,14 @@ public:
 number of page the link is on (as returned by NewPage)
 or -1 in which case the current page is used
 
+@param rAltText
+Alt text for the link
+
 @returns
 the link id (to be used in SetLinkDest, SetLinkURL) or
 -1 if page id does not exist
 */
-sal_Int32 CreateLink( const tools::Rectangle& rRect, sal_Int32 nPageNr = 
-1 );
+sal_Int32 CreateLink(const tools::Rectangle& rRect, OUString const& 
rAltText, sal_Int32 nPageNr = -1);
 
  

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

2022-10-23 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 698ba5fcd9f01f8f6e9f300d914d8538ad527219
Author: Caolán McNamara 
AuthorDate: Sat Oct 22 21:21:05 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun Oct 23 17:04:38 2022 +0200

tdf#151674 rotate text starting point

Change-Id: Ibcfb4b102a58cad53c1ce5f569721e4557844b4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141673
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index cf1ea90aa228..24b71ebb1873 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -293,7 +293,6 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 // set parameters and paint text snippet
 const basegfx::BColor aRGBFontColor(
 
maBColorModifierStack.getModifiedColor(rTextCandidate.getFontColor()));
-const Point aStartPoint(aTextTranslate.getX(), 
aTextTranslate.getY());
 const vcl::text::ComplexTextLayoutFlags 
nOldLayoutMode(mpOutputDevice->GetLayoutMode());
 
 if (rTextCandidate.getFontAttribute().getRTL())
@@ -343,7 +342,8 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 getTransformFromMapMode(mpOutputDevice->GetMapMode()) * 
maCurrentTransformation);
 
 basegfx::B2DVector aCurrentScaling, aCurrentTranslate;
-aCombinedTransform.decompose(aCurrentScaling, aCurrentTranslate, 
fIgnoreRotate,
+double fCurrentRotate;
+aCombinedTransform.decompose(aCurrentScaling, aCurrentTranslate, 
fCurrentRotate,
  fIgnoreShearX);
 
 const Point aOrigin(basegfx::fround(aCurrentTranslate.getX() / 
aCurrentScaling.getX()),
@@ -351,6 +351,10 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 MapMode aMapMode(mpOutputDevice->GetMapMode().GetMapUnit(), 
aOrigin,
  Fraction(aCurrentScaling.getX()), 
Fraction(aCurrentScaling.getY()));
 
+if (fCurrentRotate)
+aTextTranslate *= 
basegfx::utils::createRotateB2DHomMatrix(fCurrentRotate);
+const Point aStartPoint(aTextTranslate.getX(), 
aTextTranslate.getY());
+
 const bool bChangeMapMode(aMapMode != 
mpOutputDevice->GetMapMode());
 if (bChangeMapMode)
 {


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

2022-10-18 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx |   25 
--
 1 file changed, 22 insertions(+), 3 deletions(-)

New commits:
commit 008cf1285d8c9ab293ebf0de26317a9df9725742
Author: Armin Le Grand (allotropia) 
AuthorDate: Mon Oct 17 19:26:33 2022 +0200
Commit: Miklos Vajna 
CommitDate: Tue Oct 18 08:10:01 2022 +0200

Added handling of transparence to BackgroundColorPrimitive2D

...which was missing in ::create2DDecomposition.

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

diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx 
b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
index 8f68d9e73ba3..5fbb5dd06e2a 100644
--- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -32,11 +33,29 @@ namespace drawinglayer::primitive2d
 {
 void 
BackgroundColorPrimitive2D::create2DDecomposition(Primitive2DContainer& 
rContainer, const geometry::ViewInformation2D& rViewInformation) const
 {
-if(!rViewInformation.getViewport().isEmpty())
+// transparency invalid or completely transparent, done
+if(getTransparency() < 0.0 || getTransparency() >= 1.0)
+return;
+
+// no viewport, not visible, done
+if(rViewInformation.getViewport().isEmpty())
+return;
+
+// create decompose geometry
+const basegfx::B2DPolygon 
aOutline(basegfx::utils::createPolygonFromRect(rViewInformation.getViewport()));
+Primitive2DReference aDecompose(new 
PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), getBColor()));
+
+if(getTransparency() != 0.0)
 {
-const basegfx::B2DPolygon 
aOutline(basegfx::utils::createPolygonFromRect(rViewInformation.getViewport()));
-rContainer.push_back(new 
PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aOutline), getBColor()));
+// if used, embed decompose geometry to unified transparency
+Primitive2DContainer aContent { aDecompose };
+aDecompose = Primitive2DReference(
+new UnifiedTransparencePrimitive2D(
+std::move(aContent),
+getTransparency()));
 }
+
+rContainer.push_back(aDecompose);
 }
 
 BackgroundColorPrimitive2D::BackgroundColorPrimitive2D(


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

2022-09-26 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit a96c9d7c5bb1ca6eaf72da49e29489f0f0ab1545
Author: Armin Le Grand (allotropia) 
AuthorDate: Sat Sep 24 16:28:03 2022 +0200
Commit: Armin Le Grand 
CommitDate: Mon Sep 26 09:49:20 2022 +0200

tdf#151104 correct missing ColorModification

Presentation still uses Metafiles as transfer for
Graphic content, so uses VclMetafileProcessor2D.
Unfortunately processPolyPolygonGraphicPrimitive2D
does not support an active BColorModifierStack,
so use the default as working fallback to create
correct GraphicData for the Metafile.

Change-Id: Ia439b241cb414667263ef653b507ad8b7fecde61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140550
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 25142b778278..7b46015003fa 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -837,8 +837,17 @@ void VclMetafileProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimi
 }
 case PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D:
 {
-processPolyPolygonGraphicPrimitive2D(
-static_cast(rCandidate));
+if (maBColorModifierStack.count())
+{
+// tdf#151104 unfortunately 
processPolyPolygonGraphicPrimitive2D below
+// does not support an active BColorModifierStack, so use the 
default
+process(rCandidate);
+}
+else
+{
+processPolyPolygonGraphicPrimitive2D(
+static_cast(rCandidate));
+}
 break;
 }
 case PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D:


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

2022-09-23 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 2914316bcffc890887ca577d2753149c07005815
Author: Armin Le Grand (allotropia) 
AuthorDate: Wed Sep 21 18:03:15 2022 +0200
Commit: Armin Le Grand 
CommitDate: Fri Sep 23 09:45:09 2022 +0200

tdf#150551 for PDF export, use the decomposition

...for better gradient visualization, see task
for details.

Change-Id: Idccd569b0e95763f6dbf6ad0a2204b62460c66d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140354
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 8e221affe978..25142b778278 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1938,6 +1938,13 @@ void 
VclMetafileProcessor2D::processPolyPolygonGradientPrimitive2D(
 return;
 }
 
+// tdf#150551 for PDF export, use the decomposition for better gradient 
visualization
+if (nullptr != mpPDFExtOutDevData)
+{
+process(rGradientCandidate);
+return;
+}
+
 basegfx::B2DPolyPolygon 
aLocalPolyPolygon(rGradientCandidate.getB2DPolyPolygon());
 
 if (aLocalPolyPolygon.getB2DRange() != 
rGradientCandidate.getDefinitionRange())


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

2022-09-21 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 85078a0d6353287c4494ea1e7fd14c44b9ab0c0e
Author: Andrea Gelmini 
AuthorDate: Wed Sep 21 17:09:51 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Sep 21 17:44:20 2022 +0200

Fix typo

Change-Id: I46f3ada5c155250b56ae3c8227587b741a8144dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140349
Reviewed-by: Julien Nabet 
Tested-by: Julien Nabet 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 2e00f11e8b10..564b113d8f86 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -979,7 +979,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
 }
 
 // tdf#151081 need to use regular primitive decomposition when the gradient
-// is transformed in any other way then just tanslate & scale
+// is transformed in any other way then just translate & scale
 basegfx::B2DVector aScale, aTranslate;
 double fRotate, fShearX;
 


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

2022-09-21 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit a3e36aaf5fcd7489f802913e93c200f3cde8492d
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Sep 20 13:22:04 2022 +0200
Commit: Armin Le Grand 
CommitDate: Wed Sep 21 09:47:57 2022 +0200

tdf#151081 render rotated gradients correctly

We have to use regular primitive decomposition
when the gradient is transformed in any other
way then just tanslate & scale. For more background,
refer to the bugzilla task.

Corrected some typos.

Change-Id: Ic767c9fe6d1915facc1247ba4ec1f79fd02e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140237
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index cf8d7dcd3ac0..2e00f11e8b10 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -978,6 +978,21 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
 return;
 }
 
+// tdf#151081 need to use regular primitive decomposition when the gradient
+// is transformed in any other way then just tanslate & scale
+basegfx::B2DVector aScale, aTranslate;
+double fRotate, fShearX;
+
+maCurrentTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
+
+// detect if transformation is rotated, sheared or mirrored in X and/or Y
+if (!basegfx::fTools::equalZero(fRotate) || 
!basegfx::fTools::equalZero(fShearX)
+|| aScale.getX() < 0.0 || aScale.getY() < 0.0)
+{
+process(rPrimitive);
+return;
+}
+
 GradientStyle eGradientStyle = 
convertGradientStyle(rFillGradient.getStyle());
 
 Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()),


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

2022-09-19 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |2 +-
 drawinglayer/source/processor2d/vclhelperbufferdevice.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 31640cce53e850da53c75e3882375d286c0e9024
Author: Andrea Gelmini 
AuthorDate: Mon Sep 19 13:16:50 2022 +0200
Commit: Julien Nabet 
CommitDate: Mon Sep 19 21:20:17 2022 +0200

Fix typos

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

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index fbb375417be3..f4373778ceb0 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -529,7 +529,7 @@ void impBufferDevice::paint(double fTrans)
 // Note: I am aware that the Dbg are of limited usefulness, but 
include them here
 // for reference.
 //
-// The important part is "av. last 500 Former/New is %ld" which 
decribes the averaged factor from Former/New
+// The important part is "av. last 500 Former/New is %ld" which 
describes the averaged factor from Former/New
 // over the last 500 measurements. When < 1.0 Former is better 
(Linux), > 1.0 (Win) New is better. Since the
 // factor on Win is still close to 1.0 what means we lose nearly 
nothing and Linux Former is better, I will
 // use Former for now.
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
index f893ec79bb93..618fb38209a5 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
@@ -33,7 +33,7 @@
 // - It initializes a 'Content' VDev which is buffered (since it had
 // shown that re-allocating all the time is slower). It checks
 // visibility and all usages initializing this should check for
-// isVisible() after contruction.
+// isVisible() after construction.
 // - It pre-initializes the 'Content' VDev with blitting the content
 // of the target VDev.
 // - It offers to get a 'Transparence' VDev (also from the buffer) if
@@ -64,7 +64,7 @@
 //
 // Note: This principle only works when the target is RGB, so
 // useful for EditViews like for PrimitiveRenderers where this is
-// the case. For usage with GBA tragets the starting conditions
+// the case. For usage with GBA targets the starting conditions
 // would have to be modified to not blend against the initial color
 // of 'Content' (usually COL_WHITE).
 //


[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer solenv/clang-format

2022-09-19 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/primitive2d/glowprimitive2d.cxx   |   24 -
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx |   22 -
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |  218 --
 drawinglayer/source/processor2d/vclhelperbufferdevice.hxx |   75 
 drawinglayer/source/tools/converters.cxx  |  127 ++--
 include/drawinglayer/converters.hxx   |   12 
 solenv/clang-format/excludelist   |2 
 7 files changed, 395 insertions(+), 85 deletions(-)

New commits:
commit 7614859e5738cdf3789f3f99cc4379f2333e8870
Author: Armin Le Grand (allotropia) 
AuthorDate: Thu Sep 15 15:50:03 2022 +0200
Commit: Armin Le Grand 
CommitDate: Mon Sep 19 09:56:19 2022 +0200

Make impBufferDevice faster again

When the Primitives for the Glow-Effects were added
(modified ShadowPrimitive2D, SoftEdgePrimitive2D and
GlowPrimitive2D) a modified version of impBufferDevice
was created and used. That lowered the speed for
drawing objects with transparence by about factor 2.5
and was unfortunately not only done for these
Primitives, but for transprent objects in general.

For the mentioned factor refer to:
  Patch to demonstrate former and now repaint differences
  https://gerrit.libreoffice.org/c/core/+/129301

After having reworked those Primitives to use another
mechanism and being decomposed so they will work in all
now and future renderers, it is possible to go back to
that easier and faster method to render Transparency.

For extended information, please take a look at the
added comments, mainly in vclhelperbufferdevice.hxx

Identified a still bad behaviour when objects use a
TransparenceGradient. Corrected that and added (at
this opportunity) a method 'createAlphaMask' along
with 'convertToBitmapEx' which is now used in the
GlowPrimitive2D & ShadowPrimitive2D which only need
the AlphaMask to do their job anyways (I had commented
there that thjis is possible before). That will
be faster for visualizing those Primitives.

Change-Id: Ieac880384de26960c2c4b8740a1dee1e15d7ac9e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140022
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index 44a97c536fb2..956a6f94eb82 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -155,24 +155,22 @@ void GlowPrimitive2D::create2DDecomposition(
 // limitation to be safe and not go runtime/memory havoc. Use a pretty 
small
 // limit due to this is glow functionality and will look good with bitmap 
scaling
 // anyways. The value of 250.000 square pixels below maybe adapted as 
needed.
-// NOTE: This may be further optimized. Only the alpha channel is needed, 
so
-//   convertToBitmapEx may be split in tooling to have a version that 
only
-//   creates the alpha channel. Potential win is >50% for the alpha 
pixel
-//   creation step ('>' because alpha painting uses a ColorStack and 
thus
-//   often can used simplified rendering)
 const basegfx::B2DVector 
aDiscreteClippedSize(rViewInformation.getObjectToViewTransformation()
   * aClippedRange.getRange());
 const sal_uInt32 nDiscreteClippedWidth(ceil(aDiscreteClippedSize.getX()));
 const sal_uInt32 nDiscreteClippedHeight(ceil(aDiscreteClippedSize.getY()));
 const geometry::ViewInformation2D aViewInformation2D;
 const sal_uInt32 nMaximumQuadraticPixels(25);
-const BitmapEx aBitmapEx(::drawinglayer::convertToBitmapEx(
+
+// I have now added a helper that just creates the mask without having
+// to render the content, use it, it's faster
+const AlphaMask aAlpha(::drawinglayer::createAlphaMask(
 std::move(xEmbedSeq), aViewInformation2D, nDiscreteClippedWidth, 
nDiscreteClippedHeight,
 nMaximumQuadraticPixels));
 
-if (!aBitmapEx.IsEmpty())
+if (!aAlpha.IsEmpty())
 {
-const Size& rBitmapExSizePixel(aBitmapEx.GetSizePixel());
+const Size& rBitmapExSizePixel(aAlpha.GetSizePixel());
 
 if (rBitmapExSizePixel.Width() > 0 && rBitmapExSizePixel.Height() > 0)
 {
@@ -183,7 +181,7 @@ void GlowPrimitive2D::create2DDecomposition(
 if (static_cast(rBitmapExSizePixel.Width()) != 
nDiscreteClippedWidth
 || static_cast(rBitmapExSizePixel.Height()) != 
nDiscreteClippedHeight)
 {
-// scale in X and Y should be the same (see fReduceFactor in 
convertToBitmapEx),
+// scale in X and Y should be the same (see fReduceFactor in 
createAlphaMask),
 // so adapt numerically to a single scale value, they are 
integer 

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

2022-09-14 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 227693d3528f890f71bf934bcb5afc85874a68b6
Author: Andrea Gelmini 
AuthorDate: Wed Sep 14 11:53:39 2022 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Wed Sep 14 11:58:05 2022 +0200

Fix typo

Change-Id: Ia6b1151d6a95cf797f8e13998e2ed372aaddb18f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139914
Tested-by: Adolfo Jayme Barrientos 
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
index 0702c6c011f1..299b6af625ab 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -164,7 +164,7 @@ void ShadowPrimitive2D::create2DDecomposition(
 return;
 }
 
-// from here on we process a blurrred shadow
+// from here on we process a blurred shadow
 basegfx::B2DRange aBlurRange;
 basegfx::B2DRange aClippedRange;
 basegfx::B2DVector aDiscreteBlurSize;
@@ -192,7 +192,7 @@ void ShadowPrimitive2D::create2DDecomposition(
 // ModifiedColorPrimitive2D (what is not urgently needed) to create
 // the alpha channel, but a paint with all colors set to a single
 // one (like shadowColor here) is often less expensive due to possible
-// simplifications painting the primitves (e.g. gradient)
+// simplifications painting the primitives (e.g. gradient)
 Primitive2DContainer aEmbedded;
 getFullyEmbeddedShadowPrimitives(aEmbedded);
 
@@ -301,7 +301,7 @@ void ShadowPrimitive2D::get2DDecomposition(
 return;
 }
 
-// here we have a blurrred shadow, check conditions of last
+// here we have a blurred shadow, check conditions of last
 // buffered decompose and decide re-use or re-create by using
 // setBuffered2DDecomposition to reset local buffered version
 basegfx::B2DRange aBlurRange;


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

2022-09-14 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |2 
 drawinglayer/source/primitive2d/glowprimitive2d.cxx |2 
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx   |  398 ++--
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx |4 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx  |  102 ---
 drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx  |4 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   53 -
 drawinglayer/source/processor2d/vclpixelprocessor2d.hxx |4 
 include/drawinglayer/primitive2d/glowprimitive2d.hxx|1 
 include/drawinglayer/primitive2d/shadowprimitive2d.hxx  |   98 +-
 10 files changed, 414 insertions(+), 254 deletions(-)

New commits:
commit e735ad1c57cddaf17d6ffc0cf15b5e14fa63c4ad
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Sep 13 13:42:54 2022 +0200
Commit: Armin Le Grand 
CommitDate: Wed Sep 14 09:54:18 2022 +0200

Rework of ShadowPrimitive2D

This is pretty much the same for ShadowPrimitive2D as the
change for GlowPrimitive2D and SoftEdgePrimitive2D, so for
more comments please refer to those commits:

 c2d1458723c66c2fd717a112f89f773226adc841
 707b0c328a282d993fa33b618083d20b6c521de6

There are some needed differences due to ShadowPrimitive2D
having existed longer and is used for non-blurred shadow
for a long time and is used as unchanged as possible.
Only for active glow of shadow is a buffering and local
decompose used.

Change-Id: I55e6516f59390079356ac16f24743b474e53fb05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139858
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index da3621aa189c..0a3249399a44 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -17,7 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
+#include "GlowSoftEgdeShadowTools.hxx"
 #include 
 #include 
 #include 
diff --git a/include/drawinglayer/primitive2d/GlowSoftEgdeShadowTools.hxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.hxx
similarity index 100%
rename from include/drawinglayer/primitive2d/GlowSoftEgdeShadowTools.hxx
rename to drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.hxx
diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index f8c503759e7d..44a97c536fb2 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include "GlowSoftEgdeShadowTools.hxx"
 
 #ifdef DBG_UTIL
 #include 
diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
index 15deebfb2a1e..0702c6c011f1 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -22,73 +22,383 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include "GlowSoftEgdeShadowTools.hxx"
+
+#ifdef DBG_UTIL
+#include 
+#include 
+#endif
 
 #include 
 #include 
 
 using namespace com::sun::star;
 
-
 namespace drawinglayer::primitive2d
 {
-ShadowPrimitive2D::ShadowPrimitive2D(
-basegfx::B2DHomMatrix aShadowTransform,
-const basegfx::BColor& rShadowColor,
-double fShadowBlur,
-Primitive2DContainer&& aChildren)
-:   GroupPrimitive2D(std::move(aChildren)),
-maShadowTransform(std::move(aShadowTransform)),
-maShadowColor(rShadowColor),
-mfShadowBlur(fShadowBlur)
+ShadowPrimitive2D::ShadowPrimitive2D(basegfx::B2DHomMatrix aShadowTransform,
+ const basegfx::BColor& rShadowColor, 
double fShadowBlur,
+ Primitive2DContainer&& aChildren)
+: BufferedDecompositionGroupPrimitive2D(std::move(aChildren))
+, maShadowTransform(std::move(aShadowTransform))
+, maShadowColor(rShadowColor)
+, mfShadowBlur(fShadowBlur)
+, mfLastDiscreteBlurRadius(0.0)
+, maLastClippedRange()
+{
+}
+
+bool ShadowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+if (BufferedDecompositionGroupPrimitive2D::operator==(rPrimitive))
+{
+const ShadowPrimitive2D& rCompare = static_cast(rPrimitive);
+
+return (getShadowTransform() == rCompare.getShadowTransform()
+&& getShadowColor() == rCompare.getShadowColor()
+&& getShadowBlur() == rCompare.getShadowBlur());
+}
+
+return false;
+}
+
+// Helper to get the to-be-shadowed geometry completely embedded to
+// a 

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

2022-09-10 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   18 +++-
 drawinglayer/source/processor2d/vclpixelprocessor2d.hxx |3 --
 2 files changed, 5 insertions(+), 16 deletions(-)

New commits:
commit 0252b7bdec3693096bb52c67d335c0e9e662e185
Author: Noel Grandin 
AuthorDate: Wed Sep 7 21:56:31 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 10 08:39:34 2022 +0200

VclPixelProcessor2D doesnt need a pimpl

it is module private

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

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 976e5cb1dccb..12e044959b31 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -70,21 +70,11 @@ using namespace com::sun::star;
 
 namespace drawinglayer::processor2d
 {
-struct VclPixelProcessor2D::Impl
-{
-AntialiasingFlags m_nOrigAntiAliasing;
-
-explicit Impl(OutputDevice const& rOutDev)
-: m_nOrigAntiAliasing(rOutDev.GetAntialiasing())
-{
-}
-};
-
 VclPixelProcessor2D::VclPixelProcessor2D(const geometry::ViewInformation2D& 
rViewInformation,
  OutputDevice& rOutDev,
  const basegfx::BColorModifierStack& 
rInitStack)
 : VclProcessor2D(rViewInformation, rOutDev, rInitStack)
-, m_pImpl(new Impl(rOutDev))
+, m_nOrigAntiAliasing(rOutDev.GetAntialiasing())
 {
 // prepare maCurrentTransformation matrix with viewTransformation to 
target directly to pixels
 maCurrentTransformation = rViewInformation.getObjectToViewTransformation();
@@ -96,11 +86,11 @@ VclPixelProcessor2D::VclPixelProcessor2D(const 
geometry::ViewInformation2D& rVie
 // react on AntiAliasing settings
 if (SvtOptionsDrawinglayer::IsAntiAliasing())
 {
-mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing | 
AntialiasingFlags::Enable);
+mpOutputDevice->SetAntialiasing(m_nOrigAntiAliasing | 
AntialiasingFlags::Enable);
 }
 else
 {
-mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing & 
~AntialiasingFlags::Enable);
+mpOutputDevice->SetAntialiasing(m_nOrigAntiAliasing & 
~AntialiasingFlags::Enable);
 }
 }
 
@@ -110,7 +100,7 @@ VclPixelProcessor2D::~VclPixelProcessor2D()
 mpOutputDevice->Pop();
 
 // restore AntiAliasing
-mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing);
+mpOutputDevice->SetAntialiasing(m_nOrigAntiAliasing);
 }
 
 void VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect(
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
index d7494ccbbfff..9f1e11cb9110 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
@@ -56,8 +56,7 @@ namespace drawinglayer::processor2d
  */
 class VclPixelProcessor2D final : public VclProcessor2D
 {
-struct Impl;
-std::unique_ptr m_pImpl;
+AntialiasingFlags m_nOrigAntiAliasing;
 
 /*  the local processor for BasePrimitive2D-Implementation based 
primitives,
 called from the common process()-implementation


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

2022-09-08 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/primitive2d/glowprimitive2d.cxx|   53 +-
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx|  298 +++-
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |1 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx|   68 --
 drawinglayer/source/processor2d/vclpixelprocessor2d.hxx|1 
 drawinglayer/source/tools/converters.cxx   |  316 ++---
 emfio/source/reader/emfreader.cxx  |   16 
 include/drawinglayer/primitive2d/softedgeprimitive2d.hxx   |   34 +
 8 files changed, 508 insertions(+), 279 deletions(-)

New commits:
commit 707b0c328a282d993fa33b618083d20b6c521de6
Author: Armin Le Grand (allotropia) 
AuthorDate: Wed Sep 7 13:20:56 2022 +0200
Commit: Armin Le Grand 
CommitDate: Thu Sep 8 13:33:58 2022 +0200

Rework of SoftEdgePrimitive2D

This is pretty much the same for SoftEdgePrimitive2D as the
change for GlowPrimitive2D, so for more comments please refer
to commit c2d1458723c66c2fd717a112f89f773226adc841

Added suggested change of DoSaveForVisualControl mechanism

Change-Id: I28901e7a0b6e1823000d2aa6a335ce2fd80e6ce3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139585
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index d3c8539eddf8..f8c503759e7d 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -178,19 +178,19 @@ void GlowPrimitive2D::create2DDecomposition(
 {
 // We may have to take a corrective scaling into account when the
 // MaximumQuadraticPixel limit was used/triggered
-double fScaleX(1.0);
-double fScaleY(1.0);
+double fScale(1.0);
 
-if (static_cast(rBitmapExSizePixel.Width()) != 
nDiscreteClippedWidth)
+if (static_cast(rBitmapExSizePixel.Width()) != 
nDiscreteClippedWidth
+|| static_cast(rBitmapExSizePixel.Height()) != 
nDiscreteClippedHeight)
 {
-fScaleX = static_cast(rBitmapExSizePixel.Width())
-  / static_cast(nDiscreteClippedWidth);
-}
-
-if (static_cast(rBitmapExSizePixel.Height()) != 
nDiscreteClippedHeight)
-{
-fScaleY = static_cast(rBitmapExSizePixel.Height())
-  / static_cast(nDiscreteClippedHeight);
+// scale in X and Y should be the same (see fReduceFactor in 
convertToBitmapEx),
+// so adapt numerically to a single scale value, they are 
integer rounded values
+const double 
fScaleX(static_cast(rBitmapExSizePixel.Width())
+ / 
static_cast(nDiscreteClippedWidth));
+const double 
fScaleY(static_cast(rBitmapExSizePixel.Height())
+ / 
static_cast(nDiscreteClippedHeight));
+
+fScale = (fScaleX + fScaleY) * 0.5;
 }
 
 // fDiscreteGlowRadius is the size of the halo from each side of 
the object. The halo is the
@@ -199,8 +199,8 @@ void GlowPrimitive2D::create2DDecomposition(
 // fades to both sides by the blur radius; thus blur radius is 
half of glow radius.
 // Consider glow transparency (initial transparency near the 
object edge)
 const AlphaMask mask(ProcessAndBlurAlphaMask(
-aBitmapEx.GetAlpha(), fDiscreteGlowRadius * fScaleX / 2.0,
-fDiscreteGlowRadius * fScaleY / 2.0, 255 - 
getGlowColor().GetAlpha()));
+aBitmapEx.GetAlpha(), fDiscreteGlowRadius * fScale / 2.0,
+fDiscreteGlowRadius * fScale / 2.0, 255 - 
getGlowColor().GetAlpha()));
 
 // The end result is the bitmap filled with glow color and blurred 
8-bit alpha mask
 Bitmap bmp = aBitmapEx.GetBitmap();
@@ -211,16 +211,16 @@ void GlowPrimitive2D::create2DDecomposition(
 static bool bDoSaveForVisualControl(false); // 
loplugin:constvars:ignore
 if (bDoSaveForVisualControl)
 {
-SvFileStream aNew(
-#ifdef _WIN32
-"c:\\test_glow.png"
-#else
-"~/test_glow.png"
-#endif
-,
-StreamMode::WRITE | StreamMode::TRUNC);
-vcl::PngImageWriter aPNGWriter(aNew);
-aPNGWriter.write(result);
+// VCL_DUMP_BMP_PATH should be like C:/path/ or ~/path/
+static const OUString sDumpPath(
+
OUString::createFromAscii(std::getenv("VCL_DUMP_BMP_PATH")));
+if (!sDumpPath.isEmpty())
+{
+SvFileStream aNew(sDumpPath + "test_glow.png",
+  StreamMode::WRITE | 

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

2022-09-07 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/tools/converters.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3b62c0018106adf493246cf129a4ff8b47067523
Author: Andrea Gelmini 
AuthorDate: Wed Sep 7 13:25:09 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Sep 7 18:05:27 2022 +0200

Fix typo

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

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 6139fb296d71..84294b24af26 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -78,7 +78,7 @@ namespace drawinglayer
 // Create target VirtualDevice. Use a VirtualDevice in the Alpha-mode.
 // This creates the needed alpha channel 'in parallel'. It is not
 // cheaper though since the VDev in that mode internally uses two 
VDevs,
-// so ressoure-wise it's more expensive, speed-wise pretty much the 
same
+// so resource-wise it's more expensive, speed-wise pretty much the 
same
 // (the former two-path rendering created content & alpha separately in
 // two runs). The former method always created the correct Alpha, but
 // when transparent geometry was involved, the created content was


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

2022-09-07 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/tools/converters.cxx |  179 +++
 1 file changed, 68 insertions(+), 111 deletions(-)

New commits:
commit 3d4895e0720f5f0f5dc748470bd42d0aba2f6244
Author: Armin Le Grand (allotropia) 
AuthorDate: Fri Sep 2 19:15:13 2022 +0200
Commit: Armin Le Grand 
CommitDate: Wed Sep 7 10:33:11 2022 +0200

ConvertToBitmapEx slightly too bright if transparency involved

Stumbled about this error when working on re-designing the blend
primitives for shapes. Using convertToBitmapEx is the base for
these (also for the UNO API conversion from Primitives to
BitmapEx).

Use a VirtualDevice in the Alpha-mode now to solve it. This
creates the needed alpha channel 'in parallel'. It is not cheaper
though since the VDev in that mode internally uses two VDevs,
so ressoure-wise it's more expensive, speed-wise pretty much the
same (the former two-path rendering created content & alpha
separately in two runs).
The former method always created the correct Alpha, but when
transparent geometry is involved, the created content was
blended against white (COL_WHITE) due to the starting conditions
of the content creation.
There are more ways than using a VirtualDevice in the Alpha-mode,
to do this correctly, but this is the most simple for now - and
I was persuaded by the following argument:
Due to hoping to be able to render to RGBA in the future anyways
there is no need to experiment trying to do the correct thing
using an expanded version of the former method.

Change-Id: I23e005f9c3723059e2b88660fede09aa83844b38
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139272
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 7dc1259edfaa..6139fb296d71 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -37,7 +37,6 @@
 
 namespace drawinglayer
 {
-
 BitmapEx convertToBitmapEx(
 drawinglayer::primitive2d::Primitive2DContainer&& rSeq,
 const geometry::ViewInformation2D& rViewInformation2D,
@@ -47,132 +46,90 @@ namespace drawinglayer
 {
 BitmapEx aRetval;
 
-if(!rSeq.empty() && nDiscreteWidth && nDiscreteHeight)
-{
-// get destination size in pixels
-const MapMode aMapModePixel(MapUnit::MapPixel);
-const sal_uInt32 nViewVisibleArea(nDiscreteWidth * 
nDiscreteHeight);
-drawinglayer::primitive2d::Primitive2DContainer aSequence;
+if(rSeq.empty())
+return aRetval;
 
-if(nViewVisibleArea > nMaxSquarePixels)
-{
-// reduce render size
-double fReduceFactor = 
sqrt(static_cast(nMaxSquarePixels) / 
static_cast(nViewVisibleArea));
-nDiscreteWidth = 
basegfx::fround(static_cast(nDiscreteWidth) * fReduceFactor);
-nDiscreteHeight = 
basegfx::fround(static_cast(nDiscreteHeight) * fReduceFactor);
+if(nDiscreteWidth <= 0 || nDiscreteHeight <= 0)
+return aRetval;
 
-const drawinglayer::primitive2d::Primitive2DReference aEmbed(
-new drawinglayer::primitive2d::TransformPrimitive2D(
-basegfx::utils::createScaleB2DHomMatrix(fReduceFactor, 
fReduceFactor),
-std::move(rSeq)));
+// get destination size in pixels
+const MapMode aMapModePixel(MapUnit::MapPixel);
+const sal_uInt32 nViewVisibleArea(nDiscreteWidth * nDiscreteHeight);
+drawinglayer::primitive2d::Primitive2DContainer 
aSequence(std::move(rSeq));
 
-aSequence = drawinglayer::primitive2d::Primitive2DContainer { 
aEmbed };
-}
-else
-aSequence = std::move(rSeq);
+if(nViewVisibleArea > nMaxSquarePixels)
+{
+// reduce render size
+double fReduceFactor = sqrt(static_cast(nMaxSquarePixels) 
/ static_cast(nViewVisibleArea));
+nDiscreteWidth = 
basegfx::fround(static_cast(nDiscreteWidth) * fReduceFactor);
+nDiscreteHeight = 
basegfx::fround(static_cast(nDiscreteHeight) * fReduceFactor);
 
-const Point aEmptyPoint;
-const Size aSizePixel(nDiscreteWidth, nDiscreteHeight);
-ScopedVclPtrInstance< VirtualDevice > pContent;
+const drawinglayer::primitive2d::Primitive2DReference aEmbed(
+new drawinglayer::primitive2d::TransformPrimitive2D(
+basegfx::utils::createScaleB2DHomMatrix(fReduceFactor, 
fReduceFactor),
+std::move(aSequence)));
 
-// prepare vdev
-if (!pContent->SetOutputSizePixel(aSizePixel, false))
-{
-SAL_WARN("vcl", "Cannot set VirtualDevice to size : " << 
aSizePixel.Width() << "x" << 

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

2022-09-02 Thread Noel Grandin (via logerrit)
 drawinglayer/source/texture/texture.cxx |   30 --
 1 file changed, 28 insertions(+), 2 deletions(-)

New commits:
commit dabaf2879673fe4bbe874a2917e7a9200737ba81
Author: Noel Grandin 
AuthorDate: Fri Sep 2 12:03:26 2022 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 2 13:22:13 2022 +0200

tdf#136370 Very large Shape with pattern/hatch makes scrolling slow

reduce some time spent in the 3-d rendering

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

diff --git a/drawinglayer/source/texture/texture.cxx 
b/drawinglayer/source/texture/texture.cxx
index b3477f642880..4a92e443c275 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -627,8 +627,34 @@ namespace drawinglayer::texture
 
 double GeoTexSvxHatch::getDistanceToHatch(const basegfx::B2DPoint& 
rUV) const
 {
-const basegfx::B2DPoint aCoor(getBackTextureTransform() * rUV);
-return fmod(aCoor.getY(), mfDistance);
+// the below is an inlined and optimised version of
+// const basegfx::B2DPoint aCoor(getBackTextureTransform() * 
rUV);
+// return fmod(aCoor.getY(), mfDistance);
+
+const basegfx::B2DHomMatrix& rMat = getBackTextureTransform();
+double fX = rUV.getX();
+double fY = rUV.getY();
+
+double fTempY(
+rMat.get(1, 0) * fX +
+rMat.get(1, 1) * fY +
+rMat.get(1, 2));
+
+if(!rMat.isLastLineDefault())
+{
+const double fOne(1.0);
+const double fTempM(
+rMat.get(2, 0) * fX +
+rMat.get(2, 1) * fY +
+rMat.get(2, 2));
+
+if(!basegfx::fTools::equalZero(fTempM) && 
!basegfx::fTools::equal(fOne, fTempM))
+{
+fTempY /= fTempM;
+}
+}
+
+return fmod(fTempY, mfDistance);
 }
 
 const basegfx::B2DHomMatrix& GeoTexSvxHatch::getBackTextureTransform() 
const


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

2022-09-01 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0b6520c4acbfbb656f00d0fab11289899614494f
Author: Luboš Luňák 
AuthorDate: Wed Aug 31 17:54:34 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Sep 1 12:01:51 2022 +0200

explicitly use BmpScaleFlag::NearestNeighbor when wanted

That is the algorithm that doesn't change colors, BmpScaleFlag::Fast
works the same way only because it's mapped to this algorithm
(which may not necessarily be the case forever).

Change-Id: Ibebfff668eaa1da93963f8e8601fec51cfdfca34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139128
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index 0cc5be1bd532..da3621aa189c 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -50,8 +50,8 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius
 aSize.setWidth(aSize.Width() / 2);
 }
 
-// BmpScaleFlag::Fast is important for following color replacement
-mask.Scale(fScale, fScale, BmpScaleFlag::Fast);
+// BmpScaleFlag::NearestNeighbor is important for following color 
replacement
+mask.Scale(fScale, fScale, BmpScaleFlag::NearestNeighbor);
 
 if (fErodeDilateRadius > 0)
 BitmapFilter::Filter(mask, BitmapDilateFilter(fErodeDilateRadius));


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

2022-09-01 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |3 ++-
 include/drawinglayer/geometry/viewinformation2d.hxx |2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 0415aa11f66de0c64f1ed524197bfea70fe3c3ca
Author: Luboš Luňák 
AuthorDate: Wed Aug 31 17:22:08 2022 +0200
Commit: Luboš Luňák 
CommitDate: Thu Sep 1 12:01:07 2022 +0200

fix limiting drawing of softedge effect (tdf#141981)

Apparently an empty viewport actually means everything should be drawn.

Change-Id: I55ae453a8f264d48222ade48a2953ab7d97c7f79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139125
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index d3184a0e0d7a..f00a38d49374 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -994,7 +994,8 @@ void VclPixelProcessor2D::processSoftEdgePrimitive2D(
 
 // Limit the bitmap size to the visible area.
 basegfx::B2DRange bitmapRange(aRange);
-bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport());
+if (!aExpandedViewInfo.getDiscreteViewport().isEmpty())
+bitmapRange.intersect(aExpandedViewInfo.getDiscreteViewport());
 if (!bitmapRange.isEmpty())
 {
 const tools::Rectangle aRect(
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx 
b/include/drawinglayer/geometry/viewinformation2d.hxx
index bf594e8755cf..2957b7daf709 100644
--- a/include/drawinglayer/geometry/viewinformation2d.hxx
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -121,6 +121,7 @@ public:
 /// data access
 const basegfx::B2DHomMatrix& getObjectTransformation() const;
 const basegfx::B2DHomMatrix& getViewTransformation() const;
+/// Empty viewport means everything is visible.
 const basegfx::B2DRange& getViewport() const;
 double getViewTime() const;
 const css::uno::Reference& getVisualizedPage() 
const;
@@ -130,6 +131,7 @@ public:
 const basegfx::B2DHomMatrix& getInverseObjectToViewTransformation() const;
 
 /// On-demand prepared Viewport in discrete units for convenience
+/// Empty viewport means everything is visible.
 const basegfx::B2DRange& getDiscreteViewport() const;
 
 /** support reduced DisplayQuality, PropertyName is 
'ReducedDisplayQuality'. This


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

2022-08-31 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/primitive2d/glowprimitive2d.cxx |2 +-
 include/svx/svdotable.hxx   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e5ae7adcb58d41d8733b85b3e801a5d484a2832e
Author: Andrea Gelmini 
AuthorDate: Wed Aug 31 12:57:21 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Aug 31 14:27:48 2022 +0200

Fix typo

Change-Id: Iae97a43a18a8017e739eb2bb4275da6fa275aff3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139101
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index 9c4a2f45b9c4..0bce06d90a1d 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -265,7 +265,7 @@ void 
GlowPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisit
 // Check if last created area is sufficient and can be re-used
 if (!maLastClippedRange.isEmpty() && 
!maLastClippedRange.isInside(aClippedRange))
 {
-// To avoid unneceary invalidations due to being *very* correct
+// To avoid unnecessary invalidations due to being *very* correct
 // with HairLines (which are view-dependent and thus change the
 // result(s) here slightly when changing zoom), add a slight 
unsharp
 // component if we have a ViewTransform. The derivation is inside
diff --git a/include/svx/svdotable.hxx b/include/svx/svdotable.hxx
index 64996cce2717..bf0761248bd5 100644
--- a/include/svx/svdotable.hxx
+++ b/include/svx/svdotable.hxx
@@ -258,7 +258,7 @@ public:
 /// Next time layouting would be done, skip it (to layout at the end of 
multiple actions).
 void SetSkipChangeLayout(bool bSkipChangeLayout);
 
-/** Tries to get table height if rows with sizes less then the minimum 
size were expanded
+/** Tries to get table height if rows with sizes less than the minimum 
size were expanded
 
 (i.e. Table height layouted without fitting to an area)
 Helper for OOXML import


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

2022-08-31 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/primitive2d/glowprimitive2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 56a1c4e80c45c81d42a12b536863f8f26f6144c6
Author: Andrea Gelmini 
AuthorDate: Wed Aug 31 12:55:40 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Aug 31 14:26:59 2022 +0200

Fix typo

Change-Id: I18d696cbc5685778e23bf69ce99e044db25f9a55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139100
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index f7194dba7d9f..9c4a2f45b9c4 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -93,7 +93,7 @@ bool GlowPrimitive2D::prepareValuesAndcheckValidity(
 // ViewInformation2D definition in viewinformation2d.hxx)
 if (!rViewInformation.getViewport().isEmpty())
 {
-// if used, extend by GlowRadus to ensure needed parts are included
+// if used, extend by GlowRadius to ensure needed parts are included
 basegfx::B2DRange aVisibleArea(rViewInformation.getViewport());
 aVisibleArea.grow(getGlowRadius());
 


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

2022-08-30 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |   24 --
 vcl/source/bitmap/bitmap.cxx  |4 +-
 2 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 28223ab9198e693a1cb4e344f14f8f5d5fbf127a
Author: Mike Kaganski 
AuthorDate: Tue Aug 30 14:14:50 2022 +0300
Commit: Mike Kaganski 
CommitDate: Tue Aug 30 15:26:55 2022 +0200

Unify the two places dumping bimaps for debugging

Using the environment variable allows me to use a directory
where no "access denied" happens on write access.

Change-Id: Iffdd9b8566f2d794a6741b71d736d14d4643576c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139033
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 4a29344023b1..a0807e83f72b 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -359,15 +359,12 @@ void impBufferDevice::paint(double fTrans)
 mpContent->EnableMapMode(false);
 
 #ifdef DBG_UTIL
-if (bDoSaveForVisualControl)
+// VCL_DUMP_BMP_PATH should be like C:/path/ or ~/path/
+static const OUString 
sDumpPath(OUString::createFromAscii(std::getenv("VCL_DUMP_BMP_PATH")));
+
+if (!sDumpPath.isEmpty() && bDoSaveForVisualControl)
 {
-SvFileStream aNew(
-#ifdef _WIN32
-"c:\\content.bmp",
-#else
-"~/content.bmp",
-#endif
-StreamMode::WRITE | StreamMode::TRUNC);
+SvFileStream aNew(sDumpPath + "content.bmp", StreamMode::WRITE | 
StreamMode::TRUNC);
 Bitmap aContent(mpContent->GetBitmap(aEmptyPoint, aSizePixel));
 WriteDIB(aContent, aNew, false, true);
 }
@@ -383,15 +380,10 @@ void impBufferDevice::paint(double fTrans)
 AlphaMask aAlphaMask(mpAlpha->GetBitmap(aEmptyPoint, aSizePixel));
 
 #ifdef DBG_UTIL
-if (bDoSaveForVisualControl)
+if (!sDumpPath.isEmpty() && bDoSaveForVisualControl)
 {
-SvFileStream aNew(
-#ifdef _WIN32
-"c:\\transparence.bmp",
-#else
-"~/transparence.bmp",
-#endif
-StreamMode::WRITE | StreamMode::TRUNC);
+SvFileStream aNew(sDumpPath + "transparence.bmp",
+  StreamMode::WRITE | StreamMode::TRUNC);
 WriteDIB(aAlphaMask.GetBitmap(), aNew, false, true);
 }
 #endif
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index 2a9f949ac1fe..5abd79c70fcc 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -156,7 +156,7 @@ void savePNG(const OUString& sWhere, const Bitmap& rBmp)
 Bitmap::~Bitmap()
 {
 #ifdef DBG_UTIL
-// VCL_DUMP_BMP_PATH should be like C:/bmpDump.png or ~/bmpDump.png
+// VCL_DUMP_BMP_PATH should be like C:/path/ or ~/path/
 static const OUString 
sDumpPath(OUString::createFromAscii(std::getenv("VCL_DUMP_BMP_PATH")));
 // Stepping into the dtor of a bitmap you need, and setting the volatile 
variable to true in
 // debugger, would dump the bitmap in question
@@ -164,7 +164,7 @@ Bitmap::~Bitmap()
 if (!sDumpPath.isEmpty() && save)
 {
 save = false;
-savePNG(sDumpPath, *this);
+savePNG(sDumpPath + "BitmapDump.png", *this);
 }
 #endif
 }


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

2022-08-26 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |   22 ++---
 1 file changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 6e802bc29d3a47e1d5b63d674dd4058503c00b58
Author: Caolán McNamara 
AuthorDate: Fri Aug 26 12:05:41 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 26 13:58:38 2022 +0200

crashtesting: avoid negative scaling

regression from

commit 1fa731d03ba0f22cb9392a578124ea977eaab2e9
Date:   Tue Aug 16 23:39:53 2022 +0100

tdf#150462 don't prescale dxarray before using DrawTextArray

do the negative scaling checks as was done originally

seen with:
bugtrackers/odg/tdf35913-4.odg
bugtrackers/svg/kde82509-1.svg
bugtrackers/svg/fdo45001-3.svg

Change-Id: I9eba78218d4676d60375fb9e9403be4e9bd5182a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138871
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index a9be11911e82..38cb499163fa 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -139,25 +139,25 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 // especially if the effect is less than a pixel.
 if (std::abs(aFontScaling.getY() * fShearX) < 1)
 {
-double fIgnoreRotate, fIgnoreShearX;
-
-basegfx::B2DVector aFontSize, aTextTranslate;
-rTextCandidate.getTextTransform().decompose(aFontSize, aTextTranslate, 
fIgnoreRotate,
-fIgnoreShearX);
-
-if (basegfx::fTools::less(aFontSize.getX(), 0.0)
-&& basegfx::fTools::less(aFontSize.getY(), 0.0))
+if (basegfx::fTools::less(aFontScaling.getX(), 0.0)
+&& basegfx::fTools::less(aFontScaling.getY(), 0.0))
 {
 // handle special case: If scale is negative in (x,y) (3rd 
quadrant), it can
 // be expressed as rotation by PI. Use this since the Font 
rendering will not
 // apply the negative scales in any form
-aFontSize = basegfx::absolute(aFontSize);
+aFontScaling = basegfx::absolute(aFontScaling);
 fRotate += M_PI;
 }
 
-if (basegfx::fTools::more(aFontSize.getX(), 0.0)
-&& basegfx::fTools::more(aFontSize.getY(), 0.0))
+if (basegfx::fTools::more(aFontScaling.getX(), 0.0)
+&& basegfx::fTools::more(aFontScaling.getY(), 0.0))
 {
+double fIgnoreRotate, fIgnoreShearX;
+
+basegfx::B2DVector aFontSize, aTextTranslate;
+rTextCandidate.getTextTransform().decompose(aFontSize, 
aTextTranslate, fIgnoreRotate,
+fIgnoreShearX);
+
 // Get the VCL font
 vcl::Font aFont(primitive2d::getVclFontFromFontAttribute(
 rTextCandidate.getFontAttribute(), aFontSize.getX(), 
aFontSize.getY(), fRotate,


[Libreoffice-commits] core.git: drawinglayer/source include/vcl starmath/source sw/source vcl/inc vcl/qa vcl/qt5 vcl/quartz vcl/skia vcl/source vcl/unx vcl/win

2022-08-25 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |9 
 include/vcl/outdev.hxx  |7 ---
 include/vcl/vcllayout.hxx   |5 ++
 starmath/source/ElementsDockingWindow.cxx   |1 
 sw/source/core/txtnode/fntcache.cxx |6 ---
 vcl/inc/salgdi.hxx  |   11 -
 vcl/qa/cppunit/pdfexport/pdfexport.cxx  |   20 +-
 vcl/qt5/QtGraphics_Text.cxx |3 +
 vcl/quartz/salgdi.cxx   |2 -
 vcl/skia/win/gdiimpl.cxx|2 -
 vcl/skia/x11/textrender.cxx |2 -
 vcl/source/filter/svm/SvmConverter.cxx  |1 
 vcl/source/gdi/pdfwriter_impl.cxx   |   10 ++---
 vcl/source/gdi/salgdilayout.cxx |3 -
 vcl/source/gdi/virdev.cxx   |2 -
 vcl/source/outdev/map.cxx   |   20 +++---
 vcl/source/outdev/outdev.cxx|   15 ---
 vcl/source/outdev/text.cxx  |   31 +---
 vcl/unx/generic/gdi/cairotextrender.cxx |2 -
 vcl/win/gdi/winlayout.cxx   |2 -
 20 files changed, 54 insertions(+), 100 deletions(-)

New commits:
commit 100fe8a3a1724f1a5f834da11e17d1641be20994
Author: Caolán McNamara 
AuthorDate: Mon Aug 15 17:24:28 2022 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 26 00:36:58 2022 +0200

automatically set TextRenderModeForResolutionIndependentLayout if we scale

Always render glyphs with a mode suitable for rendering of
resolution-independent layout positions if we scale the text positions.

The idea being to typically continue to use the system defaults for font
settings for UI elements, but where we are rendering into application
canvases where there's a mapmode set then automatically use a good mode
to render that.

Change-Id: I0e5857e377da72ae1a2ede1d88d6408819fc9200
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138324
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index fe2f30cbf23a..5e0612f94a93 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -75,12 +75,9 @@ namespace drawinglayer::processor2d
 struct VclPixelProcessor2D::Impl
 {
 AntialiasingFlags m_nOrigAntiAliasing;
-bool m_bOrigTextRenderModeForResolutionIndependentLayout;
 
 explicit Impl(OutputDevice const& rOutDev)
 : m_nOrigAntiAliasing(rOutDev.GetAntialiasing())
-, m_bOrigTextRenderModeForResolutionIndependentLayout(
-  rOutDev.GetTextRenderModeForResolutionIndependentLayout())
 {
 }
 };
@@ -107,9 +104,6 @@ VclPixelProcessor2D::VclPixelProcessor2D(const 
geometry::ViewInformation2D& rVie
 {
 mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing & 
~AntialiasingFlags::Enable);
 }
-
-// tdf#150462 set text render mode to suit use of resolution independent 
text layout
-mpOutputDevice->SetTextRenderModeForResolutionIndependentLayout(true);
 }
 
 VclPixelProcessor2D::~VclPixelProcessor2D()
@@ -119,9 +113,6 @@ VclPixelProcessor2D::~VclPixelProcessor2D()
 
 // restore AntiAliasing
 mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing);
-
-mpOutputDevice->SetTextRenderModeForResolutionIndependentLayout(
-m_pImpl->m_bOrigTextRenderModeForResolutionIndependentLayout);
 }
 
 void VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect(
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 5a13c640a296..27e7650e8f72 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -236,7 +236,6 @@ private:
 Point   maRefPoint;
 AntialiasingFlags   mnAntialiasing;
 LanguageTypemeTextLanguage;
-bool mbTextRenderModeForResolutionIndependentLayout;
 
 mutable boolmbMap : 1;
 mutable boolmbClipRegion : 1;
@@ -484,10 +483,6 @@ public:
 voidSetAntialiasing( AntialiasingFlags nMode );
 AntialiasingFlags   GetAntialiasing() const { return 
mnAntialiasing; }
 
-// Render glyphs with a mode suitable for rendering of 
resolution-independent layout positions.
-void
SetTextRenderModeForResolutionIndependentLayout(bool bMode);
-bool
GetTextRenderModeForResolutionIndependentLayout() const { return 
mbTextRenderModeForResolutionIndependentLayout; }
-
 voidSetDrawMode( DrawModeFlags nDrawMode );
 

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

2022-08-22 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |  389 ++---
 drawinglayer/source/processor2d/vclprocessor2d.hxx |4 
 2 files changed, 191 insertions(+), 202 deletions(-)

New commits:
commit b2b3b4e833484aa70cb73b296bb62cdb0304eac9
Author: Noel Grandin 
AuthorDate: Sun Aug 21 19:51:58 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon Aug 22 09:27:53 2022 +0200

flatten logic in RenderFillGraphicPrimitive2D a little

splitting part of it out into a helper function

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

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 112ac2b591c7..5c4b15a906c9 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -449,244 +449,229 @@ void VclProcessor2D::RenderBitmapPrimitive2D(const 
primitive2d::BitmapPrimitive2
 
 void VclProcessor2D::RenderFillGraphicPrimitive2D(
 const primitive2d::FillGraphicPrimitive2D& rFillBitmapCandidate)
+{
+bool bPrimitiveAccepted = 
RenderFillGraphicPrimitive2DImpl(rFillBitmapCandidate);
+
+if (!bPrimitiveAccepted)
+{
+// do not accept, use decomposition
+process(rFillBitmapCandidate);
+}
+}
+
+bool VclProcessor2D::RenderFillGraphicPrimitive2DImpl(
+const primitive2d::FillGraphicPrimitive2D& rFillBitmapCandidate)
 {
 const attribute::FillGraphicAttribute& rFillGraphicAttribute(
 rFillBitmapCandidate.getFillGraphic());
-bool bPrimitiveAccepted(false);
 
 // #121194# when tiling is used and content is bitmap-based, do direct 
tiling in the
 // renderer on pixel base to ensure tight fitting. Do not do this when
 // the fill is rotated or sheared.
-if (rFillGraphicAttribute.getTiling())
-{
-// content is bitmap(ex)
-//
-// for Vector Graphic Data (SVG, EMF+) support, force decomposition 
when present. This will lead to use
-// the primitive representation of the vector data directly.
-//
-// when graphic is animated, force decomposition to use the correct 
graphic, else
-// fill style will not be animated
-if (GraphicType::Bitmap == rFillGraphicAttribute.getGraphic().GetType()
-&& !rFillGraphicAttribute.getGraphic().getVectorGraphicData()
-&& !rFillGraphicAttribute.getGraphic().IsAnimated())
-{
-// decompose matrix to check for shear, rotate and mirroring
-basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation
-  * 
rFillBitmapCandidate.getTransformation());
-basegfx::B2DVector aScale, aTranslate;
-double fRotate, fShearX;
-aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
-
-// when nopt rotated/sheared
-if (basegfx::fTools::equalZero(fRotate) && 
basegfx::fTools::equalZero(fShearX))
-{
-// no shear or rotate, draw direct in pixel coordinates
-bPrimitiveAccepted = true;
+if (!rFillGraphicAttribute.getTiling())
+return false;
+
+// content is bitmap(ex)
+//
+// for Vector Graphic Data (SVG, EMF+) support, force decomposition when 
present. This will lead to use
+// the primitive representation of the vector data directly.
+//
+// when graphic is animated, force decomposition to use the correct 
graphic, else
+// fill style will not be animated
+if (GraphicType::Bitmap != rFillGraphicAttribute.getGraphic().GetType()
+|| rFillGraphicAttribute.getGraphic().getVectorGraphicData()
+|| rFillGraphicAttribute.getGraphic().IsAnimated())
+return false;
+
+// decompose matrix to check for shear, rotate and mirroring
+basegfx::B2DHomMatrix aLocalTransform(maCurrentTransformation
+  * 
rFillBitmapCandidate.getTransformation());
+basegfx::B2DVector aScale, aTranslate;
+double fRotate, fShearX;
+aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX);
 
-// transform object range to device coordinates (pixels). Use
-// the device transformation for better accuracy
-basegfx::B2DRange aObjectRange(aTranslate, aTranslate + 
aScale);
-
aObjectRange.transform(mpOutputDevice->GetViewTransformation());
+// when nopt rotated/sheared
+if (!basegfx::fTools::equalZero(fRotate) || 
!basegfx::fTools::equalZero(fShearX))
+return false;
 
-// extract discrete size of object
-const sal_Int32 
nOWidth(basegfx::fround(aObjectRange.getWidth()));
-const sal_Int32 
nOHeight(basegfx::fround(aObjectRange.getHeight()));
+// no shear or rotate, draw 

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

2022-08-18 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit f85cd07295321cf875addeb52aa9e982808b74ae
Author: Caolán McNamara 
AuthorDate: Wed Aug 17 17:16:16 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 18 20:31:10 2022 +0200

tdf#150462 set mode to keep scaled glyph positions as floating point

and match render settings to best support that

Change-Id: I623f9e578ee6c3fe54a966342b3cdd16b31f219a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138450
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 5e0612f94a93..fe2f30cbf23a 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -75,9 +75,12 @@ namespace drawinglayer::processor2d
 struct VclPixelProcessor2D::Impl
 {
 AntialiasingFlags m_nOrigAntiAliasing;
+bool m_bOrigTextRenderModeForResolutionIndependentLayout;
 
 explicit Impl(OutputDevice const& rOutDev)
 : m_nOrigAntiAliasing(rOutDev.GetAntialiasing())
+, m_bOrigTextRenderModeForResolutionIndependentLayout(
+  rOutDev.GetTextRenderModeForResolutionIndependentLayout())
 {
 }
 };
@@ -104,6 +107,9 @@ VclPixelProcessor2D::VclPixelProcessor2D(const 
geometry::ViewInformation2D& rVie
 {
 mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing & 
~AntialiasingFlags::Enable);
 }
+
+// tdf#150462 set text render mode to suit use of resolution independent 
text layout
+mpOutputDevice->SetTextRenderModeForResolutionIndependentLayout(true);
 }
 
 VclPixelProcessor2D::~VclPixelProcessor2D()
@@ -113,6 +119,9 @@ VclPixelProcessor2D::~VclPixelProcessor2D()
 
 // restore AntiAliasing
 mpOutputDevice->SetAntialiasing(m_pImpl->m_nOrigAntiAliasing);
+
+mpOutputDevice->SetTextRenderModeForResolutionIndependentLayout(
+m_pImpl->m_bOrigTextRenderModeForResolutionIndependentLayout);
 }
 
 void VclPixelProcessor2D::tryDrawPolyPolygonColorPrimitive2DDirect(


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

2022-08-18 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |  112 +++-
 sw/qa/extras/layout/layout2.cxx|  144 +++--
 2 files changed, 126 insertions(+), 130 deletions(-)

New commits:
commit 1fa731d03ba0f22cb9392a578124ea977eaab2e9
Author: Caolán McNamara 
AuthorDate: Tue Aug 16 23:39:53 2022 +0100
Commit: Caolán McNamara 
CommitDate: Thu Aug 18 20:30:33 2022 +0200

tdf#150462 don't prescale dxarray before using DrawTextArray

setup the device scaling instead and pass in the unscaled dxarray and at
least give vcl the chance to retain some accuracy

Change-Id: I17660eb77adf8586be6eb54e61bded3a5bcc20a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138448
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 822800882d55..112ac2b591c7 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -91,6 +92,29 @@ sal_uInt32 calculateStepsForSvgGradient(const 
basegfx::BColor& rColorA,
 }
 }
 
+namespace
+{
+/** helper to convert a MapMode to a transformation */
+basegfx::B2DHomMatrix getTransformFromMapMode(const MapMode& rMapMode)
+{
+basegfx::B2DHomMatrix aMapping;
+const Fraction aNoScale(1, 1);
+const Point& rOrigin(rMapMode.GetOrigin());
+
+if (0 != rOrigin.X() || 0 != rOrigin.Y())
+{
+aMapping.translate(rOrigin.X(), rOrigin.Y());
+}
+
+if (rMapMode.GetScaleX() != aNoScale || rMapMode.GetScaleY() != aNoScale)
+{
+aMapping.scale(double(rMapMode.GetScaleX()), 
double(rMapMode.GetScaleY()));
+}
+
+return aMapping;
+}
+}
+
 namespace drawinglayer::processor2d
 {
 // rendering support
@@ -108,29 +132,36 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 basegfx::B2DVector aFontScaling, aTranslate;
 double fRotate, fShearX;
 aLocalTransform.decompose(aFontScaling, aTranslate, fRotate, fShearX);
+
 bool bPrimitiveAccepted(false);
 
 // tdf#95581: Assume tiny shears are rounding artefacts or whatever and 
can be ignored,
 // especially if the effect is less than a pixel.
 if (std::abs(aFontScaling.getY() * fShearX) < 1)
 {
-if (basegfx::fTools::less(aFontScaling.getX(), 0.0)
-&& basegfx::fTools::less(aFontScaling.getY(), 0.0))
+double fIgnoreRotate, fIgnoreShearX;
+
+basegfx::B2DVector aFontSize, aTextTranslate;
+rTextCandidate.getTextTransform().decompose(aFontSize, aTextTranslate, 
fIgnoreRotate,
+fIgnoreShearX);
+
+if (basegfx::fTools::less(aFontSize.getX(), 0.0)
+&& basegfx::fTools::less(aFontSize.getY(), 0.0))
 {
 // handle special case: If scale is negative in (x,y) (3rd 
quadrant), it can
 // be expressed as rotation by PI. Use this since the Font 
rendering will not
 // apply the negative scales in any form
-aFontScaling = basegfx::absolute(aFontScaling);
+aFontSize = basegfx::absolute(aFontSize);
 fRotate += M_PI;
 }
 
-if (basegfx::fTools::more(aFontScaling.getX(), 0.0)
-&& basegfx::fTools::more(aFontScaling.getY(), 0.0))
+if (basegfx::fTools::more(aFontSize.getX(), 0.0)
+&& basegfx::fTools::more(aFontSize.getY(), 0.0))
 {
-// Get the VCL font (use FontHeight as FontWidth)
+// Get the VCL font
 vcl::Font aFont(primitive2d::getVclFontFromFontAttribute(
-rTextCandidate.getFontAttribute(), aFontScaling.getX(), 
aFontScaling.getY(),
-fRotate, rTextCandidate.getLocale()));
+rTextCandidate.getFontAttribute(), aFontSize.getX(), 
aFontSize.getY(), fRotate,
+rTextCandidate.getLocale()));
 
 // Don't draw fonts without height
 if (aFont.GetFontHeight() <= 0)
@@ -249,27 +280,20 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 aFont.SetShadow(true);
 }
 
-// create transformed integer DXArray in view coordinate system
-std::vector aTransformedDXArray;
+// create integer DXArray
+std::vector aDXArray;
 
 if (!rTextCandidate.getDXArray().empty())
 {
-
aTransformedDXArray.reserve(rTextCandidate.getDXArray().size());
-const basegfx::B2DVector aPixelVector(maCurrentTransformation
-  * 
basegfx::B2DVector(1.0, 0.0));
-const double fPixelVectorFactor(aPixelVector.getLength());
-
+aDXArray.reserve(rTextCandidate.getDXArray().size());

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

2022-08-17 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit fad0cb2fba8b3d41fe8b12659ba0cf63c89aa90e
Author: Caolán McNamara 
AuthorDate: Tue Aug 16 09:54:18 2022 +0100
Commit: Caolán McNamara 
CommitDate: Wed Aug 17 09:55:33 2022 +0200

cid#1456603 Uninitialized scalar field

Change-Id: I301e6a111f63239b006d01834fb4b63f0d581b04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138374
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index e9b8422557a9..582b86fe72e9 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -923,6 +923,8 @@ namespace emfplushelper
 mnMmY(0),
 mbMultipart(false),
 mMFlags(0),
+mdExtractedXScale(1.0),
+mdExtractedYScale(1.0),
 mrTargetHolders(rTargetHolders),
 mrPropertyHolders(rPropertyHolders),
 bIsGetDCProcessing(false)


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

2022-08-14 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/tools/converters.cxx |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 97f2027fa75deafc7d28db3a2efe96236320d181
Author: Caolán McNamara 
AuthorDate: Sat Aug 13 20:09:02 2022 +0100
Commit: Caolán McNamara 
CommitDate: Sun Aug 14 16:43:54 2022 +0200

check SetOutputSizePixel for failure

Change-Id: If57dbbd7f04f0ee5286cf24a00480271bd4d9f76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138237
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 2ba781386e49..2f657afedc69 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -76,7 +76,11 @@ namespace drawinglayer
 ScopedVclPtrInstance< VirtualDevice > pContent;
 
 // prepare vdev
-pContent->SetOutputSizePixel(aSizePixel, false);
+if (!pContent->SetOutputSizePixel(aSizePixel, false))
+{
+SAL_WARN("vcl", "Cannot set VirtualDevice to size : " << 
aSizePixel.Width() << "x" << aSizePixel.Height());
+return aRetval;
+}
 pContent->SetMapMode(aMapModePixel);
 
 // set to all white


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

2022-07-21 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |   11 +--
 drawinglayer/source/processor2d/vclhelperbufferdevice.hxx |2 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |   42 +-
 3 files changed, 34 insertions(+), 21 deletions(-)

New commits:
commit 8c15835762f2b16e7c8f5acd2d52f562c7dec9a4
Author: Mike Kaganski 
AuthorDate: Thu Jul 21 14:40:54 2022 +0300
Commit: Mike Kaganski 
CommitDate: Thu Jul 21 20:04:52 2022 +0200

tdf#144916: expand range to avoid unwanted effects on viewport edges

This also allows to avoid clipping of impBufferDevice to the passed
OutputDevice, because the expanded range couldn't otherwise be processed
on the buffer device.

Change-Id: I0d778365b09937c1a2ecee06477b0b17efcce44b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137296
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index c19dd965755a..4a29344023b1 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -294,18 +294,17 @@ VDevBuffer& getVDevBuffer()
 return *aVDevBuffer.get();
 }
 
-impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
basegfx::B2DRange& rRange)
+impBufferDevice::impBufferDevice(OutputDevice& rOutDev, const 
basegfx::B2DRange& rRange, bool bCrop)
 : mrOutDev(rOutDev)
 , mpContent(nullptr)
 , mpAlpha(nullptr)
 {
 basegfx::B2DRange aRangePixel(rRange);
 aRangePixel.transform(mrOutDev.GetViewTransformation());
-const ::tools::Rectangle aRectPixel(floor(aRangePixel.getMinX()), 
floor(aRangePixel.getMinY()),
-ceil(aRangePixel.getMaxX()), 
ceil(aRangePixel.getMaxY()));
-const Point aEmptyPoint;
-maDestPixel = ::tools::Rectangle(aEmptyPoint, 
mrOutDev.GetOutputSizePixel());
-maDestPixel.Intersection(aRectPixel);
+maDestPixel = tools::Rectangle(floor(aRangePixel.getMinX()), 
floor(aRangePixel.getMinY()),
+   ceil(aRangePixel.getMaxX()), 
ceil(aRangePixel.getMaxY()));
+if (bCrop)
+maDestPixel.Intersection({ {}, mrOutDev.GetOutputSizePixel() });
 
 if (!isVisible())
 return;
diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
index 3b5d30415cc2..99585b05b141 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.hxx
@@ -38,7 +38,7 @@ class impBufferDevice
 tools::Rectangle maDestPixel;
 
 public:
-impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& rRange);
+impBufferDevice(OutputDevice& rOutDev, const basegfx::B2DRange& rRange, 
bool bCrop = true);
 ~impBufferDevice();
 
 void paint(double fTrans = 0.0);
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index df2642c9fdbe..5e0612f94a93 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1025,13 +1025,29 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, 
double fErodeDilateRadius
 
 return AlphaMask(mask.GetBitmap());
 }
+
+drawinglayer::geometry::ViewInformation2D
+expandRange(const drawinglayer::geometry::ViewInformation2D& rViewInfo, double 
nAmount)
+{
+basegfx::B2DRange viewport(rViewInfo.getViewport());
+viewport.grow(nAmount);
+return { rViewInfo.getObjectTransformation(),
+ rViewInfo.getViewTransformation(),
+ viewport,
+ rViewInfo.getVisualizedPage(),
+ rViewInfo.getViewTime(),
+ rViewInfo.getReducedDisplayQuality() };
+}
 }
 
 void VclPixelProcessor2D::processGlowPrimitive2D(const 
primitive2d::GlowPrimitive2D& rCandidate)
 {
-basegfx::B2DRange aRange(rCandidate.getB2DRange(getViewInformation2D()));
+const double nGlowRadius(rCandidate.getGlowRadius());
+// Avoid wrong effect on the cut-off side; so expand by radius
+const auto aExpandedViewInfo(expandRange(getViewInformation2D(), 
nGlowRadius));
+basegfx::B2DRange aRange(rCandidate.getB2DRange(aExpandedViewInfo));
 aRange.transform(maCurrentTransformation);
-basegfx::B2DVector aGlowRadiusVector(rCandidate.getGlowRadius(), 0);
+basegfx::B2DVector aGlowRadiusVector(nGlowRadius, 0);
 // Calculate the pixel size of glow radius in current transformation
 aGlowRadiusVector *= maCurrentTransformation;
 // Glow radius is the size of the halo from each side of the object. The 
halo is the
@@ -1042,7 +1058,7 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const 
primitive2d::GlowPrimitiv
 // Consider glow transparency (initial transparency near the object edge)
 const sal_uInt8 

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

2022-07-19 Thread offtkp (via logerrit)
 drawinglayer/source/tools/converters.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 6203edf731f4cd3e678691af05def22394db2a89
Author: offtkp 
AuthorDate: Sat Jul 9 20:43:44 2022 +0300
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 19 13:06:47 2022 +0200

Replace old png writer in converters.cxx

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

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index c0a92a8f479f..2ba781386e49 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -32,7 +32,7 @@
 
 #ifdef DBG_UTIL
 #include 
-#include 
+#include 
 #endif
 
 namespace drawinglayer
@@ -111,8 +111,8 @@ namespace drawinglayer
 #endif
 , StreamMode::WRITE|StreamMode::TRUNC);
 BitmapEx aContentEx(aContent);
-vcl::PNGWriter aPNGWriter(aContentEx);
-aPNGWriter.Write(aNew);
+vcl::PngImageWriter aPNGWriter(aNew);
+aPNGWriter.write(aContentEx);
 }
 #endif
 // prepare for mask creation
@@ -147,8 +147,8 @@ namespace drawinglayer
 #endif
 , StreamMode::WRITE|StreamMode::TRUNC);
 BitmapEx aAlphaEx(aAlpha);
-vcl::PNGWriter aPNGWriter(aAlphaEx);
-aPNGWriter.Write(aNew);
+vcl::PngImageWriter aPNGWriter(aNew);
+aPNGWriter.write(aAlphaEx);
 }
 #endif
 
@@ -164,8 +164,8 @@ namespace drawinglayer
 "~/test_combined.png"
 #endif
 , StreamMode::WRITE|StreamMode::TRUNC);
-vcl::PNGWriter aPNGWriter(aRetval);
-aPNGWriter.Write(aNew);
+vcl::PngImageWriter aPNGWriter(aNew);
+aPNGWriter.write(aRetval);
 }
 #endif
 }


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

2022-07-09 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 77ead3d8c01b3663b0ff701a934f10b602252412
Author: Noel Grandin 
AuthorDate: Sat Jul 9 10:58:11 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat Jul 9 12:20:31 2022 +0200

tdf#149890 SVG: pattern is displayed with black fill

regression from
commit 3cbe3a0259bea4dec70e72191ec3c03441926a07
Author: Noel Grandin 
Date:   Mon Jun 14 15:05:59 2021 +0200
tdf#101083 speed up SVG rendering with pattern fill

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

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index ac27fa59dc70..df2642c9fdbe 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1286,7 +1286,9 @@ void VclPixelProcessor2D::processPatternFillPrimitive2D(
 {
 mpOutputDevice->Push(vcl::PushFlags::CLIPREGION);
 mpOutputDevice->IntersectClipRegion(vcl::Region(aMask));
-mpOutputDevice->DrawWallpaper(aMaskRect, Wallpaper(aTileImage));
+Wallpaper aWallpaper(aTileImage);
+aWallpaper.SetColor(COL_TRANSPARENT);
+mpOutputDevice->DrawWallpaper(aMaskRect, aWallpaper);
 mpOutputDevice->Pop();
 return;
 }
@@ -1309,7 +1311,11 @@ void VclPixelProcessor2D::processPatternFillPrimitive2D(
 mpOutputDevice->DrawRect(aMaskRect);
 }
 else
-mpOutputDevice->DrawWallpaper(aMaskRect, Wallpaper(aTileImage));
+{
+Wallpaper aWallpaper(aTileImage);
+aWallpaper.SetColor(COL_TRANSPARENT);
+mpOutputDevice->DrawWallpaper(aMaskRect, aWallpaper);
+}
 
 // back to old OutDev
 mpOutputDevice = pLastOutputDevice;


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

2022-06-29 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ee013bd6af5acb6a12f596a7b32e12cb42755efb
Author: Andrea Gelmini 
AuthorDate: Wed Jun 29 18:15:54 2022 +0200
Commit: Julien Nabet 
CommitDate: Wed Jun 29 19:26:58 2022 +0200

Fix typos

Change-Id: Ifcefc082a007ebae2c4415a475d73b6bf64d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136628
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index f2bf82a9ce7b..ac27fa59dc70 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1212,10 +1212,10 @@ void 
VclPixelProcessor2D::processFillGradientPrimitive2D(
 }
 
 // tdf#149754 VCL gradient draw is not capable to handle all primitive 
gradient definitions,
-// what should be clear due to being developed to ectend/replace them in
+// what should be clear due to being developed to extend/replace them in
 // capabilities & precision.
 // It is e.g. not capable to correctly paint if the OutputRange is not 
completely
-// inside the DefinitionRange, thus forcing to paint gradent parts 
*outside* the
+// inside the DefinitionRange, thus forcing to paint gradient parts 
*outside* the
 // DefinitionRange.
 // This happens for Writer with Frames anchored in Frames (and was broken 
due to
 // falling back to VCL Gradient paint here), and for the new 
SlideBackgroundFill


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

2022-06-28 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   19 
 1 file changed, 19 insertions(+)

New commits:
commit 0be0b4e57cbeaab3e73f1d12ef2ad9b55fd1c885
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Jun 28 11:16:56 2022 +0200
Commit: Armin Le Grand 
CommitDate: Tue Jun 28 17:48:08 2022 +0200

tdf#149754 correct gradient paint for outside definition range

Change-Id: I45fc0a7a024a4288f698eb5f0abf6b0d1440edfc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136561
Tested-by: Jenkins
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 362d0ddf9cab..f2bf82a9ce7b 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1211,6 +1211,25 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
 return;
 }
 
+// tdf#149754 VCL gradient draw is not capable to handle all primitive 
gradient definitions,
+// what should be clear due to being developed to ectend/replace them in
+// capabilities & precision.
+// It is e.g. not capable to correctly paint if the OutputRange is not 
completely
+// inside the DefinitionRange, thus forcing to paint gradent parts 
*outside* the
+// DefinitionRange.
+// This happens for Writer with Frames anchored in Frames (and was broken 
due to
+// falling back to VCL Gradient paint here), and for the new 
SlideBackgroundFill
+// Fill mode for objects using it that reach outside the page (which is the
+// DefinitionRange in that case).
+// I see no real reason to fallback here to OutputDevice::DrawGradient and 
VCL
+// gradient paint at all (system-dependent renderers wouldn't in the 
future), but
+// will for convenience only add that needed additional correcting case
+if (!rPrimitive.getDefinitionRange().isInside(rPrimitive.getOutputRange()))
+{
+process(rPrimitive);
+return;
+}
+
 GradientStyle eGradientStyle = 
convertGradientStyle(rFillGradient.getStyle());
 
 Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()),


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

2022-06-27 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfpcustomlinecap.cxx|   26 +-
 drawinglayer/source/tools/emfpcustomlinecap.hxx|2 
 drawinglayer/source/tools/emfphelperdata.cxx   |  113 
+-
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   26 ++
 emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf |binary
 5 files changed, 61 insertions(+), 106 deletions(-)

New commits:
commit 5b21b65572610df88986e700b81f1156aff14f65
Author: Bartosz Kosiorek 
AuthorDate: Thu Jun 16 02:47:23 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon Jun 27 10:24:13 2022 +0200

tdf#142770 tdf#143031 EMF+ Implement CustomLineCap

Change-Id: I9fae1d259ecdca37a1babac8a8a0e503b2dc0118
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135960
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfpcustomlinecap.cxx 
b/drawinglayer/source/tools/emfpcustomlinecap.cxx
index 49cc912ed33c..e457a36cc2c4 100644
--- a/drawinglayer/source/tools/emfpcustomlinecap.cxx
+++ b/drawinglayer/source/tools/emfpcustomlinecap.cxx
@@ -21,6 +21,7 @@
 #include "emfpcustomlinecap.hxx"
 #include "emfppath.hxx"
 #include "emfppen.hxx"
+#include 
 
 using namespace ::com::sun::star;
 using namespace ::basegfx;
@@ -39,6 +40,7 @@ namespace emfplushelper
 , strokeEndCap(0)
 , strokeJoin(0)
 , miterLimit(0.0)
+, widthScale(0.0)
 , mbIsFilled(false)
 {
 }
@@ -57,6 +59,8 @@ namespace emfplushelper
 EMFPPath path(pathPoints);
 path.Read(s, pathFlags);
 polygon = path.GetPolygon(rR, false);
+// rotate polygon by 180 degrees
+polygon.transform(basegfx::utils::createRotateB2DHomMatrix(M_PI));
 mbIsFilled = bFill;
 }
 
@@ -71,7 +75,6 @@ namespace emfplushelper
 {
 sal_uInt32 customLineCapDataFlags, baseCap;
 float baseInset;
-float widthScale;
 float fillHotSpotX, fillHotSpotY, strokeHotSpotX, strokeHotSpotY;
 
 
s.ReadUInt32(customLineCapDataFlags).ReadUInt32(baseCap).ReadFloat(baseInset)
@@ -82,11 +85,6 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf", "EMF+\t\tcustomLineCapDataFlags: 0x" 
<< std::hex << customLineCapDataFlags);
 SAL_INFO("drawinglayer.emf", "EMF+\t\tbaseCap: 0x" << std::hex << 
baseCap);
 SAL_INFO("drawinglayer.emf", "EMF+\t\tbaseInset: " << baseInset);
-SAL_INFO("drawinglayer.emf", "EMF+\t\tstrokeStartCap: 0x" << 
std::hex << strokeStartCap);
-SAL_INFO("drawinglayer.emf", "EMF+\t\tstrokeEndCap: 0x" << 
std::hex << strokeEndCap);
-SAL_INFO("drawinglayer.emf", "EMF+\t\tstrokeJoin: 0x" << std::hex 
<< strokeJoin);
-SAL_INFO("drawinglayer.emf", "EMF+\t\tmiterLimit: " << miterLimit);
-SAL_INFO("drawinglayer.emf", "EMF+\t\twidthScale: " << widthScale);
 
 if (customLineCapDataFlags & EmfPlusCustomLineCapDataFillPath)
 {
@@ -103,16 +101,20 @@ namespace emfplushelper
 // TODO only reads the data, does not use them [I've had
 // no test document to be able to implement it]
 
-sal_Int32 width, height, middleInset, fillState, lineStartCap;
-sal_Int32 lineEndCap, lineJoin, widthScale;
-float fillHotSpotX, fillHotSpotY, lineHotSpotX, lineHotSpotY;
+sal_Int32 fillState;
+float width, height, middleInset, unusedHotSpot;
 
-
s.ReadInt32(width).ReadInt32(height).ReadInt32(middleInset).ReadInt32(fillState).ReadInt32(lineStartCap)
-
.ReadInt32(lineEndCap).ReadInt32(lineJoin).ReadFloat(miterLimit).ReadInt32(widthScale)
-
.ReadFloat(fillHotSpotX).ReadFloat(fillHotSpotY).ReadFloat(lineHotSpotX).ReadFloat(lineHotSpotY);
+
s.ReadFloat(width).ReadFloat(height).ReadFloat(middleInset).ReadInt32(fillState).ReadUInt32(strokeStartCap)
+
.ReadUInt32(strokeEndCap).ReadUInt32(strokeJoin).ReadFloat(miterLimit).ReadFloat(widthScale)
+
.ReadFloat(unusedHotSpot).ReadFloat(unusedHotSpot).ReadFloat(unusedHotSpot).ReadFloat(unusedHotSpot);
 
 SAL_INFO("drawinglayer.emf", "EMF+\t\tTODO - actually read 
EmfPlusCustomLineCapArrowData object (section 2.2.2.12)");
 }
+SAL_INFO("drawinglayer.emf", "EMF+\t\tstrokeStartCap: 0x" << std::hex 
<< strokeStartCap);
+SAL_INFO("drawinglayer.emf", "EMF+\t\tstrokeEndCap: 0x" << std::hex << 
strokeEndCap);
+SAL_INFO("drawinglayer.emf", "EMF+\t\tstrokeJoin: 0x" << std::hex << 
strokeJoin);
+SAL_INFO("drawinglayer.emf", "EMF+\t\tmiterLimit: " << miterLimit);
+SAL_INFO("drawinglayer.emf", "EMF+\t\twidthScale: " << widthScale);
 }
 }
 
diff --git a/drawinglayer/source/tools/emfpcustomlinecap.hxx 
b/drawinglayer/source/tools/emfpcustomlinecap.hxx
index e6202ae98179..22ed6be6dd4d 100644
--- 

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

2022-06-20 Thread Armin Le Grand (Allotropia) (via logerrit)
 drawinglayer/source/attribute/sdrfillattribute.cxx   |   16 +
 include/drawinglayer/attribute/sdrfillattribute.hxx  |5 
 include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx |1 
 svx/source/sdr/primitive2d/sdrattributecreator.cxx   |   14 +
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |  247 +++
 5 files changed, 280 insertions(+), 3 deletions(-)

New commits:
commit 50394abcc36a73c0205e6cb69d925c66c25f81f2
Author: Armin Le Grand (Allotropia) 
AuthorDate: Thu Jun 16 12:23:37 2022 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Mon Jun 20 10:36:15 2022 +0200

tdf#128150 Implement/add SlideBackgroundFill visualization

React/interpret new SlideBackgroundFill mode for SdrObjects/
XShapes, defined by drawing::FillStyle_NONE and usage of
XFillUseSlideBackgroundItem as (true).

Do so by adding a detection, a mode to SdrFillAttribute,
reacting on it by creating a new implemented  B2DPrimitive:

SlideBackgroundFillPrimitive2D provides a Primitive2D for
the SlideBackgroundFill mode. It is capable of expressing
that state of fill and it's decomposition implements all
needed preparation/creation/collecting of the geometry
in an isolated and controllable space and way - the
B2DPrimitive way. It does so based on the given
ViewInformation2D, reacing out for all needed data/
geometry from this.
It clips & transforms/combines as needed, providing the
necessary visualization of the MasterPage content *over*
other objects on the Page/Slide. It is currently simple
buffered (due to being derived from
BufferedDecompositionPrimitive2D) and detects if
MasterPage changes. Still, more may be needed.

Change-Id: Ie11403c0b705fc2ecdfd7eb2fa5ae1a93a21b460
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135971
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/drawinglayer/source/attribute/sdrfillattribute.cxx 
b/drawinglayer/source/attribute/sdrfillattribute.cxx
index 1a4388ee4b30..8cee8f98d1e9 100644
--- a/drawinglayer/source/attribute/sdrfillattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillattribute.cxx
@@ -82,6 +82,11 @@ namespace drawinglayer::attribute
 static SdrFillAttribute::ImplType SINGLETON;
 return SINGLETON;
 }
+SdrFillAttribute::ImplType& slideBackgroundFillGlobalDefault()
+{
+static SdrFillAttribute::ImplType SINGLETON2;
+return SINGLETON2;
+}
 }
 
 SdrFillAttribute::SdrFillAttribute(
@@ -95,8 +100,10 @@ namespace drawinglayer::attribute
 {
 }
 
-SdrFillAttribute::SdrFillAttribute()
-:   mpSdrFillAttribute(theGlobalDefault())
+SdrFillAttribute::SdrFillAttribute(bool bSlideBackgroundFill)
+:   mpSdrFillAttribute(bSlideBackgroundFill
+? slideBackgroundFillGlobalDefault()
+: theGlobalDefault())
 {
 }
 
@@ -111,6 +118,11 @@ namespace drawinglayer::attribute
 return mpSdrFillAttribute.same_object(theGlobalDefault());
 }
 
+bool SdrFillAttribute::isSlideBackgroundFill() const
+{
+return 
mpSdrFillAttribute.same_object(slideBackgroundFillGlobalDefault());
+}
+
 SdrFillAttribute& SdrFillAttribute::operator=(const SdrFillAttribute&) 
= default;
 
 SdrFillAttribute& SdrFillAttribute::operator=(SdrFillAttribute&&) = 
default;
diff --git a/include/drawinglayer/attribute/sdrfillattribute.hxx 
b/include/drawinglayer/attribute/sdrfillattribute.hxx
index 93fc7ca8541c..6ba140065d4c 100644
--- a/include/drawinglayer/attribute/sdrfillattribute.hxx
+++ b/include/drawinglayer/attribute/sdrfillattribute.hxx
@@ -56,7 +56,7 @@ namespace drawinglayer::attribute
 const FillGradientAttribute& rGradient,
 const FillHatchAttribute& rHatch,
 const SdrFillGraphicAttribute& rFillGraphic);
-SdrFillAttribute();
+SdrFillAttribute(bool bSlideBackgroundFill = false);
 SdrFillAttribute(const SdrFillAttribute&);
 SdrFillAttribute(SdrFillAttribute&&);
 SdrFillAttribute& operator=(const SdrFillAttribute&);
@@ -66,6 +66,9 @@ namespace drawinglayer::attribute
 // checks if the incarnation is default constructed
 bool isDefault() const;
 
+// checks if the incarnation is slideBackgroundFill
+bool isSlideBackgroundFill() const;
+
 // compare operator
 bool operator==(const SdrFillAttribute& rCandidate) const;
 
diff --git a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx 
b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
index 0af20f04d710..917d22f149da 100644
--- a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
+++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
@@ -49,6 +49,7 @@
 #define 

[Libreoffice-commits] core.git: drawinglayer/source emfio/qa svgio/qa

2022-06-14 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfpbrush.cxx   |   
12 ++
 drawinglayer/source/tools/emfphelperdata.cxx  |   
55 ++
 drawinglayer/source/tools/primitive2dxmldump.cxx  |   
42 ++-
 emfio/qa/cppunit/emf/EmfImportTest.cxx|   
23 
 emfio/qa/cppunit/emf/data/TestEmfPlusBrushPathGradientWithBlendColors.emf 
|binary
 svgio/qa/cppunit/SvgImportTest.cxx|   
14 ++
 6 files changed, 98 insertions(+), 48 deletions(-)

New commits:
commit 7b12c659842eb53b96dd98ecea65c6071506dfbb
Author: Bartosz Kosiorek 
AuthorDate: Sun Jun 12 21:51:52 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Tue Jun 14 10:30:32 2022 +0200

tdf#131506 tdf#143031 EMF+ Fix displaying PathGradient fill

With previous implementation, the EMF+ import is calculating
gradient positions wrongly. It is causing warning:

  SvgGradientHelper got invalid SvgGradientEntries outside [0.0 .. 1.0]

and the gradient was not displayed at all.
This patch fixes that and gradient is displayed correctly

Change-Id: I6229c516165436d0c7ae187d9eb69b5494da396f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135607
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfpbrush.cxx 
b/drawinglayer/source/tools/emfpbrush.cxx
index 7d6204a5da9e..c79b0ded0748 100644
--- a/drawinglayer/source/tools/emfpbrush.cxx
+++ b/drawinglayer/source/tools/emfpbrush.cxx
@@ -182,6 +182,12 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tUse brush 
transformation: " << brush_transformation);
 }
 
+// BrushDataPresetColors and BrushDataBlendFactorsH
+if ((additionalFlags & 0x04) && (additionalFlags & 0x08))
+{
+SAL_WARN("drawinglayer.emf", "EMF+\t Brush must not 
contain both BrushDataPresetColors and BrushDataBlendFactorsH");
+return;
+}
 if (additionalFlags & 0x08) // BrushDataBlendFactorsH
 {
 s.ReadUInt32(blendPoints);
@@ -250,6 +256,12 @@ namespace emfplushelper
 hasTransformation = true;
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tUse brush 
transformation: " << brush_transformation);
 }
+// BrushDataPresetColors and BrushDataBlendFactorsH
+if ((additionalFlags & 0x04) && (additionalFlags & 0x08))
+{
+SAL_WARN("drawinglayer.emf", "EMF+\t Brush must not 
contain both BrushDataPresetColors and BrushDataBlendFactorsH");
+return;
+}
 
 if (additionalFlags & 0x08) // BrushDataBlendFactorsH
 {
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index d76e8f358c9d..94a50fc05cea 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -880,21 +880,12 @@ namespace emfplushelper
 // store the blendpoints in the vector
 for (sal_uInt32 i = 0; i < brush->blendPoints; i++)
 {
-double aBlendPoint;
+const double aBlendPoint = brush->blendPositions[i];
 basegfx::BColor aColor;
-if (brush->type == BrushTypeLinearGradient)
-{
-aBlendPoint = brush->blendPositions [i];
-}
-else
-{
-// seems like SvgRadialGradientPrimitive2D needs 
doubled, inverted radius
-aBlendPoint = 2. * ( 1. - brush->blendPositions 
[i] );
-}
-aColor.setGreen( aStartColor.getGreen() + 
brush->blendFactors[i] * ( aEndColor.getGreen() - aStartColor.getGreen() ) );
-aColor.setBlue ( aStartColor.getBlue()  + 
brush->blendFactors[i] * ( aEndColor.getBlue() - aStartColor.getBlue() ) );
-aColor.setRed  ( aStartColor.getRed()   + 
brush->blendFactors[i] * ( aEndColor.getRed() - aStartColor.getRed() ) );
-const double aAlpha = brush->solidColor.GetAlpha() + 
brush->blendFactors[i] * ( brush->secondColor.GetAlpha() - 
brush->solidColor.GetAlpha() );
+aColor.setGreen(aStartColor.getGreen() + 
brush->blendFactors[i] * (aEndColor.getGreen() - aStartColor.getGreen()));
+aColor.setBlue (aStartColor.getBlue()  + 
brush->blendFactors[i] * (aEndColor.getBlue() - aStartColor.getBlue()));
+aColor.setRed  (aStartColor.getRed()   + 
brush->blendFactors[i] * 

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

2022-06-03 Thread Gülşah Köse (via logerrit)
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a658129012f1d183f95f8bf5dd6d7ff6926cd495
Author: Gülşah Köse 
AuthorDate: Thu May 26 11:03:41 2022 +0300
Commit: Gülşah Köse 
CommitDate: Fri Jun 3 10:15:56 2022 +0200

tdf#136787 Add control to create 1-bit B bitmap while creating mask.

Glow effect creates half transparent pixels on shadow. Creating 1-bit
B bitmap mask treates that half transparent pixels as black.
We control 1-bit B bitmap creation when we have half transparent
pixels.

Change-Id: Iaf298a0e5ffeeb6637fe5d3f56cf4f8e30a203e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134981
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 70b5331f1f79..362d0ddf9cab 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -981,11 +981,12 @@ namespace
nTransparency defines minimal transparency level.
 */
 AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius,
-  double fBlurRadius, sal_uInt8 nTransparency)
+  double fBlurRadius, sal_uInt8 nTransparency,
+  bool bConvertTo1Bit = true)
 {
 // Only completely white pixels on the initial mask must be considered for 
transparency. Any
 // other color must be treated as black. This creates 1-bit B bitmap.
-BitmapEx mask(rMask.CreateMask(COL_WHITE));
+BitmapEx mask(bConvertTo1Bit ? rMask.CreateMask(COL_WHITE) : rMask);
 
 // Scaling down increases performance without noticeable quality loss. 
Additionally,
 // current blur implementation can only handle blur radius between 2 and 
254.
@@ -1177,7 +1178,7 @@ void VclPixelProcessor2D::processShadowPrimitive2D(const 
primitive2d::ShadowPrim
 
 BitmapEx bitmapEx = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), 
aRect.GetSize());
 
-AlphaMask mask = ProcessAndBlurAlphaMask(bitmapEx.GetAlpha(), 0, 
fBlurRadius, 0);
+AlphaMask mask = ProcessAndBlurAlphaMask(bitmapEx.GetAlpha(), 0, 
fBlurRadius, 0, false);
 
 const basegfx::BColor aShadowColor(
 
maBColorModifierStack.getModifiedColor(rCandidate.getShadowColor()));


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

2022-05-31 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx  |   18 +-
 include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx |2 -
 2 files changed, 3 insertions(+), 17 deletions(-)

New commits:
commit a77b8b75f015fba74e2553c3cff58fcba298b9ed
Author: Noel Grandin 
AuthorDate: Tue May 31 18:25:35 2022 +0200
Commit: Noel Grandin 
CommitDate: Tue May 31 21:18:18 2022 +0200

elide temporary vector in TextDecoratedPortionPrimitive2D

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

diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index f92529fe50d7..0db26fbeb28d 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -30,7 +30,7 @@
 namespace drawinglayer::primitive2d
 {
 void TextDecoratedPortionPrimitive2D::impCreateGeometryContent(
-std::vector< Primitive2DReference >& rTarget,
+Primitive2DContainer& rTarget,
 basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose const & 
rDecTrans,
 const OUString& rText,
 sal_Int32 nTextPosition,
@@ -170,7 +170,6 @@ namespace drawinglayer::primitive2d
 // decompose local entity
 }
 }
-std::vector< Primitive2DReference > aNewPrimitives;
 basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose 
aDecTrans(getTextTransform());
 Primitive2DContainer aRetval;
 
@@ -190,20 +189,7 @@ namespace drawinglayer::primitive2d
 getFontAttribute().getBiDiStrong());
 
 // handle as one word
-impCreateGeometryContent(aNewPrimitives, aDecTrans, getText(), 
getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute);
-
-// convert to Primitive2DSequence
-const sal_uInt32 nMemberCount(aNewPrimitives.size());
-
-if(nMemberCount)
-{
-aRetval.resize(nMemberCount);
-
-for(sal_uInt32 a(0); a < nMemberCount; a++)
-{
-aRetval[a] = aNewPrimitives[a];
-}
-}
+impCreateGeometryContent(aRetval, aDecTrans, getText(), 
getTextPosition(), getTextLength(), getDXArray(), aNewFontAttribute);
 
 // Handle Shadow, Outline and TextRelief
 if(!aRetval.empty())
diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx 
b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
index 8ff500b77efe..1a4d821c7e60 100644
--- a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -57,7 +57,7 @@ namespace drawinglayer::primitive2d
 
 /// helper methods
 void impCreateGeometryContent(
-std::vector< Primitive2DReference >& rTarget,
+Primitive2DContainer& rTarget,
 basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose const & 
rDecTrans,
 const OUString& rText,
 sal_Int32 nTextPosition,


[Libreoffice-commits] core.git: drawinglayer/source svx/source

2022-05-30 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx |2 +-
 drawinglayer/source/primitive2d/graphicprimitive2d.cxx  |2 +-
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx|2 +-
 drawinglayer/source/primitive2d/mediaprimitive2d.cxx|2 +-
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx |2 +-
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx|2 +-
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx|2 +-
 drawinglayer/source/primitive2d/textprimitive2d.cxx |2 +-
 drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx|2 +-
 svx/source/sdr/overlay/overlaytools.cxx |4 ++--
 svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx|2 +-
 svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx  |2 +-
 svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx|2 +-
 svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx|4 ++--
 svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx|2 +-
 svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx   |2 +-
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx|2 +-
 svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx   |2 +-
 svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx  |2 +-
 19 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit 4fc1f038a687e1db4319bb08367fbdbad96fcbdd
Author: Noel Grandin 
AuthorDate: Sun May 29 21:20:02 2022 +0200
Commit: Noel Grandin 
CommitDate: Mon May 30 10:07:47 2022 +0200

use more Primitive2DContainer::append and more std::move

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

diff --git 
a/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx 
b/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
index 3ad4840bd5bd..d5ed17980016 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx
@@ -66,7 +66,7 @@ void PolyPolygonSelectionPrimitive2D::create2DDecomposition(
 aRetval = Primitive2DContainer{ aTrans };
 }
 
-rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end());
+rContainer.append(std::move(aRetval));
 }
 
 PolyPolygonSelectionPrimitive2D::PolyPolygonSelectionPrimitive2D(
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
index 0d57512f2f86..4cd7a4963f9d 100644
--- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx
@@ -167,7 +167,7 @@ void 
GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer,
 aRetval = Primitive2DContainer{ xPrimitive };
 }
 
-rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end());
+rContainer.append(std::move(aRetval));
 }
 
 GraphicPrimitive2D::GraphicPrimitive2D(const basegfx::B2DHomMatrix& rTransform,
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 7f27fa782ff8..c79af14dd673 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -572,7 +572,7 @@ namespace drawinglayer::primitive2d
 }
 }
 
-rContainer.insert(rContainer.end(), aRetval.begin(), 
aRetval.end());
+rContainer.append(std::move(aRetval));
 }
 
 Primitive2DContainer create2DColorModifierEmbeddingsAsNeeded(
diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx 
b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
index cd36291428ea..e097d2d98ae7 100644
--- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
@@ -87,7 +87,7 @@ namespace drawinglayer::primitive2d
 }
 }
 
-rContainer.insert(rContainer.end(), xRetval.begin(), 
xRetval.end());
+rContainer.append(std::move(xRetval));
 }
 
 MediaPrimitive2D::MediaPrimitive2D(
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx 
b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index eddb02375d0a..608be0bbc6b1 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -82,7 +82,7 @@ namespace drawinglayer::primitive2d
 xRetval = Primitive2DContainer { aEmbeddedTransform };
 }
 
-rContainer.insert(rContainer.end(), 

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

2022-05-29 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/textbreakuphelper.cxx|6 +++---
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx |6 +++---
 include/drawinglayer/primitive2d/textbreakuphelper.hxx   |2 +-
 svgio/source/svgreader/svgcharacternode.cxx  |7 +++
 svgio/source/svgreader/svgtextpathnode.cxx   |8 
 5 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit d286a820fac4dbac993e13afda52dde79b310af4
Author: Noel Grandin 
AuthorDate: Sun May 29 12:24:23 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 29 19:15:03 2022 +0200

we can std::move the data out of TextBreakupHelper

and save some copying

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

diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx 
b/drawinglayer/source/primitive2d/textbreakuphelper.cxx
index 9c4424b8d01e..5ca10ce633b6 100644
--- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx
+++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx
@@ -261,14 +261,14 @@ namespace drawinglayer::primitive2d
 mxResult = aTempResult;
 }
 
-const Primitive2DContainer& TextBreakupHelper::getResult(BreakupUnit 
aBreakupUnit) const
+Primitive2DContainer TextBreakupHelper::extractResult(BreakupUnit 
aBreakupUnit)
 {
 if(mxResult.empty())
 {
-const_cast< TextBreakupHelper* >(this)->breakup(aBreakupUnit);
+breakup(aBreakupUnit);
 }
 
-return mxResult;
+return std::move(mxResult);
 }
 
 } // end of namespace
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index 10cf07b4a8c0..25c5fd7b4ffa 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -155,13 +155,13 @@ namespace drawinglayer::primitive2d
 {
 // support for single word mode; split to single word 
primitives
 // using TextBreakupHelper
-const TextBreakupHelper aTextBreakupHelper(*this);
-const Primitive2DContainer& 
aBroken(aTextBreakupHelper.getResult(BreakupUnit::Word));
+TextBreakupHelper aTextBreakupHelper(*this);
+Primitive2DContainer 
aBroken(aTextBreakupHelper.extractResult(BreakupUnit::Word));
 
 if(!aBroken.empty())
 {
 // was indeed split to several words, use as result
-rContainer.insert(rContainer.end(), aBroken.begin(), 
aBroken.end());
+rContainer.append(std::move(aBroken));
 return;
 }
 else
diff --git a/include/drawinglayer/primitive2d/textbreakuphelper.hxx 
b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
index c007bb6afa1c..d7dbeabb3cd0 100644
--- a/include/drawinglayer/primitive2d/textbreakuphelper.hxx
+++ b/include/drawinglayer/primitive2d/textbreakuphelper.hxx
@@ -66,7 +66,7 @@ namespace drawinglayer::primitive2d
 virtual ~TextBreakupHelper();
 
 /// get result
-const Primitive2DContainer& getResult(BreakupUnit aBreakupUnit = 
BreakupUnit::Character) const;
+Primitive2DContainer extractResult(BreakupUnit aBreakupUnit = 
BreakupUnit::Character);
 };
 
 } // end of namespace drawinglayer::primitive2d
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 0aba14c0bbd7..bdd0c4f3471b 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -515,13 +515,12 @@ namespace svgio::svgreader
 
 if(pCandidate)
 {
-const localTextBreakupHelper 
alocalTextBreakupHelper(*pCandidate, rSvgTextPosition);
-const Primitive2DContainer& aResult(
-alocalTextBreakupHelper.getResult());
+localTextBreakupHelper 
alocalTextBreakupHelper(*pCandidate, rSvgTextPosition);
+Primitive2DContainer aResult = 
alocalTextBreakupHelper.extractResult();
 
 if(!aResult.empty())
 {
-rTarget.append(aResult);
+rTarget.append(std::move(aResult));
 }
 
 // also consume for the implied single space
diff --git a/svgio/source/svgreader/svgtextpathnode.cxx 
b/svgio/source/svgreader/svgtextpathnode.cxx
index 9b177383677f..129b2c280b88 100644
--- a/svgio/source/svgreader/svgtextpathnode.cxx
+++ b/svgio/source/svgreader/svgtextpathnode.cxx
@@ -412,19 +412,19 @@ namespace 

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

2022-05-29 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 42628f13f5228224d83b5a6ab949228e6926cf1b
Author: Noel Grandin 
AuthorDate: Sun May 29 11:29:45 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 29 12:53:18 2022 +0200

use std::vector in AnimatedGraphicPrimitive2D

instead of Primitive2DContainer, because I want to change
Primitive2DContainer into a different data structure that
does not support cheap random access

Change-Id: I1bc55f2e21d9d5c4529c87be57a46aee63e04589
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135087
Tested-by: Noel Grandin 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 9974117b5ae0..7f27fa782ff8 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -74,7 +74,7 @@ namespace drawinglayer::primitive2d
 Primitive2DReferencemaBufferedFirstFrame;
 
 /// buffering of all frames
-Primitive2DContainermaBufferedPrimitives;
+std::vector   maBufferedPrimitives;
 boolmbBufferingAllowed;
 
 /// set if the animation is huge so that just always the next frame
@@ -402,7 +402,7 @@ namespace drawinglayer::primitive2d
 // prepare buffer space
 if (mbBufferingAllowed && isValidData())
 {
-maBufferedPrimitives = 
Primitive2DContainer(maAnimation.Count());
+maBufferedPrimitives.resize(maAnimation.Count());
 }
 }
 


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

2022-05-29 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/Primitive2DContainer.cxx|   21 ++--
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx  |   10 ++---
 include/drawinglayer/primitive2d/Primitive2DContainer.hxx   |2 -
 include/drawinglayer/primitive2d/svggradientprimitive2d.hxx |4 +-
 4 files changed, 12 insertions(+), 25 deletions(-)

New commits:
commit 8ec7b04808b8aca32e2c38b8042af9b3c9bbe071
Author: Noel Grandin 
AuthorDate: Sun May 29 08:37:27 2022 +0200
Commit: Noel Grandin 
CommitDate: Sun May 29 11:22:16 2022 +0200

simplify and improve maybeInvert

(*) we can move the data rather than copying
(*) it should definitely not be const
(*) we can use STL functions to do most of the work

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

diff --git a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx 
b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
index 85ab03951996..48b0c625e1ba 100644
--- a/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
+++ b/drawinglayer/source/primitive2d/Primitive2DContainer.cxx
@@ -54,24 +54,11 @@ Primitive2DContainer::toSequence() const
 return aVal;
 }
 
-Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) const
+Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert)
 {
-const sal_uInt32 nSize(size());
-Primitive2DContainer aRetval;
-
-aRetval.resize(nSize);
-
-for (sal_uInt32 a(0); a < nSize; a++)
-{
-aRetval[bInvert ? nSize - 1 - a : a] = (*this)[a];
-}
-
-// all entries taken over to Uno References as owners. To avoid
-// errors with users of this mechanism to delete pointers to 
BasePrimitive2D
-// itself, clear given vector
-const_cast(*this).clear();
-
-return aRetval;
+if (bInvert)
+std::reverse(begin(), end());
+return std::move(*this);
 }
 
 // get B2DRange from a given Primitive2DSequence
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 5295cbedc37d..263ee8f4d387 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -306,13 +306,13 @@ namespace drawinglayer::primitive2d
 
 void SvgGradientHelper::createResult(
 Primitive2DContainer& rContainer,
-const Primitive2DContainer& rTargetColor,
-const Primitive2DContainer& rTargetOpacity,
+Primitive2DContainer aTargetColor,
+Primitive2DContainer aTargetOpacity,
 const basegfx::B2DHomMatrix& rUnitGradientToObject,
 bool bInvert) const
 {
-Primitive2DContainer 
aTargetColorEntries(rTargetColor.maybeInvert(bInvert));
-Primitive2DContainer 
aTargetOpacityEntries(rTargetOpacity.maybeInvert(bInvert));
+Primitive2DContainer 
aTargetColorEntries(aTargetColor.maybeInvert(bInvert));
+Primitive2DContainer 
aTargetOpacityEntries(aTargetOpacity.maybeInvert(bInvert));
 
 if(aTargetColorEntries.empty())
 return;
@@ -781,7 +781,7 @@ namespace drawinglayer::primitive2d
 fMax);
 }
 
-createResult(rContainer, aTargetColor, aTargetOpacity, 
aUnitGradientToObject, true);
+createResult(rContainer, std::move(aTargetColor), 
std::move(aTargetOpacity), aUnitGradientToObject, true);
 }
 }
 
diff --git a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx 
b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
index 6c1dc196ca06..2368ea45ceef 100644
--- a/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
+++ b/include/drawinglayer/primitive2d/Primitive2DContainer.hxx
@@ -86,7 +86,7 @@ public:
 bool operator==(const Primitive2DContainer& rB) const;
 bool operator!=(const Primitive2DContainer& rB) const { return 
!operator==(rB); }
 basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& 
aViewInformation) const;
-Primitive2DContainer maybeInvert(bool bInvert = false) const;
+Primitive2DContainer maybeInvert(bool bInvert = false);
 
 css::uno::Sequence> 
toSequence() const;
 };
diff --git a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx 
b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
index 78667f2d06e3..66c68fdaf3bf 100644
--- a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
@@ -134,8 +134,8 @@ namespace drawinglayer::primitive2d
 virtual void checkPreconditions();
 void createResult(
 Primitive2DContainer& rContainer,
-const Primitive2DContainer& rTargetColor,
-const Primitive2DContainer& 

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

2022-05-16 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |2 
 drawinglayer/source/tools/emfppen.cxx|  100 ---
 drawinglayer/source/tools/emfppen.hxx|3 
 3 files changed, 33 insertions(+), 72 deletions(-)

New commits:
commit 3d077ff9327ba591cbe2c663b0e93706857b6133
Author: Bartosz Kosiorek 
AuthorDate: Wed May 11 18:04:48 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon May 16 17:27:24 2022 +0200

EMF+ Simplify and optimize the code

Change-Id: Iae7e83253cfe7c0545d2381d83a2e69cb4b80e5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134376
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 231e86e7c767..d76e8f358c9d 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -597,7 +597,7 @@ namespace emfplushelper
 
 const double transformedPenWidth = mdExtractedYScale * pen->penWidth;
 drawinglayer::attribute::LineAttribute lineAttribute(
-pen->GetColor().getBColor(), transformedPenWidth, 
pen->GetLineJoinType(),
+pen->GetColor().getBColor(), transformedPenWidth, pen->maLineJoin,
 css::drawing::LineCap_BUTT, //TODO implement PenDataDashedLineCap 
support here
 pen->fMiterMinimumAngle);
 
diff --git a/drawinglayer/source/tools/emfppen.cxx 
b/drawinglayer/source/tools/emfppen.cxx
index ec073d56ea59..adfee3bd3706 100644
--- a/drawinglayer/source/tools/emfppen.cxx
+++ b/drawinglayer/source/tools/emfppen.cxx
@@ -30,26 +30,6 @@ using namespace ::basegfx;
 
 namespace emfplushelper
 {
-namespace {
-
-enum EmfPlusPenData
-{
-PenDataTransform= 0x0001,
-PenDataStartCap = 0x0002,
-PenDataEndCap   = 0x0004,
-PenDataJoin = 0x0008,
-PenDataMiterLimit   = 0x0010,
-PenDataLineStyle= 0x0020,
-PenDataDashedLineCap= 0x0040,
-PenDataDashedLineOffset = 0x0080,
-PenDataDashedLine   = 0x0100,
-PenDataAlignment= 0x0200,
-PenDataCompoundLine = 0x0400,
-PenDataCustomStartCap   = 0x0800,
-PenDataCustomEndCap = 0x1000
-};
-
-}
 
 EMFPPen::EMFPPen()
 : penDataFlags(0)
@@ -57,7 +37,7 @@ namespace emfplushelper
 , penWidth(0.0)
 , startCap(0)
 , endCap(0)
-, lineJoin(0)
+, maLineJoin(basegfx::B2DLineJoin::Miter)
 , fMiterMinimumAngle(basegfx::deg2rad(5.0))
 , dashStyle(0)
 , dashCap(0)
@@ -137,18 +117,6 @@ namespace emfplushelper
 return "";
 }
 
-static OUString LineJoinTypeToString(sal_uInt32 jointype)
-{
-switch (jointype)
-{
-case LineJoinTypeMiter: return "LineJoinTypeMiter";
-case LineJoinTypeBevel: return "LineJoinTypeBevel";
-case LineJoinTypeRound: return "LineJoinTypeRound";
-case LineJoinTypeMiterClipped: return "LineJoinTypeMiterClipped";
-}
-return "";
-}
-
 static OUString DashedLineCapTypeToString(sal_uInt32 dashedlinecaptype)
 {
 switch (dashedlinecaptype)
@@ -173,25 +141,6 @@ namespace emfplushelper
 return "";
 }
 
-basegfx::B2DLineJoin EMFPPen::GetLineJoinType() const
-{
-if (penDataFlags & EmfPlusPenDataJoin) // additional line join 
information
-{
-switch (lineJoin)
-{
-case EmfPlusLineJoinTypeMiter: // fall-through
-case EmfPlusLineJoinTypeMiterClipped:
-return basegfx::B2DLineJoin::Miter;
-case EmfPlusLineJoinTypeBevel:
-return basegfx::B2DLineJoin::Bevel;
-case EmfPlusLineJoinTypeRound:
-return basegfx::B2DLineJoin::Round;
-}
-}
-// If nothing set, then miter applied with no limit
-return basegfx::B2DLineJoin::Miter;
-}
-
 drawinglayer::attribute::StrokeAttribute
 EMFPPen::GetStrokeAttribute(const double aTransformation) const
 {
@@ -233,6 +182,7 @@ namespace emfplushelper
 
 void EMFPPen::Read(SvStream& s, EmfPlusHelperData const & rR)
 {
+sal_Int32 lineJoin = EmfPlusLineJoinTypeMiter;
 sal_uInt32 graphicsVersion, penType;
 
s.ReadUInt32(graphicsVersion).ReadUInt32(penType).ReadUInt32(penDataFlags).ReadUInt32(penUnit).ReadFloat(penWidth);
 SAL_INFO("drawinglayer.emf", "EMF+\t\tGraphics version: 0x" << 
std::hex << graphicsVersion);
@@ -248,13 +198,13 @@ namespace emfplushelper
 : 0.05f;  // 0.05f is taken from old EMF+ implementation (case 
of Unit == Pixel etc.)
 }
 
-if (penDataFlags & PenDataTransform)
+if (penDataFlags & EmfPlusPenDataTransform)
 {

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

2022-05-16 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |   64 +++
 drawinglayer/source/tools/emfphelperdata.hxx |4 
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |   48 +++
 emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emf |binary
 4 files changed, 98 insertions(+), 18 deletions(-)

New commits:
commit 2156c1090d318b4d28bc14537754bea73507d501
Author: Bartosz Kosiorek 
AuthorDate: Sun May 15 00:09:44 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon May 16 17:26:20 2022 +0200

tdf#143876 EMF+ Add DrawClosedCurve and FillClosedCurve support

With this commit EmfPlusDrawClosedCurve and EmfPlusFillClosedCurve
support was added. There is still missing Filling Mode (it
is always set to Even Odd Alternate:
https://en.wikipedia.org/wiki/Even%E2%80%93odd_rule )
and Tension support for spline bends.
The graphics is displayed as Tension=0.
A value of Tension=0 specifies that the spline is a sequence of straight 
lines.
As the value increases, the curve becomes more rounded.
For more information, see [SPLINE77] and [PETZOLD].

Change-Id: Ibccfd584e3d55cd0ca8a29da9f450916d56705d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134333
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 0734dad6d6ea..231e86e7c767 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -80,6 +80,7 @@ namespace emfplushelper
 case EmfPlusRecordTypeDrawRects: return 
"EmfPlusRecordTypeDrawRects";
 case EmfPlusRecordTypeFillPolygon: return 
"EmfPlusRecordTypeFillPolygon";
 case EmfPlusRecordTypeDrawLines: return 
"EmfPlusRecordTypeDrawLines";
+case EmfPlusRecordTypeFillClosedCurve: return 
"EmfPlusRecordTypeFillClosedCurve";
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
@@ -89,6 +90,7 @@ namespace emfplushelper
 case EmfPlusRecordTypeFillPath: return "EmfPlusRecordTypeFillPath";
 case EmfPlusRecordTypeDrawPath: return "EmfPlusRecordTypeDrawPath";
 case EmfPlusRecordTypeDrawBeziers: return 
"EmfPlusRecordTypeDrawBeziers";
+case EmfPlusRecordTypeDrawClosedCurve: return 
"EmfPlusRecordTypeDrawClosedCurve";
 case EmfPlusRecordTypeDrawImage: return 
"EmfPlusRecordTypeDrawImage";
 case EmfPlusRecordTypeDrawImagePoints: return 
"EmfPlusRecordTypeDrawImagePoints";
 case EmfPlusRecordTypeDrawString: return 
"EmfPlusRecordTypeDrawString";
@@ -610,8 +612,11 @@ namespace emfplushelper
 if (pen->GetColor().IsTransparent())
 {
 drawinglayer::primitive2d::Primitive2DContainer aContainer;
-if ((pen->penDataFlags & EmfPlusPenDataStartCap)
-|| (pen->penDataFlags & EmfPlusPenDataEndCap))
+if (aStart.isDefault() && aEnd.isDefault())
+
aContainer.append(drawinglayer::primitive2d::Primitive2DReference(
+new 
drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
+polygon, lineAttribute, 
pen->GetStrokeAttribute(mdExtractedXScale;
+else
 {
 aContainer.resize(polygon.count());
 for (sal_uInt32 i = 0; i < polygon.count(); i++)
@@ -620,18 +625,17 @@ namespace emfplushelper
 polygon.getB2DPolygon(i), lineAttribute,
 pen->GetStrokeAttribute(mdExtractedXScale), 
aStart, aEnd));
 }
-else
-
aContainer.append(drawinglayer::primitive2d::Primitive2DReference(
-new 
drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
-polygon, lineAttribute, 
pen->GetStrokeAttribute(mdExtractedXScale;
 mrTargetHolders.Current().append(
 new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
 std::move(aContainer), (255 - pen->GetColor().GetAlpha()) 
/ 255.0));
 }
 else
 {
-if ((pen->penDataFlags & EmfPlusPenDataStartCap)
-|| (pen->penDataFlags & EmfPlusPenDataEndCap))
+if (aStart.isDefault() && aEnd.isDefault())
+mrTargetHolders.Current().append(
+new 
drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
+polygon, lineAttribute, 
pen->GetStrokeAttribute(mdExtractedXScale)));
+else
 for (sal_uInt32 i = 0; i < polygon.count(); i++)
 {
 mrTargetHolders.Current().append(
@@ -639,10 

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

2022-05-14 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0d028269b67aaa1cc36473a4c9f5fc3c01499d3e
Author: Andrea Gelmini 
AuthorDate: Sat May 14 16:30:37 2022 +0200
Commit: Julien Nabet 
CommitDate: Sat May 14 18:14:41 2022 +0200

Fix typo

Change-Id: Ib0913aef00cd252d3f082ec5e8b39064df63a7fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134319
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 4d0db58c026b..0734dad6d6ea 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -596,7 +596,7 @@ namespace emfplushelper
 const double transformedPenWidth = mdExtractedYScale * pen->penWidth;
 drawinglayer::attribute::LineAttribute lineAttribute(
 pen->GetColor().getBColor(), transformedPenWidth, 
pen->GetLineJoinType(),
-css::drawing::LineCap_BUTT, //TODO implement PenDataDashedLineCap 
supportr here
+css::drawing::LineCap_BUTT, //TODO implement PenDataDashedLineCap 
support here
 pen->fMiterMinimumAngle);
 
 drawinglayer::attribute::LineStartEndAttribute aStart;


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

2022-05-13 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx|4 
 drawinglayer/source/tools/emfppen.cxx   |   23 +++-
 drawinglayer/source/tools/emfppen.hxx   |2 
 drawinglayer/source/tools/primitive2dxmldump.cxx|5 +
 emfio/qa/cppunit/emf/EmfImportTest.cxx  |   50 
++
 emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithMiterLimit.emf |binary
 6 files changed, 76 insertions(+), 8 deletions(-)

New commits:
commit e709ebe42ad06974b822366e4eea1a6c2ee61e10
Author: Bartosz Kosiorek 
AuthorDate: Wed May 11 12:54:48 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Fri May 13 13:49:18 2022 +0200

tdf#142261 EMF+ Add support for Miter Limit

With this commit the Miter is properly implemented,
according to [EMF-PLUS] documentation:

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-emfplus/5ef071f3-f503-4f16-b027-7c4bcf2d1d81

The formula for stroke miter limit is described here:
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit

Change-Id: Ida87063cc045460e61ffae118f64cf133c810dbf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134164
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index c5b282998d71..4d0db58c026b 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -596,8 +596,8 @@ namespace emfplushelper
 const double transformedPenWidth = mdExtractedYScale * pen->penWidth;
 drawinglayer::attribute::LineAttribute lineAttribute(
 pen->GetColor().getBColor(), transformedPenWidth, 
pen->GetLineJoinType(),
-css::drawing::LineCap_BUTT,
-basegfx::deg2rad(15.0)); // TODO Add MiterLimit support
+css::drawing::LineCap_BUTT, //TODO implement PenDataDashedLineCap 
supportr here
+pen->fMiterMinimumAngle);
 
 drawinglayer::attribute::LineStartEndAttribute aStart;
 if (pen->penDataFlags & EmfPlusPenDataStartCap)
diff --git a/drawinglayer/source/tools/emfppen.cxx 
b/drawinglayer/source/tools/emfppen.cxx
index b0408f8d0e80..ec073d56ea59 100644
--- a/drawinglayer/source/tools/emfppen.cxx
+++ b/drawinglayer/source/tools/emfppen.cxx
@@ -58,7 +58,7 @@ namespace emfplushelper
 , startCap(0)
 , endCap(0)
 , lineJoin(0)
-, miterLimit(0.0)
+, fMiterMinimumAngle(basegfx::deg2rad(5.0))
 , dashStyle(0)
 , dashCap(0)
 , dashOffset(0.0)
@@ -286,13 +286,26 @@ namespace emfplushelper
 
 if (penDataFlags & PenDataMiterLimit)
 {
+float miterLimit;
 s.ReadFloat(miterLimit);
-SAL_WARN("drawinglayer.emf", "EMF+\t\tTODO PenDataMiterLimit: " << 
std::dec << miterLimit);
+
+// EMF+ JoinTypeMiterClipped is working as our B2DLineJoin::Miter
+// For EMF+ LineJoinTypeMiter we are simulating it by changing 
angle
+if (lineJoin == EmfPlusLineJoinTypeMiter)
+miterLimit = 3.0 * miterLimit;
+// asin angle must be in range [-1, 1]
+if (abs(miterLimit) > 1.0)
+fMiterMinimumAngle = 2.0 * asin(1.0 / miterLimit);
+else
+// enable miter limit for all angles
+fMiterMinimumAngle = basegfx::deg2rad(180.0);
+SAL_INFO("drawinglayer.emf",
+ "EMF+\t\t MiterLimit: " << std::dec << miterLimit
+ << ", Miter minimum angle (rad): 
" << fMiterMinimumAngle);
 }
 else
-{
-miterLimit = 0;
-}
+fMiterMinimumAngle = basegfx::deg2rad(5.0);
+
 
 if (penDataFlags & PenDataLineStyle)
 {
diff --git a/drawinglayer/source/tools/emfppen.hxx 
b/drawinglayer/source/tools/emfppen.hxx
index cad849e4f278..6a7929f332f8 100644
--- a/drawinglayer/source/tools/emfppen.hxx
+++ b/drawinglayer/source/tools/emfppen.hxx
@@ -105,7 +105,7 @@ namespace emfplushelper
 sal_Int32 startCap;
 sal_Int32 endCap;
 sal_Int32 lineJoin;
-float miterLimit;
+double fMiterMinimumAngle;
 sal_Int32 dashStyle;
 sal_Int32 dashCap;
 float dashOffset;
diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 886ffbf7fdd3..4e35d599876f 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -167,8 +167,12 @@ void writeLineAttribute(::tools::XmlWriter& rWriter,
 rWriter.attribute("linejoin", "Bevel");
 break;
 case basegfx::B2DLineJoin::Miter:
+{
 rWriter.attribute("linejoin", "Miter");
+rWriter.attribute("miterangle",
+  

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

2022-05-09 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx  |  144 ++
 drawinglayer/source/tools/emfphelperdata.hxx  |4 
 drawinglayer/source/tools/emfppen.cxx |   17 -
 drawinglayer/source/tools/emfppen.hxx |1 
 drawinglayer/source/tools/primitive2dxmldump.cxx  |   44 
 emfio/qa/cppunit/emf/EmfImportTest.cxx|  116 +--
 emfio/qa/cppunit/emf/data/TestDrawLine.emf|binary
 emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithCaps.emf |binary
 8 files changed, 260 insertions(+), 66 deletions(-)

New commits:
commit 1440ab87386bb5d1ad3634082577bf27f279e066
Author: Bartosz Kosiorek 
AuthorDate: Sun Apr 24 02:29:59 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon May 9 20:50:37 2022 +0200

tdf#143875 tdf#55058 EMF+ Add support for individual line endings

EMF+ is allowing different caps and arrows on both ends
It is not possible to implement that with css::drawing::LineCap,
as it is set line endings on both line start and line end.
Additionally when the Dash Pattern is used, the css::drawing::LineCap
is also applied there.

To resolve that limitation, the Cap needs to be implemented
independetly by using PolygonStrokeArrowPrimitive2D, and
the css::drawing::LineCap inside drawinglayer::attribute::LineAttribute
always set to css::drawing::LineCap_BUTT

Change-Id: I4be76e2dbefcb34154a1404c3b57dc4b7f7ada85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133299
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index c405a4c4876b..c5b282998d71 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -29,6 +29,7 @@
 #include "emfpstringformat.hxx"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -519,7 +520,72 @@ namespace emfplushelper
 }
 }
 
-void EmfPlusHelperData::EMFPPlusDrawPolygon(const 
::basegfx::B2DPolyPolygon& polygon, sal_uInt32 penIndex)
+drawinglayer::attribute::LineStartEndAttribute
+EmfPlusHelperData::CreateLineEnd(const sal_Int32 aCap, const float 
aPenWidth) const
+{
+const double pw = mdExtractedYScale * aPenWidth;
+if (aCap == LineCapTypeSquare)
+{
+basegfx::B2DPolygon aCapPolygon(
+{ {-1.0, -1.0}, {1.0, -1.0}, {1.0, 1.0}, {-1.0, 1.0} });
+aCapPolygon.setClosed(true);
+return drawinglayer::attribute::LineStartEndAttribute(
+pw, basegfx::B2DPolyPolygon(aCapPolygon), true);
+}
+else if (aCap == LineCapTypeRound)
+{
+basegfx::B2DPolygon aCapPolygon(
+{ {-1.0, 1.0}, {1.0, 1.0}, {1.0, 0.0}, {0.9236, -0.3827},
+  {0.7071, -0.7071}, {0.3827, -0.9236}, {0.0, -1.0}, {-0.3827, 
-0.9236},
+  {-0.7071, -0.7071}, {-0.9236, -0.3827}, {-1.0, 0.0} });
+aCapPolygon.setClosed(true);
+return drawinglayer::attribute::LineStartEndAttribute(
+pw, basegfx::B2DPolyPolygon(aCapPolygon), true);
+}
+else if (aCap == LineCapTypeTriangle)
+{
+basegfx::B2DPolygon aCapPolygon(
+{ {-1.0, 1.0}, {1.0, 1.0}, {1.0, 0.0}, {0.0, -1.0}, {-1.0, 
0.0} });
+aCapPolygon.setClosed(true);
+return drawinglayer::attribute::LineStartEndAttribute(
+pw, basegfx::B2DPolyPolygon(aCapPolygon), true);
+}
+else if (aCap == LineCapTypeSquareAnchor)
+{
+basegfx::B2DPolygon aCapPolygon(
+{ {-1.0, -1.0}, {1.0, -1.0}, {1.0, 1.0}, {-1.0, 1.0} });
+aCapPolygon.setClosed(true);
+return drawinglayer::attribute::LineStartEndAttribute(
+1.5 * pw, basegfx::B2DPolyPolygon(aCapPolygon), true);
+}
+else if (aCap == LineCapTypeRoundAnchor)
+{
+const basegfx::B2DPolygon aCapPolygon
+= 
::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 1.0, 
1.0);
+return drawinglayer::attribute::LineStartEndAttribute(
+2.0 * pw, basegfx::B2DPolyPolygon(aCapPolygon), true);
+}
+else if (aCap == LineCapTypeDiamondAnchor)
+{
+basegfx::B2DPolygon aCapPolygon({ {0.0, -1.0}, {1.0, 0.0}, {0.5, 
0.5},
+  {0.5, 1.0}, {-0.5, 1.0}, {-0.5, 
0.5},
+  {-1.0, 0.0} });
+aCapPolygon.setClosed(true);
+return drawinglayer::attribute::LineStartEndAttribute(
+2.0 * pw, basegfx::B2DPolyPolygon(aCapPolygon), true);
+}
+else if (aCap == LineCapTypeArrowAnchor)
+{
+basegfx::B2DPolygon aCapPolygon({ {0.0, 

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

2022-05-09 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/wmfemfhelper.cxx |   11 -
 emfio/inc/mtftools.hxx |   79 +++-
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   19 +++
 emfio/qa/cppunit/wmf/data/TestLineTo.wmf   |binary
 emfio/source/reader/emfreader.cxx  |  180 ++---
 emfio/source/reader/wmfreader.cxx  |   65 --
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   12 -
 7 files changed, 120 insertions(+), 246 deletions(-)

New commits:
commit 32cb4e4fe55e662d2e515e9a6facabffe3684754
Author: Bartosz Kosiorek 
AuthorDate: Fri Apr 29 13:36:10 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon May 9 11:08:25 2022 +0200

tdf#89331 EMF/WMF Fix holes in lines created with LINETO

If the lines are created with MOVETO, LINETO, LINETO...
then Line Join NONE is applied. As a result the charts are looks ugly,
with the holes inside it.
For example:
https://bugs.documentfoundation.org/attachment.cgi?id=179962
and
https://bugs.documentfoundation.org/attachment.cgi?id=179837

Additinally commit changed default line join style to miter,
as during experimenting with MS Paint and MS Word,
it appear that default Join Style is PS_JOIN_MITER and
Line Cap is Flat/Butter.

The PDF export tests has been updated, as there is less number
of PDF object after using joiners.
The size of the exported tdf145873.pptx to PDF,
was slighltly decreased from 22.8kB to 22.0KB

Change-Id: I131cc3c5e90f827d67d2360eb18167eed6315abb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133624
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx 
b/drawinglayer/source/tools/wmfemfhelper.cxx
index 592e67bab9a5..1f5b8a10fcf2 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -1548,7 +1548,6 @@ namespace wmfemfhelper
 }
 else
 {
-
aLineInfo.SetLineJoin(basegfx::B2DLineJoin::NONE); // It were lines; force to 
NONE
 createLinePrimitive(aLinePolygon, 
aLineInfo, rTargetHolders.Current(), rPropertyHolders.Current());
 aLinePolygon.clear();
 aLineInfo = pA->GetLineInfo();
@@ -1563,16 +1562,14 @@ namespace wmfemfhelper
 aLinePolygon.append(aEnd);
 }
 
-nAction++; if(nAction < nCount) pAction = 
rMetaFile.GetAction(nAction);
+nAction++;
+if (nAction < nCount)
+pAction = rMetaFile.GetAction(nAction);
 }
 
 nAction--;
-
-if(aLinePolygon.count())
-{
-aLineInfo.SetLineJoin(basegfx::B2DLineJoin::NONE); 
// It were lines; force to NONE
+if (aLinePolygon.count())
 createLinePrimitive(aLinePolygon, aLineInfo, 
rTargetHolders.Current(), rPropertyHolders.Current());
-}
 }
 
 break;
diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 0290c487c574..997f2287f010 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -204,8 +204,6 @@ namespace emfio
 enum PenStyle : sal_uInt32
 {
 PS_COSMETIC  = 0x,
-PS_ENDCAP_ROUND  = 0x,
-PS_JOIN_ROUND= 0x,
 PS_SOLID = 0x,
 PS_DASH  = 0x0001,
 PS_DOT   = 0x0002,
@@ -216,12 +214,17 @@ namespace emfio
 PS_USERSTYLE = 0x0007,
 PS_ALTERNATE = 0x0008,
 PS_STYLE_MASK= 0x000F,
+
+PS_ENDCAP_ROUND  = 0x,
 PS_ENDCAP_SQUARE = 0x0100,
 PS_ENDCAP_FLAT   = 0x0200,
 PS_ENDCAP_STYLE_MASK = 0x0F00,
+
+PS_JOIN_ROUND= 0x,
 PS_JOIN_BEVEL= 0x1000,
 PS_JOIN_MITER= 0x2000,
 PS_JOIN_STYLE_MASK   = 0xF000,
+
 PS_GEOMETRIC = 0x0001
 };
 
@@ -461,11 +464,75 @@ namespace emfio
 , bTransparent(bTrans)
 {}
 
-WinMtfLineStyle(const Color& rColor, const LineInfo& rStyle, bool 
bTrans)
+WinMtfLineStyle(const Color& rColor, const sal_uInt32 nStyle, const 
sal_Int32 nPenWidth)
 : aLineColor(rColor)
-, aLineInfo(rStyle)
-, bTransparent(bTrans)
-{}
+{
+// According to documentation: nStyle = PS_COSMETIC = 0x0 - line 
with a width of one logical unit and a style that is a solid 

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

2022-05-07 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit a93220b79faad8d679f3c67ccd967cdfac68d49f
Author: Noel Grandin 
AuthorDate: Sat May 7 09:18:27 2022 +0200
Commit: Noel Grandin 
CommitDate: Sat May 7 14:21:58 2022 +0200

osl::Mutex->std::mutex in VDevBuffer

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

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 24e0c6a30bcb..c19dd965755a 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -30,16 +30,16 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 
 // buffered VDev usage
 
 namespace
 {
-class VDevBuffer : public Timer, protected cppu::BaseMutex
+class VDevBuffer : public Timer
 {
 private:
 struct Entry
@@ -53,6 +53,8 @@ private:
 }
 };
 
+std::mutex m_aMutex;
+
 // available buffers
 std::vector maFreeBuffers;
 
@@ -85,7 +87,7 @@ VDevBuffer::VDevBuffer()
 
 VDevBuffer::~VDevBuffer()
 {
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 Stop();
 
 while (!maFreeBuffers.empty())
@@ -132,7 +134,7 @@ bool VDevBuffer::isSizeSuitable(const 
VclPtr& device, const Size&
 VclPtr VDevBuffer::alloc(OutputDevice& rOutDev, const Size& 
rSizePixel,
 bool bTransparent)
 {
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 VclPtr pRetval;
 
 sal_Int32 nBits = rOutDev.GetBitCount();
@@ -248,7 +250,7 @@ VclPtr VDevBuffer::alloc(OutputDevice& 
rOutDev, const Size& rSize
 
 void VDevBuffer::free(VirtualDevice& rDevice)
 {
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 const auto aUsedFound
 = std::find_if(maUsedBuffers.begin(), maUsedBuffers.end(),
[](const Entry& el) { return el.buf == 
 });
@@ -266,7 +268,7 @@ void VDevBuffer::free(VirtualDevice& rDevice)
 
 void VDevBuffer::Invoke()
 {
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 
 while (!maFreeBuffers.empty())
 {


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

2022-04-24 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfpbrush.cxx  |   71 +++
 drawinglayer/source/tools/emfpbrush.hxx  |6 +-
 drawinglayer/source/tools/emfphelperdata.cxx |4 -
 drawinglayer/source/tools/emfppen.cxx|   27 +++---
 drawinglayer/source/tools/emfppen.hxx|4 -
 5 files changed, 35 insertions(+), 77 deletions(-)

New commits:
commit 8202df1815ed692df371e6d07a3b0f29a329f6ed
Author: Bartosz Kosiorek 
AuthorDate: Fri Apr 22 18:26:49 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Sun Apr 24 13:01:05 2022 +0200

tdf#103859 EMF+ Use variable types according to EMFPLUS documentation

With this commit, the types of variable for Brush and Pen
were aligned to documentation:
[MS-EMFPLUS] - Enhanced Metafile Format Plus Extensions

As a side effect the code was simplified a bit

Change-Id: Ibabad628d0aaef510f61ee8b3d881c3f024cebef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133327
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfpbrush.cxx 
b/drawinglayer/source/tools/emfpbrush.cxx
index 4acc311345a8..7d6204a5da9e 100644
--- a/drawinglayer/source/tools/emfpbrush.cxx
+++ b/drawinglayer/source/tools/emfpbrush.cxx
@@ -113,17 +113,12 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tCenter color: 0x" << 
std::hex << color << std::dec);
 s.ReadFloat(firstPointX).ReadFloat(firstPointY);
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tCenter point: " << 
firstPointX << "," << firstPointY);
-s.ReadInt32(surroundColorsNumber);
+s.ReadUInt32(surroundColorsNumber);
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\t number of surround 
colors: " << surroundColorsNumber);
 
-if (surroundColorsNumber<0 || 
o3tl::make_unsigned(surroundColorsNumber)>SAL_MAX_INT32 / sizeof(::Color))
-{
-surroundColorsNumber = SAL_MAX_INT32 / sizeof(::Color);
-}
-
 surroundColors.reset( new ::Color[surroundColorsNumber] );
 
-for (int i = 0; i < surroundColorsNumber; i++)
+for (sal_uInt32 i = 0; i < surroundColorsNumber; i++)
 {
 s.ReadUInt32(color);
 surroundColors[i] = ::Color(ColorAlpha, (color >> 24), 
(color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
@@ -132,7 +127,7 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tSurround color[" 
<< i << "]: 0x" << std::hex << color << std::dec);
 }
 
-if (additionalFlags & 0x01)
+if (additionalFlags & 0x01) // BrushDataPath
 {
 sal_Int32 pathLength;
 
@@ -180,60 +175,47 @@ namespace emfplushelper
  
<< aBounds.getWidth() << "x" << aBounds.getHeight());
 }
 
-if (additionalFlags & 0x02)
+if (additionalFlags & 0x02) // BrushDataTransform
 {
 EmfPlusHelperData::readXForm(s, brush_transformation);
 hasTransformation = true;
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tUse brush 
transformation: " << brush_transformation);
 }
 
-if (additionalFlags & 0x08)
+if (additionalFlags & 0x08) // BrushDataBlendFactorsH
 {
-s.ReadInt32(blendPoints);
+s.ReadUInt32(blendPoints);
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tuse blend, 
points: " << blendPoints);
-if (blendPoints<0 || 
o3tl::make_unsigned(blendPoints)>SAL_MAX_INT32 / (2 * sizeof(float)))
-blendPoints = SAL_MAX_INT32 / (2 * sizeof(float));
 blendPositions.reset( new float[2 * blendPoints] );
 blendFactors = blendPositions.get() + blendPoints;
 
-for (int i = 0; i < blendPoints; i++)
+for (sal_uInt32 i = 0; i < blendPoints; i++)
 {
 s.ReadFloat(blendPositions[i]);
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tposition[" 
<< i << "]: " << blendPositions[i]);
 }
 
-for (int i = 0; i < blendPoints; i++)
+for (sal_uInt32 i = 0; i < blendPoints; i++)
 {
 s.ReadFloat(blendFactors[i]);
 SAL_INFO("drawinglayer.emf", "EMF+\t\t\t\tFactor[" << 
i << "]: " << blendFactors[i]);
 }
 }
 
-if (additionalFlags & 0x04)
+if (additionalFlags & 0x04) // BrushDataPresetColors
 {
-

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

2022-04-22 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx  |   10 ++-
 drawinglayer/source/tools/emfphelperdata.hxx  |5 +
 drawinglayer/source/tools/primitive2dxmldump.cxx  |2 
 emfio/qa/cppunit/emf/EmfImportTest.cxx|   46 --
 emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf |binary
 5 files changed, 40 insertions(+), 23 deletions(-)

New commits:
commit abe3a06c45c0803a5c8bcf16e0e586fd72781c93
Author: Bartosz Kosiorek 
AuthorDate: Fri Apr 22 16:46:39 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Fri Apr 22 18:23:21 2022 +0200

tdf#55058 tdf#143875 EMF+ Don't change line weight while rotating

Previously when TranfromationMatrix was used with rotation,
the line weight and dashed line shapes were changed.
In worst case if angle was larger than 90 degrees,
the lines just disappear.

This patch fixes that. The line looks exactly after rotation
(with TranfromationMatrix).

The tests were updated (added some additional rotation),
to prove that now it is working correctly.

Change-Id: Ic2382fa8d1b711a6bf06c94b2d0b9da9e7d396f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133329
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 84d848ed2c1a..a7f809373e09 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -442,6 +442,10 @@ namespace emfplushelper
 maMapTransform *= 
basegfx::utils::createScaleTranslateB2DHomMatrix(100.0 * mnMmX / mnPixX, 100.0 
* mnMmY / mnPixY,

double(-mnFrameLeft), double(-mnFrameTop));
 maMapTransform *= maBaseTransform;
+
+// Used only for performance optimization, to do not calculate it 
every line draw
+mdExtractedXScale = std::hypot(maMapTransform.a(), maMapTransform.b());
+mdExtractedYScale = std::hypot(maMapTransform.c(), maMapTransform.d());
 }
 
 ::basegfx::B2DPoint EmfPlusHelperData::Map(double ix, double iy) const
@@ -531,7 +535,7 @@ namespace emfplushelper
 SAL_WARN_IF(pen->startCap != pen->endCap, "drawinglayer.emf", 
"emf+ pen uses different start and end cap");
 }
 
-const double transformedPenWidth = maMapTransform.get(0, 0) * 
pen->penWidth;
+const double transformedPenWidth = mdExtractedYScale * pen->penWidth;
 drawinglayer::attribute::LineAttribute 
lineAttribute(pen->GetColor().getBColor(),
  
transformedPenWidth,
  
pen->GetLineJoinType(),
@@ -543,7 +547,7 @@ namespace emfplushelper
 new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
 polygon,
 lineAttribute,
-pen->GetStrokeAttribute(maMapTransform.get(1, 1;
+pen->GetStrokeAttribute(mdExtractedXScale)));
 }
 else
 {
@@ -551,7 +555,7 @@ namespace emfplushelper
 new 
drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
 polygon,
 lineAttribute,
-pen->GetStrokeAttribute(maMapTransform.get(1, 
1;
+pen->GetStrokeAttribute(mdExtractedXScale)));
 
 mrTargetHolders.Current().append(
 new 
drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(
diff --git a/drawinglayer/source/tools/emfphelperdata.hxx 
b/drawinglayer/source/tools/emfphelperdata.hxx
index 563f7773c3ba..600f666145af 100644
--- a/drawinglayer/source/tools/emfphelperdata.hxx
+++ b/drawinglayer/source/tools/emfphelperdata.hxx
@@ -210,6 +210,11 @@ namespace emfplushelper
 GraphicStateMap mGSStack;
 GraphicStateMap mGSContainerStack;
 
+/* Performance optimizators */
+/* Extracted Scale values from Transformation Matrix */
+double mdExtractedXScale;
+double mdExtractedYScale;
+
 /// data holders
 wmfemfhelper::TargetHolders&mrTargetHolders;
 wmfemfhelper::PropertyHolders&  mrPropertyHolders;
diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 61264496ff98..3074ad30690a 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -143,7 +143,7 @@ void writeStrokeAttribute(::tools::XmlWriter& rWriter,
 OUString sDotDash;
 for (double fDotDash : rStrokeAttribute.getDotDashArray())
 {
-sDotDash += OUString::number(round(100.0 * fDotDash)) + " ";
+sDotDash += 

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

2022-04-01 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx   |  180 -
 drawinglayer/source/tools/emfphelperdata.hxx   |3 
 emfio/qa/cppunit/emf/EmfImportTest.cxx |   66 +
 emfio/qa/cppunit/emf/data/TestEmfPlusGetDC.emf |binary
 emfio/qa/cppunit/emf/data/TestEmfPlusSave.emf  |binary
 5 files changed, 184 insertions(+), 65 deletions(-)

New commits:
commit f26ba7f7c951164cc8677e55fa73081e16659147
Author: Bartosz Kosiorek 
AuthorDate: Fri Apr 1 11:43:30 2022 +0200
Commit: Bartosz Kosiorek 
CommitDate: Fri Apr 1 17:24:07 2022 +0200

tdf#147818 EMF+ Fix restoring clipping states

With previous implementation the clipping restoring with 
EmfPlusRecordTypeRestore
was implemented wrongly as it is only taken to account
the shape of clipping (state.getClipPolyPolygon) and doesn't
take if clipping was even enabled (state.getClipPolyPolygonActive).

Additionally the changing states should be made by using method:
wmfemfhelper::HandleNewClipRegion() and not directly.

The similar implementation was applied also to EmfPlusRecordTypeGetDC.

Additionally the clipping for
   EmfPlusRecordTypeSetClipRect
   EmfPlusRecordTypeSetClipPath
   EmfPlusRecordTypeSetClipRegion
was fixed, as initially the clipping is disabled 
(state.getClipPolyPolygonActive)
and the clipping shape is empty (state.getClipPolyPolygon).
It means that combination other than EmfPlusCombineModeReplace,
was not working correctly.

With this implementation, if Clipping is disabled, then treat clip combining
in special way.

Change-Id: I258bda64e8bfdade7f47ffc7518bf04b7340344f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132415
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 447686167837..e60f8815ef79 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -486,18 +486,32 @@ namespace emfplushelper
 map[ index ] = state;
 }
 
-void EmfPlusHelperData::GraphicStatePop(GraphicStateMap& map, sal_Int32 
index, wmfemfhelper::PropertyHolder& rState)
+void EmfPlusHelperData::GraphicStatePop(GraphicStateMap& map, sal_Int32 
index)
 {
-GraphicStateMap::iterator iter = map.find( index );
+GraphicStateMap::iterator iter = map.find(index);
 
-if ( iter != map.end() )
+if (iter != map.end())
 {
 wmfemfhelper::PropertyHolder state = iter->second;
 
 maWorldTransform = state.getTransformation();
-rState.setClipPolyPolygon( state.getClipPolyPolygon() );
+if (state.getClipPolyPolygonActive())
+{
+SAL_INFO("drawinglayer.emf",
+"EMF+\t Restore clipping region to saved in index: " 
<< index);
+wmfemfhelper::HandleNewClipRegion(state.getClipPolyPolygon(), 
mrTargetHolders,
+  mrPropertyHolders);
+}
+else
+{
+SAL_INFO("drawinglayer.emf", "EMF+\t Disable clipping");
+wmfemfhelper::HandleNewClipRegion(::basegfx::B2DPolyPolygon(), 
mrTargetHolders,
+  mrPropertyHolders);
+}
 mappingChanged();
-SAL_INFO("drawinglayer.emf", "EMF+\t\tStack index: " << index << " 
found, maWorldTransform: " << maWorldTransform);
+SAL_INFO("drawinglayer.emf",
+"EMF+\t\tStack index: " << index
+<< " found, maWorldTransform: " << 
maWorldTransform);
 }
 }
 
@@ -1000,14 +1014,8 @@ namespace emfplushelper
 }
 case EmfPlusCombineModeIntersect:
 {
-if (leftPolygon.count())
-{
-aClippedPolyPolygon = 
basegfx::utils::clipPolyPolygonOnPolyPolygon(
-leftPolygon,
-rightPolygon,
-true,
-false);
-}
+aClippedPolyPolygon = basegfx::utils::clipPolyPolygonOnPolyPolygon(
+leftPolygon, rightPolygon, true, false);
 break;
 }
 case EmfPlusCombineModeUnion:
@@ -1080,8 +1088,18 @@ namespace emfplushelper
 
 if (bIsGetDCProcessing)
 {
-SAL_INFO("drawinglayer.emf", "EMF+\t reset the current 
clipping region for the world space to infinity.");
-wmfemfhelper::HandleNewClipRegion(::basegfx::B2DPolyPolygon(), 
mrTargetHolders, mrPropertyHolders);
+if (aGetDCState.getClipPolyPolygonActive())
+{
+SAL_INFO("drawinglayer.emf", "EMF+\t Restore region to 
GetDC saved");
+

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

2022-03-22 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/tools/wmfemfhelper.cxx |   18 
 include/vcl/lineinfo.hxx   |5 +++
 vcl/source/filter/eps/eps.cxx  |4 +-
 vcl/source/gdi/lineinfo.cxx|   42 +
 vcl/source/gdi/pdfwriter_impl.cxx  |   21 --
 vcl/source/outdev/line.cxx |   18 
 6 files changed, 35 insertions(+), 73 deletions(-)

New commits:
commit ff8b9f6fca5784f62427302026642de0cdb1ef11
Author: Luboš Luňák 
AuthorDate: Tue Mar 22 12:14:52 2022 +0100
Commit: Luboš Luňák 
CommitDate: Tue Mar 22 15:17:08 2022 +0100

use dashing info from struct LineInfo in EPS writer (tdf#146804)

It had a random(?) hardcoded '2' as the dashing info. While at it,
I've also made few other places use the common implementation
of creating the dotdash array instead of doing it manually.

Change-Id: Id349ca138c98d08eef47dc0bfe6d162e03fc4a9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131932
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx 
b/drawinglayer/source/tools/wmfemfhelper.cxx
index 7f07e472bef8..592e67bab9a5 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -524,23 +524,7 @@ namespace wmfemfhelper
 
 if(bDashDotUsed)
 {
-std::vector< double > fDotDashArray;
-const double fDashLen(rLineInfo.GetDashLen());
-const double fDotLen(rLineInfo.GetDotLen());
-const double fDistance(rLineInfo.GetDistance());
-
-for(sal_uInt16 a(0); a < rLineInfo.GetDashCount(); a++)
-{
-fDotDashArray.push_back(fDashLen);
-fDotDashArray.push_back(fDistance);
-}
-
-for(sal_uInt16 b(0); b < rLineInfo.GetDotCount(); b++)
-{
-fDotDashArray.push_back(fDotLen);
-fDotDashArray.push_back(fDistance);
-}
-
+std::vector< double > fDotDashArray = 
rLineInfo.GetDotDashArray();
 const double 
fAccumulated(std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0));
 const drawinglayer::attribute::StrokeAttribute 
aStrokeAttribute(
 std::move(fDotDashArray),
diff --git a/include/vcl/lineinfo.hxx b/include/vcl/lineinfo.hxx
index 73ed0d3a5771..0644359954b9 100644
--- a/include/vcl/lineinfo.hxx
+++ b/include/vcl/lineinfo.hxx
@@ -27,6 +27,8 @@
 #include 
 #include 
 
+#include 
+
 class SvStream;
 namespace basegfx { class B2DPolyPolygon; }
 
@@ -84,6 +86,9 @@ public:
 voidSetDistance( double nDistance );
 double  GetDistance() const { return mpImplLineInfo->mnDistance; }
 
+/// Get an array of "on" and "off" lengths for stroke dashing
+std::vector< double > GetDotDashArray() const;
+
 void SetLineJoin(basegfx::B2DLineJoin eLineJoin);
 basegfx::B2DLineJoin GetLineJoin() const { return 
mpImplLineInfo->meLineJoin; }
 
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index 1a73c682adf1..374b4c78218b 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -2300,9 +2300,9 @@ void PSWriter::ImplWriteLineInfo( double fLWidth, double 
fMLimit,
 
 void PSWriter::ImplWriteLineInfo( const LineInfo& rLineInfo )
 {
-SvtGraphicStroke::DashArray l_aDashArray;
+std::vector< double > l_aDashArray;
 if ( rLineInfo.GetStyle() == LineStyle::Dash )
-l_aDashArray.push_back( 2 );
+l_aDashArray = rLineInfo.GetDotDashArray();
 const double fLWidth(( ( rLineInfo.GetWidth() + 1 ) + ( 
rLineInfo.GetWidth() + 1 ) ) * 0.5);
 SvtGraphicStroke::JoinType aJoinType(SvtGraphicStroke::joinMiter);
 SvtGraphicStroke::CapType aCapType(SvtGraphicStroke::capButt);
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx
index 94ab3b83df65..85e7c041943e 100644
--- a/vcl/source/gdi/lineinfo.cxx
+++ b/vcl/source/gdi/lineinfo.cxx
@@ -204,6 +204,30 @@ SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& 
rLineInfo )
 return rOStm;
 }
 
+std::vector< double > LineInfo::GetDotDashArray() const
+{
+::std::vector< double > fDotDashArray;
+if ( GetStyle() != LineStyle::Dash )
+return fDotDashArray;
+
+const double fDashLen(GetDashLen());
+const double fDotLen(GetDotLen());
+const double fDistance(GetDistance());
+
+for(sal_uInt16 a(0); a < GetDashCount(); a++)
+{
+fDotDashArray.push_back(fDashLen);
+fDotDashArray.push_back(fDistance);
+}
+
+for(sal_uInt16 b(0); b < GetDotCount(); b++)
+{
+fDotDashArray.push_back(fDotLen);
+fDotDashArray.push_back(fDistance);
+}
+return fDotDashArray;
+}
+
 void LineInfo::applyToB2DPolyPolygon(
 basegfx::B2DPolyPolygon& 

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

2022-03-04 Thread zhutyra (via logerrit)
 drawinglayer/source/primitive2d/textlayoutdevice.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ab4bae2265f6f5ee52baf8db106c77eefd0bd159
Author: zhutyra 
AuthorDate: Fri Mar 4 11:34:01 2022 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 4 13:46:02 2022 +0100

the assumption is that aArray.size() matches the Length argument

LIBREOFFICE-OWMTGGWJ

Change-Id: I68dfcb0dcbb401c62d4e29f9ab6e4ee1ebc7f072
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130973
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx 
b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 60370e722941..f70f9f63b81d 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -309,7 +309,7 @@ std::vector TextLayouterDevice::getTextArray(const 
OUString& rText, sal_
 {
 aRetval.reserve(nTextLength);
 std::vector aArray(nTextLength);
-mrDevice.GetTextArray(rText, , nIndex, nLength);
+mrDevice.GetTextArray(rText, , nIndex, nTextLength);
 aRetval.assign(aArray.begin(), aArray.end());
 }
 
@@ -332,7 +332,7 @@ std::vector 
TextLayouterDevice::getCaretPositions(const OUString& rText,
 {
 aRetval.reserve(2 * nTextLength);
 std::vector aArray(2 * nTextLength);
-mrDevice.GetCaretPositions(rText, aArray.data(), nIndex, nLength);
+mrDevice.GetCaretPositions(rText, aArray.data(), nIndex, nTextLength);
 aRetval.assign(aArray.begin(), aArray.end());
 }
 


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

2022-02-28 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |   36 +++
 1 file changed, 20 insertions(+), 16 deletions(-)

New commits:
commit 6fb261607810fb0d542c0818f60a3f9bead33032
Author: Caolán McNamara 
AuthorDate: Mon Feb 28 09:45:55 2022 +
Commit: Caolán McNamara 
CommitDate: Mon Feb 28 16:26:02 2022 +0100

check if cast is to the right type

LIBREOFFICE-311XVJ95

Change-Id: I159f516daafad3e4088677fe2c8c6f5423b3e264
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130666
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index d2d082424493..447686167837 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -459,7 +459,7 @@ namespace emfplushelper
 }
 else // we use a brush
 {
-const EMFPBrush* brush = 
static_cast(maEMFPObjects[brushIndexOrColor & 0xff].get());
+const EMFPBrush* brush = 
dynamic_cast(maEMFPObjects[brushIndexOrColor & 0xff].get());
 if (brush)
 {
 color = brush->GetColor();
@@ -735,7 +735,7 @@ namespace emfplushelper
 }
 else // use Brush
 {
-EMFPBrush* brush = static_cast( 
maEMFPObjects[brushIndexOrColor & 0xff].get() );
+EMFPBrush* brush = 
dynamic_cast(maEMFPObjects[brushIndexOrColor & 0xff].get());
 SAL_INFO("drawinglayer.emf", "EMF+\t\t Fill polygon, brush slot: " 
<< brushIndexOrColor << " (brush type: " << (brush ? brush->GetType() : -1) << 
")");
 
 // give up in case something wrong happened
@@ -1257,7 +1257,11 @@ namespace emfplushelper
 rMS.ReadUInt32(brushIndexOrColor);
 SAL_INFO("drawinglayer.emf", "EMF+\t FillRegion slot: 
" << index);
 
-
EMFPPlusFillPolygon(static_cast(maEMFPObjects[flags & 
0xff].get())->regionPolyPolygon, flags & 0x8000, brushIndexOrColor);
+EMFPRegion* region = 
dynamic_cast(maEMFPObjects[flags & 0xff].get());
+if (region)
+EMFPPlusFillPolygon(region->regionPolyPolygon, 
flags & 0x8000, brushIndexOrColor);
+else
+SAL_WARN("drawinglayer.emf", 
"EMF+\tEmfPlusRecordTypeFillRegion missing region");
 }
 break;
 case EmfPlusRecordTypeDrawEllipse:
@@ -1435,10 +1439,10 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf", "EMF+\t TODO: use image 
attributes");
 
 // Source unit of measurement type must be 1 pixel
-if (sourceUnit == UnitTypePixel && maEMFPObjects[flags 
& 0xff])
+if (EMFPImage* image = sourceUnit == UnitTypePixel ?
+dynamic_cast(maEMFPObjects[flags & 
0xff].get()) :
+nullptr)
 {
-EMFPImage& image
-= *static_cast(maEMFPObjects[flags 
& 0xff].get());
 float sx, sy, sw, sh;
 ReadRectangle(rMS, sx, sy, sw, sh);
 
@@ -1488,9 +1492,9 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf",
 "EMF+\t Rectangle: " << dx << "," << dy << 
" " << dw << "x" << dh);
 Size aSize;
-if (image.type == ImageDataTypeBitmap)
+if (image->type == ImageDataTypeBitmap)
 {
-aSize = 
image.graphic.GetBitmapEx().GetSizePixel();
+aSize = 
image->graphic.GetBitmapEx().GetSizePixel();
 SAL_INFO("drawinglayer.emf", "EMF+\t Bitmap 
size: " << aSize.Width()

 << "x"

 << aSize.Height());
@@ -1535,9 +1539,9 @@ namespace emfplushelper
 /* Row 1, Column 1 */ aDstSize.getY(),
 /* Row 1, Column 2 */ aDstPoint.getY());
 
-if (image.type == ImageDataTypeBitmap)
+if (image->type == ImageDataTypeBitmap)
 {
-BitmapEx aBmp(image.graphic.GetBitmapEx());
+BitmapEx aBmp(image->graphic.GetBitmapEx());
 aBmp.Crop(aSource);
 aSize = aBmp.GetSizePixel();
 if (aSize.Width() > 0 && aSize.Height() > 0)
@@ -1549,9 +1553,9 @@ 

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

2022-02-26 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/primitive2d/mediaprimitive2d.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4946efd9b9ea532bc3b54f45f412424d1bbe70b0
Author: Caolán McNamara 
AuthorDate: Fri Feb 25 21:06:51 2022 +
Commit: Caolán McNamara 
CommitDate: Sat Feb 26 11:34:32 2022 +0100

Video preview doesn't redraw if the preview image changes

because there is no check to see if the preview changed here.

But because (bizarely?) Graphic::operator== returns true when the lhs is
an empty graphic regardless of the rhs due to:

bool ImpGraphic::operator==(const ImpGraphic& rImpGraphic) const
{
///
switch( meType )
{
case GRAPHIC_NONE:
bRet = true;
break;
...
}

return bRet;
}

don't use that and instead just compare if the graphics contain
something or not which is sufficient for my needs

Change-Id: Ia3266e289b3a42ee30bdb9523bac29fb73f5e341
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130545
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx 
b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
index 108f53bf1431..cd36291428ea 100644
--- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx
@@ -113,7 +113,8 @@ namespace drawinglayer::primitive2d
 return (getTransform() == rCompare.getTransform()
 && maURL == rCompare.maURL
 && getBackgroundColor() == rCompare.getBackgroundColor()
-&& getDiscreteBorder() == rCompare.getDiscreteBorder());
+&& getDiscreteBorder() == rCompare.getDiscreteBorder()
+&& maSnapshot.IsNone() == rCompare.maSnapshot.IsNone());
 }
 
 return false;


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

2022-02-03 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e153f35929475ef661f03b06dfa25aacaa28acfa
Author: Mike Kaganski 
AuthorDate: Thu Feb 3 14:16:40 2022 +0100
Commit: Mike Kaganski 
CommitDate: Thu Feb 3 18:32:45 2022 +0100

We know the buffer length here

Change-Id: Ib4c7176d046a86ad22d57fc8789cd53e87859076
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129346
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 9ef220c32cfb..04258b288277 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -299,11 +299,11 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 
 tools::Long nWidth = 
mpOutputDevice->GetTextArray(rTextCandidate.getText(),
   
, 0, 1);
-tools::Long nChars = 2;
+sal_Int32 nChars = 2;
 if (nWidth)
 nChars = nWidthToFill / nWidth;
 
-OUStringBuffer aFilled;
+OUStringBuffer aFilled(nChars);
 comphelper::string::padToLength(aFilled, nChars, aText[0]);
 aText = aFilled.makeStringAndClear();
 nPos = 0;


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

2022-01-24 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |9 ++-
 vcl/skia/SkiaHelper.cxx   |   17 --
 2 files changed, 23 insertions(+), 3 deletions(-)

New commits:
commit 8ca549ebc01a7aa0b288c521a9e60e76f4d8e97d
Author: Luboš Luňák 
AuthorDate: Wed Jan 12 10:16:39 2022 +0100
Commit: Luboš Luňák 
CommitDate: Mon Jan 24 14:40:22 2022 +0100

avoid Skia GPU surfaces for small virtual devices (bsc#1183308)

This is similar to the previous Cairo commit. Fetching pixels
from the GPU is not as slow as fetching them from the XServer,
but this still can make a visible difference. And small surfaces
should not need fast GPU rendering that much, so hopefully this
improves more cases than it regresses.

Change-Id: Ida031b38cd1ce14ded464747c20a38c6d094c5a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128310
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 7f20d094b446..24e0c6a30bcb 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 // buffered VDev usage
 
@@ -105,10 +106,17 @@ bool VDevBuffer::isSizeSuitable(const 
VclPtr& device, const Size&
 if (device->GetOutputWidthPixel() >= rSizePixel.getWidth()
 && device->GetOutputHeightPixel() >= rSizePixel.getHeight())
 {
+bool requireSmall = false;
 #if defined(UNX)
 // HACK: See the small size handling in 
SvpSalVirtualDevice::CreateSurface().
 // Make sure to not reuse a larger device when a small one should be 
preferred.
 if (device->GetRenderBackendName() == "svp")
+requireSmall = true;
+#endif
+// The same for Skia, see renderMethodToUseForSize().
+if (SkiaHelper::isVCLSkiaEnabled())
+requireSmall = true;
+if (requireSmall)
 {
 if (rSizePixel.getWidth() <= 32 && rSizePixel.getHeight() <= 32
 && (device->GetOutputWidthPixel() > 32 || 
device->GetOutputHeightPixel() > 32))
@@ -116,7 +124,6 @@ bool VDevBuffer::isSizeSuitable(const 
VclPtr& device, const Size&
 return false;
 }
 }
-#endif
 return true;
 }
 return false;
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
index 8dc3827b097a..2642c4f4c8bc 100644
--- a/vcl/skia/SkiaHelper.cxx
+++ b/vcl/skia/SkiaHelper.cxx
@@ -467,12 +467,25 @@ static std::unique_ptr 
getTemporaryWindowContext()
 }
 #endif
 
+static RenderMethod renderMethodToUseForSize(const SkISize& size)
+{
+// Do not use GPU for small surfaces. The problem is that due to the 
separate alpha hack
+// we quite often may call GetBitmap() on VirtualDevice, which is 
relatively slow
+// when the pixels need to be fetched from the GPU. And there are 
documents that use
+// many tiny surfaces (bsc#1183308 for example), where this slowness adds 
up too much.
+// This should be re-evaluated once the separate alpha hack is removed 
(SKIA_USE_BITMAP32)
+// and we no longer (hopefully) fetch pixels that often.
+if (size.width() <= 32 && size.height() <= 32)
+return RenderRaster;
+return renderMethodToUse();
+}
+
 sk_sp createSkSurface(int width, int height, SkColorType type, 
SkAlphaType alpha)
 {
 SkiaZone zone;
 assert(type == kN32_SkColorType || type == kAlpha_8_SkColorType);
 sk_sp surface;
-switch (renderMethodToUse())
+switch (renderMethodToUseForSize({ width, height }))
 {
 case RenderVulkan:
 case RenderMetal:
@@ -518,7 +531,7 @@ sk_sp createSkImage(const SkBitmap& bitmap)
 {
 SkiaZone zone;
 assert(bitmap.colorType() == kN32_SkColorType || bitmap.colorType() == 
kAlpha_8_SkColorType);
-switch (renderMethodToUse())
+switch (renderMethodToUseForSize(bitmap.dimensions()))
 {
 case RenderVulkan:
 case RenderMetal:


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

2022-01-24 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |   34 ++--
 include/vcl/outdev.hxx|3 +
 vcl/headless/svpvd.cxx|   37 --
 vcl/source/outdev/outdev.cxx  |9 +++
 4 files changed, 62 insertions(+), 21 deletions(-)

New commits:
commit cf9be3417bc2be5f772c03180b7cbd248b82cad5
Author: Luboš Luňák 
AuthorDate: Tue Jan 11 19:08:50 2022 +0100
Commit: Luboš Luňák 
CommitDate: Mon Jan 24 14:40:02 2022 +0100

avoid Xlib cairo surfaces for small virtual devices (bsc#1183308)

The (private :( ) document contains a large number of small shapes
for which VclProcessor2D::RenderTransparencePrimitive2D() gets
called, which results in GetBitmapEx() on the VirtualDevice.
And Cairo normally needs to do a roundtrip to the XServer to fetch
the content, which makes the rendering pretty slow. Forcing
image-based surface for small sizes of VirtualDevice actually has
better performance for the document, and the lack of possible
HW acceleration generally shouldn't matter for a surface this small.

Additionally drawinglayer's VirtualDevice reusing tries to reuse
even a large one when a small one is needed, so a hack is needed
to avoid that in this case, I couldn't find a better way.

Change-Id: I0f58659ab88165a6bd915f100fc3b1d4802a0fa9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128309
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index 9129271bcb6b..7f20d094b446 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -63,6 +63,8 @@ private:
 // virtualdevice because that isn't safe to do at least for Gtk2
 std::map, VclPtr> maDeviceTemplates;
 
+static bool isSizeSuitable(const VclPtr& device, const 
Size& size);
+
 public:
 VDevBuffer();
 virtual ~VDevBuffer() override;
@@ -98,6 +100,28 @@ VDevBuffer::~VDevBuffer()
 }
 }
 
+bool VDevBuffer::isSizeSuitable(const VclPtr& device, const 
Size& rSizePixel)
+{
+if (device->GetOutputWidthPixel() >= rSizePixel.getWidth()
+&& device->GetOutputHeightPixel() >= rSizePixel.getHeight())
+{
+#if defined(UNX)
+// HACK: See the small size handling in 
SvpSalVirtualDevice::CreateSurface().
+// Make sure to not reuse a larger device when a small one should be 
preferred.
+if (device->GetRenderBackendName() == "svp")
+{
+if (rSizePixel.getWidth() <= 32 && rSizePixel.getHeight() <= 32
+&& (device->GetOutputWidthPixel() > 32 || 
device->GetOutputHeightPixel() > 32))
+{
+return false;
+}
+}
+#endif
+return true;
+}
+return false;
+}
+
 VclPtr VDevBuffer::alloc(OutputDevice& rOutDev, const Size& 
rSizePixel,
 bool bTransparent)
 {
@@ -124,9 +148,7 @@ VclPtr VDevBuffer::alloc(OutputDevice& 
rOutDev, const Size& rSize
 if (bOkay)
 {
 // found is valid
-const bool bCandidateOkay(
-a->buf->GetOutputWidthPixel() >= 
rSizePixel.getWidth()
-&& a->buf->GetOutputHeightPixel() >= 
rSizePixel.getHeight());
+const bool bCandidateOkay = isSizeSuitable(a->buf, 
rSizePixel);
 
 if (bCandidateOkay)
 {
@@ -151,16 +173,14 @@ VclPtr VDevBuffer::alloc(OutputDevice& 
rOutDev, const Size& rSize
 {
 // found is invalid, use candidate
 aFound = a;
-bOkay = aFound->buf->GetOutputWidthPixel() >= 
rSizePixel.getWidth()
-&& aFound->buf->GetOutputHeightPixel() >= 
rSizePixel.getHeight();
+bOkay = isSizeSuitable(aFound->buf, rSizePixel);
 }
 }
 else
 {
 // none yet, use candidate
 aFound = a;
-bOkay = aFound->buf->GetOutputWidthPixel() >= 
rSizePixel.getWidth()
-&& aFound->buf->GetOutputHeightPixel() >= 
rSizePixel.getHeight();
+bOkay = isSizeSuitable(aFound->buf, rSizePixel);
 }
 }
 }
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 7e1a0fad7dcd..a777f9d73569 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -295,6 +295,9 @@ public:
 const AllSettings&  GetSettings() const { return *mxSettings; }
 
 SystemGraphicsData  GetSystemGfxData() const;
+OUString   

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

2022-01-08 Thread Ramreiso Kashung (via logerrit)
 drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 4e5bbcdc3d1fc4dd94ec896480ab049f3a4926fa
Author: Ramreiso Kashung 
AuthorDate: Sat Jan 8 08:47:31 2022 +0530
Commit: Mike Kaganski 
CommitDate: Sat Jan 8 16:28:36 2022 +0100

Optimise a range-based for loop

This patch is an extension of 
https://gerrit.libreoffice.org/c/core/+/127734 related to comment made by Mike 
Kaganski

Change-Id: Ia7a6480dba2a0752a52ae4f9655c345af9f3ba64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128134
Reviewed-by: Julien Nabet 
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx 
b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
index eb5711307bea..cdaa15e53322 100644
--- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
@@ -51,9 +51,8 @@ namespace drawinglayer::primitive2d
 // use half size for expand
 aLogicHalfSize *= 0.5;
 
-for(const auto& a : rPositions)
+for(const auto& rPosition : rPositions)
 {
-const basegfx::B2DPoint& rPosition(a);
 const basegfx::B2DRange aRange(rPosition - aLogicHalfSize, 
rPosition + aLogicHalfSize);
 basegfx::B2DHomMatrix aTransform;
 


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

2021-12-30 Thread Ramreiso Kashung (via logerrit)
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx|4 ++--
 drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 7886b6a56a51cb699fb2a18d8a8dff0e224bdfb5
Author: Ramreiso Kashung 
AuthorDate: Thu Dec 30 14:23:45 2021 +0530
Commit: Hossein 
CommitDate: Thu Dec 30 14:50:27 2021 +0100

tdf#145538 : Using range-based for loops

Change-Id: I9674eff3e2572ffef7ee19af12befc8a9b6b1c06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127734
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 5873ee69a51f..67349a83425a 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -132,9 +132,9 @@ namespace drawinglayer::primitive2d
 const sal_uInt32 nCount(rmMatrixStack.size());
 maMatrixStack.reserve(nCount);
 
-for(sal_uInt32 a(0); a < nCount; a++)
+for(const auto& a : rmMatrixStack)
 {
-maMatrixStack.emplace_back(rmMatrixStack[a]);
+maMatrixStack.emplace_back(a);
 }
 }
 
diff --git a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx 
b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
index ab66cb223a66..eb5711307bea 100644
--- a/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx
@@ -51,9 +51,9 @@ namespace drawinglayer::primitive2d
 // use half size for expand
 aLogicHalfSize *= 0.5;
 
-for(sal_uInt32 a(0); a < nMarkerCount; a++)
+for(const auto& a : rPositions)
 {
-const basegfx::B2DPoint& rPosition(rPositions[a]);
+const basegfx::B2DPoint& rPosition(a);
 const basegfx::B2DRange aRange(rPosition - aLogicHalfSize, 
rPosition + aLogicHalfSize);
 basegfx::B2DHomMatrix aTransform;
 


[Libreoffice-commits] core.git: drawinglayer/source emfio/CppunitTest_emfio_wmf.mk emfio/qa emfio/source filter/Library_pdffilter.mk filter/source include/drawinglayer sfx2/source svgio/CppunitTest_sv

2021-12-23 Thread Noel Grandin (via logerrit)
 drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx  |2 
 drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx  |2 
 drawinglayer/source/primitive2d/Primitive2DContainer.cxx  |   69 
+++
 drawinglayer/source/primitive2d/Tools.cxx |   28 ++
 drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx|3 
 drawinglayer/source/primitive2d/baseprimitive2d.cxx   |9 
 drawinglayer/source/primitive2d/bitmapprimitive2d.cxx |2 
 drawinglayer/source/primitive2d/controlprimitive2d.cxx|2 
 drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx |2 
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx  |2 
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx  |2 
 drawinglayer/source/primitive2d/gridprimitive2d.cxx   |3 
 drawinglayer/source/primitive2d/groupprimitive2d.cxx  |9 
 drawinglayer/source/primitive2d/helplineprimitive2d.cxx   |3 
 drawinglayer/source/primitive2d/patternfillprimitive2d.cxx|   11 -
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx|2 
 drawinglayer/source/primitive2d/primitivetools2d.cxx  |   12 -
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx  |5 
 drawinglayer/source/primitive2d/texteffectprimitive2d.cxx |3 
 drawinglayer/source/processor2d/baseprocessor2d.cxx   |9 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |4 
 drawinglayer/source/processor3d/defaultprocessor3d.cxx|1 
 drawinglayer/source/tools/converters.cxx  |   97 
++
 drawinglayer/source/tools/primitive2dxmldump.cxx  |5 
 drawinglayer/source/tools/wmfemfhelper.cxx|2 
 emfio/CppunitTest_emfio_wmf.mk|9 
 emfio/qa/cppunit/emf/EmfImportTest.cxx|   91 
+++--
 emfio/source/emfuno/xemfparser.cxx|4 
 filter/Library_pdffilter.mk   |1 
 filter/source/pdf/pdfdecomposer.cxx   |8 
 filter/source/svg/svgfilter.cxx   |   12 -
 include/drawinglayer/converters.hxx   |8 
 include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx |2 
 include/drawinglayer/primitive2d/CommonTypes.hxx  |6 
 include/drawinglayer/primitive2d/Primitive2DContainer.hxx |6 
 include/drawinglayer/primitive2d/Tools.hxx|   13 -
 include/drawinglayer/primitive2d/baseprimitive2d.hxx  |   58 
+
 include/drawinglayer/primitive2d/bitmapprimitive2d.hxx|2 
 include/drawinglayer/primitive2d/groupprimitive2d.hxx |2 
 include/drawinglayer/primitive2d/patternfillprimitive2d.hxx   |2 
 include/drawinglayer/primitive2d/textbreakuphelper.hxx|4 
 include/drawinglayer/processor2d/hittestprocessor2d.hxx   |2 
 sfx2/source/appl/appmisc.cxx  |4 
 sfx2/source/control/thumbnailview.cxx |1 
 sfx2/source/view/viewfrm.cxx  |1 
 svgio/CppunitTest_svgio.mk|1 
 svgio/CppunitTest_svgio_tools.mk  |1 
 svgio/Library_svgio.mk|1 
 svgio/qa/cppunit/SvgImportTest.cxx|   70 
+++
 svgio/source/svguno/xsvgparser.cxx|2 
 svx/source/dialog/frmsel.cxx  |1 
 svx/source/sdr/primitive2d/primitivefactory2d.cxx |4 
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx  |4 
 svx/source/svdraw/svdograf.cxx|6 
 svx/source/svdraw/svdpntv.cxx |3 
 svx/source/svdraw/svdview.cxx |   11 -
 svx/source/svdraw/svdxcgv.cxx |5 
 svx/source/unodraw/unoshape.cxx   |5 
 vcl/Library_vcl.mk|1 
 vcl/source/bitmap/BitmapTools.cxx |2 
 vcl/source/gdi/impgraph.cxx   |   15 +
 61 files changed, 421 insertions(+), 236 deletions(-)

New commits:
commit e3bd776e020723ad8caf0a02d8db0d19e0f0e650
Author: 

[Libreoffice-commits] core.git: drawinglayer/source embeddedobj/source framework/source include/avmedia include/basegfx include/comphelper include/connectivity include/drawinglayer sc/source sfx2/sour

2021-12-15 Thread Gabor Kelemen (via logerrit)
 drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx |1 +
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx|1 +
 drawinglayer/source/primitive2d/textprimitive2d.cxx   |1 +
 drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx  |1 +
 embeddedobj/source/general/dummyobject.cxx|1 +
 embeddedobj/source/msole/olemisc.cxx  |1 +
 framework/source/uielement/genericstatusbarcontroller.cxx |1 +
 include/avmedia/mediaplayer.hxx   |1 -
 include/basegfx/polygon/b2dpolygoncutandtouch.hxx |1 -
 include/basegfx/polygon/b3dpolypolygontools.hxx   |1 -
 include/basegfx/tuple/Tuple2D.hxx |2 --
 include/basegfx/tuple/Tuple3D.hxx |5 
-
 include/basegfx/tuple/b2dtuple.hxx|1 -
 include/basegfx/tuple/b3dtuple.hxx|1 -
 include/comphelper/container.hxx  |1 -
 include/comphelper/multicontainer2.hxx|5 
-
 include/comphelper/multiinterfacecontainer3.hxx   |6 
--
 include/comphelper/servicehelper.hxx  |2 --
 include/comphelper/traceevent.hxx |1 -
 include/connectivity/sdbcx/VTable.hxx |1 -
 include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx |2 --
 include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx  |2 +-
 include/drawinglayer/primitive2d/PolyPolygonSelectionPrimitive2D.hxx  |2 +-
 include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx   |2 +-
 include/drawinglayer/primitive2d/PolygonWavePrimitive2D.hxx   |1 -
 include/drawinglayer/primitive2d/baseprimitive2d.hxx  |5 
+++--
 include/drawinglayer/primitive2d/bitmapprimitive2d.hxx|1 -
 include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx|1 -
 include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx  |1 -
 sc/source/ui/miscdlgs/autofmt.cxx |1 +
 sfx2/source/appl/appmisc.cxx  |1 +
 svgio/source/svgreader/svgcharacternode.cxx   |1 +
 svgio/source/svgreader/svgdocumenthandler.cxx |1 +
 svgio/source/svgreader/svggradientnode.cxx|1 +
 svgio/source/svgreader/svgnode.cxx|1 +
 svx/source/sdr/contact/objectcontactofpageview.cxx|1 +
 svx/source/sdr/contact/viewcontact.cxx|1 +
 svx/source/sdr/contact/viewcontactofsdredgeobj.cxx|1 +
 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx|1 +
 svx/source/sdr/contact/viewcontactofunocontrol.cxx|1 +
 svx/source/sdr/overlay/overlaymanager.cxx |1 +
 svx/source/sdr/overlay/overlayobject.cxx  |1 +
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx  |1 +
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx  |1 +
 svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx |1 +
 svx/source/svdraw/svddrgmt.cxx|1 +
 svx/source/svdraw/svdhdl.cxx  |1 +
 svx/source/svdraw/svdotextdecomposition.cxx   |1 +
 svx/source/svdraw/svdpntv.cxx |1 +
 svx/source/svdraw/svdxcgv.cxx |1 +
 svx/source/table/tablehandles.cxx |1 +
 svx/source/xoutdev/xtabgrdt.cxx   |1 +
 svx/source/xoutdev/xtabhtch.cxx   |1 +
 svx/source/xoutdev/xtablend.cxx   |1 +
 sw/source/core/doc/notxtfrm.cxx   |1 +
 sw/source/core/draw/dflyobj.cxx   |1 +
 sw/source/core/graphic/ndgrf.cxx  |1 +
 sw/source/uibase/docvw/AnnotationWin2.cxx |1 +
 58 files changed, 42 insertions(+), 39 deletions(-)

New commits:
commit b24064f2b75bf2d868564a4ac680d37751a92db4
Author: Gabor Kelemen 
AuthorDate: Tue Dec 14 10:26:14 2021 +0100
Commit: Miklos Vajna 
CommitDate: Wed Dec 15 15:08:10 2021 +0100

Recheck include/[a-d]* with IWYU

See tdf#42949 for motivation
  

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

2021-12-06 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx |2 +-
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx  |4 
++--
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |6 
+++---
 drawinglayer/source/primitive2d/cropprimitive2d.cxx  |4 
++--
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |6 
+++---
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx|2 +-
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx  |2 +-
 drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx   |2 +-
 drawinglayer/source/processor2d/baseprocessor2d.cxx  |6 
+++---
 include/drawinglayer/primitive2d/Primitive2DContainer.hxx|   10 
+++---
 include/drawinglayer/primitive2d/Primitive2DVisitor.hxx  |6 
+++---
 include/drawinglayer/primitive2d/groupprimitive2d.hxx|2 +-
 include/drawinglayer/processor2d/baseprocessor2d.hxx |6 
+++---
 svx/source/sdr/contact/viewobjectcontact.cxx |2 +-
 svx/source/sdr/contact/viewobjectcontactofmasterpagedescriptor.cxx   |2 +-
 svx/source/sdr/primitive2d/sdrole2primitive2d.cxx|2 +-
 16 files changed, 34 insertions(+), 30 deletions(-)

New commits:
commit ca05d480bd4456342f290f975a7353b7d9a63e95
Author: Noel Grandin 
AuthorDate: Fri Dec 3 15:37:26 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Dec 4 11:59:20 2021 +0100

rename Primitive2DDecompositionVisitor methods

from "append" to "visit"

The current naming comes from when I created this class as replacement
for passing Primitive2DContainer around and the naming was meant to
reduce code churn.

But now that I'm using it more, the naming is an impediment to
understanding the code.

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

diff --git 
a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx 
b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
index 6846a3bcdd26..769b23fb5b80 100644
--- a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
@@ -43,7 +43,7 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition(
 std::move(aNewSequence));
 }
 
-rVisitor.append(getBuffered2DDecomposition());
+rVisitor.visit(getBuffered2DDecomposition());
 }
 
 } // end of namespace drawinglayer::primitive2d
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index adb66dddb36c..5873ee69a51f 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -77,7 +77,7 @@ namespace drawinglayer::primitive2d
 }
 
 const Primitive2DReference xRef(getChildren()[nIndex], 
uno::UNO_SET_THROW);
-rVisitor.append(xRef);
+rVisitor.visit(xRef);
 }
 
 // provide unique ID
@@ -185,7 +185,7 @@ namespace drawinglayer::primitive2d
 
 // create new transform primitive reference, return new 
sequence
 Primitive2DReference xRef(new 
TransformPrimitive2D(aTargetTransform, Primitive2DContainer(getChildren(;
-rVisitor.append(xRef);
+rVisitor.visit(xRef);
 }
 else
 {
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 71a13346beff..86eaa37eb976 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -112,15 +112,15 @@ public:
 : mrViewInformation(rViewInformation)
 {
 }
-virtual void append(const Primitive2DReference& r) override
+virtual void visit(const Primitive2DReference& r) override
 {
 maRetval.expand(getB2DRangeFromPrimitive2DReference(r, 
mrViewInformation));
 }
-virtual void append(const Primitive2DContainer& r) override
+virtual void visit(const Primitive2DContainer& r) override
 {
 maRetval.expand(r.getB2DRange(mrViewInformation));
 }
-virtual void append(Primitive2DContainer&& r) override
+virtual void visit(Primitive2DContainer&& r) override
 {
 maRetval.expand(r.getB2DRange(mrViewInformation));
 }
diff --git a/drawinglayer/source/primitive2d/cropprimitive2d.cxx 
b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
index 06a7e2726f04..76393ad05507 100644
--- a/drawinglayer/source/primitive2d/cropprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
@@ -126,7 +126,7 @@ namespace 

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

2021-11-24 Thread Julien Nabet (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5461ed9828b48f947f99a034d7e3d8072157c58d
Author: Julien Nabet 
AuthorDate: Wed Nov 24 21:50:52 2021 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 24 23:05:53 2021 +0100

tdf#145874: fix "Drop deg2rad/rad2deg conversions" for gradient export in a 
pdf

Regression from:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=bc0ab08634f59e1a1814e575fe6ad5e50bf1aee1
Drop F_PI1800/F_PI18000, and unify deg2rad/rad2deg conversions

Change-Id: I40089b166242d06e417b1877146d43df192d6225
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125791
Reviewed-by: Mike Kaganski 
Tested-by: Jenkins

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 87ae848b3ca9..b679768c9c3b 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -272,7 +272,7 @@ void 
VclMetafileProcessor2D::impConvertFillGradientAttributeToVCLGradient(
 }
 
 o_rVCLGradient.SetAngle(
-
Degree10(static_cast(basegfx::rad2deg<100>(rFiGrAtt.getAngle();
+
Degree10(static_cast(basegfx::rad2deg<10>(rFiGrAtt.getAngle();
 o_rVCLGradient.SetBorder(static_cast(rFiGrAtt.getBorder() * 
100.0));
 o_rVCLGradient.SetOfsX(static_cast(rFiGrAtt.getOffsetX() * 
100.0));
 o_rVCLGradient.SetOfsY(static_cast(rFiGrAtt.getOffsetY() * 
100.0));


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

2021-11-23 Thread Harjot (via logerrit)
 drawinglayer/source/dumper/EnhancedShapeDumper.cxx |   73 -
 1 file changed, 30 insertions(+), 43 deletions(-)

New commits:
commit 34a0f7023aad59bc054385f0593606d5d602e052
Author: Harjot 
AuthorDate: Fri Nov 19 23:00:11 2021 +0530
Commit: Hossein 
CommitDate: Tue Nov 23 14:42:47 2021 +0100

tdf#145538 Use range based for loops in EnhancedShapeDumper.cxx

Change-Id: I111f6c7ab5ab2033c08683a16adaf388eeabc9ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125577
Tested-by: Hossein 
Reviewed-by: Hossein 

diff --git a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx 
b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
index 1d453e32aad0..6e83f15db044 100644
--- a/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
+++ b/drawinglayer/source/dumper/EnhancedShapeDumper.cxx
@@ -469,11 +469,10 @@ void 
EnhancedShapeDumper::dumpTextRotateAngleAsAttribute(double aTextRotateAngle
 void EnhancedShapeDumper::dumpAdjustmentValuesAsElement(const uno::Sequence< 
drawing::EnhancedCustomShapeAdjustmentValue>& aAdjustmentValues)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "AdjustmentValues" ));
-sal_Int32 nLength = aAdjustmentValues.getLength();
-for (sal_Int32 i = 0; i < nLength; ++i)
+for (const auto& i : aAdjustmentValues)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( 
"EnhancedCustomShapeAdjustmentValue" ));
-uno::Any aAny = aAdjustmentValues[i].Value;
+uno::Any aAny = i.Value;
 OUString sValue;
 float fValue;
 sal_Int32 nValue;
@@ -496,7 +495,7 @@ void 
EnhancedShapeDumper::dumpAdjustmentValuesAsElement(const uno::Sequence< dra
 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, 
BAD_CAST("value"), "%s", (bValue? "true": "false"));
 }
 
-switch(aAdjustmentValues[i].State)
+switch(i.State)
 {
 case beans::PropertyState_DIRECT_VALUE:
 (void)xmlTextWriterWriteFormatAttribute( xmlWriter, 
BAD_CAST("propertyState"), "%s", "DIRECT_VALUE");
@@ -550,10 +549,9 @@ void EnhancedShapeDumper::dumpPropertyValueAsElement(const 
beans::PropertyValue&
 void EnhancedShapeDumper::dumpExtrusionAsElement(const uno::Sequence< 
beans::PropertyValue >& aExtrusion)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Extrusion" ));
-sal_Int32 nLength = aExtrusion.getLength();
-for (sal_Int32 i = 0; i < nLength; ++i)
+for (const auto& i : aExtrusion)
 {
-dumpPropertyValueAsElement(aExtrusion[i]);
+dumpPropertyValueAsElement(i);
 }
 (void)xmlTextWriterEndElement( xmlWriter );
 }
@@ -561,10 +559,9 @@ void EnhancedShapeDumper::dumpExtrusionAsElement(const 
uno::Sequence< beans::Pro
 void EnhancedShapeDumper::dumpPathAsElement(const uno::Sequence< 
beans::PropertyValue >& aPath)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Path" ));
-sal_Int32 nLength = aPath.getLength();
-for (sal_Int32 i = 0; i < nLength; ++i)
+for (const auto& i : aPath)
 {
-dumpPropertyValueAsElement(aPath[i]);
+dumpPropertyValueAsElement(i);
 }
 (void)xmlTextWriterEndElement( xmlWriter );
 }
@@ -572,10 +569,9 @@ void EnhancedShapeDumper::dumpPathAsElement(const 
uno::Sequence< beans::Property
 void EnhancedShapeDumper::dumpTextPathAsElement(const uno::Sequence< 
beans::PropertyValue >& aTextPath)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "TextPath" ));
-sal_Int32 nLength = aTextPath.getLength();
-for (sal_Int32 i = 0; i < nLength; ++i)
+for (const auto& i : aTextPath)
 {
-dumpPropertyValueAsElement(aTextPath[i]);
+dumpPropertyValueAsElement(i);
 }
 (void)xmlTextWriterEndElement( xmlWriter );
 }
@@ -583,11 +579,10 @@ void EnhancedShapeDumper::dumpTextPathAsElement(const 
uno::Sequence< beans::Prop
 void EnhancedShapeDumper::dumpEquationsAsElement(const uno::Sequence< OUString 
>& aEquations)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Equations" ));
-sal_Int32 nLength = aEquations.getLength();
-for (sal_Int32 i = 0; i < nLength; ++i)
+for (const auto& i : aEquations)
 {
 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), 
"%s",
-OUStringToOString(aEquations[i], RTL_TEXTENCODING_UTF8).getStr());
+OUStringToOString(i, RTL_TEXTENCODING_UTF8).getStr());
 }
 (void)xmlTextWriterEndElement( xmlWriter );
 }
@@ -598,15 +593,13 @@ void EnhancedShapeDumper::dumpEquationsAsElement(const 
uno::Sequence< OUString >
 void EnhancedShapeDumper::dumpHandlesAsElement(const uno::Sequence< 
beans::PropertyValues >& aHandles)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "Handles" ));
-sal_Int32 nSequenceLength = aHandles.getLength();
-for (sal_Int32 i = 0; i < nSequenceLength; ++i)
+for (const auto& i : aHandles)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( "PropertyValues" 

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

2021-11-23 Thread Henrik Palomäki (via logerrit)
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 6f435016092953478b5636fe9078866500fc7b90
Author: Henrik Palomäki 
AuthorDate: Wed Nov 17 09:39:13 2021 +0200
Commit: Hossein 
CommitDate: Tue Nov 23 13:57:13 2021 +0100

tdf#145538 Use range based for loops

* Used range based for loop in fillhatchprimitive2d.cxx
+ Goal: Better readability of the code

Change-Id: Ie8ddaa9960e714b161ec530961b36a9935055ae0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125413
Tested-by: Hossein 
Reviewed-by: Hossein 

diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx 
b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index 49b26cb919b0..60d47c3ed559 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -114,9 +114,9 @@ namespace drawinglayer::primitive2d
 const basegfx::B2DPoint aStart(0.0, 0.0);
 const basegfx::B2DPoint aEnd(1.0, 0.0);
 
-for(size_t a(0); a < aMatrices.size(); a++)
+for (const auto  : aMatrices)
 {
-const basegfx::B2DHomMatrix& rMatrix = aMatrices[a];
+const basegfx::B2DHomMatrix& rMatrix = a;
 basegfx::B2DPolygon aNewLine;
 
 aNewLine.append(rMatrix * aStart);


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

2021-11-10 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/tools/primitive2dxmldump.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5ae675d3da0ec92ca3929c6078d8fd5c7d3167f1
Author: Andrea Gelmini 
AuthorDate: Wed Nov 10 05:31:19 2021 +0100
Commit: Julien Nabet 
CommitDate: Wed Nov 10 20:51:39 2021 +0100

Removed useless semicolons

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

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index b679465a69c2..2e2bb887a3d4 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -267,7 +267,7 @@ void writeSdrFillAttribute(::tools::XmlWriter& rWriter,
 case drawinglayer::attribute::GradientStyle::Rect:
 rWriter.attribute("style", "Rect");
 break;
-};
+}
 rWriter.attribute("border", rGradient.getBorder());
 rWriter.attribute("offsetX", rGradient.getOffsetX());
 rWriter.attribute("offsetY", rGradient.getOffsetY());
@@ -293,7 +293,7 @@ void writeSdrFillAttribute(::tools::XmlWriter& rWriter,
 case drawinglayer::attribute::HatchStyle::Triple:
 rWriter.attribute("style", "Triple");
 break;
-};
+}
 rWriter.attribute("distance", rHatch.getDistance());
 rWriter.attribute("angle", rHatch.getAngle());
 rWriter.attribute("color", convertColorToString(rHatch.getColor()));


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

2021-11-10 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx |   14 ++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit c606d330864a10caba6e0f9600db56ae445999c1
Author: Noel Grandin 
AuthorDate: Tue Nov 9 18:50:02 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Nov 10 12:23:00 2021 +0100

osl::Mutex->std::mutex in TubeBuffer

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

diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx 
b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
index 645958ae6a29..8065ad73e54f 100644
--- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-
+#include 
 
 namespace drawinglayer::primitive3d
 {
@@ -38,7 +38,7 @@ namespace drawinglayer::primitive3d
 Primitive3DContainer m_aLineTubeList;
 sal_uInt32 m_nLineTubeSegments;
 attribute::MaterialAttribute3D m_aLineMaterial;
-::osl::Mutex m_aMutex;
+std::mutex m_aMutex;
 public:
 TubeBuffer()
 : m_nLineTubeSegments(0)
@@ -53,7 +53,7 @@ namespace drawinglayer::primitive3d
 const attribute::MaterialAttribute3D& rMaterial)
 {
 // may exclusively change cached data, use mutex
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 
 if (nSegments != m_nLineTubeSegments || !(rMaterial == 
m_aLineMaterial))
 {
@@ -120,7 +120,7 @@ namespace drawinglayer::primitive3d
 Primitive3DContainer m_aLineCapList;
 sal_uInt32 m_nLineCapSegments;
 attribute::MaterialAttribute3D m_aLineMaterial;
-::osl::Mutex m_aMutex;
+std::mutex m_aMutex;
 public:
 CapBuffer()
 : m_nLineCapSegments(0)
@@ -134,7 +134,7 @@ namespace drawinglayer::primitive3d
 const attribute::MaterialAttribute3D& rMaterial)
 {
 // may exclusively change cached data, use mutex
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 
 if (nSegments != m_nLineCapSegments || !(rMaterial == 
m_aLineMaterial))
 {
@@ -195,7 +195,7 @@ namespace drawinglayer::primitive3d
 Primitive3DContainer m_aLineCapRoundList;
 sal_uInt32 m_nLineCapRoundSegments;
 attribute::MaterialAttribute3D m_aLineMaterial;
-::osl::Mutex m_aMutex;
+std::mutex m_aMutex;
 public:
 CapRoundBuffer()
 : m_nLineCapRoundSegments(0)
@@ -209,7 +209,7 @@ namespace drawinglayer::primitive3d
 const attribute::MaterialAttribute3D& rMaterial)
 {
 // may exclusively change cached data, use mutex
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 
 if (nSegments != m_nLineCapRoundSegments || !(rMaterial == 
m_aLineMaterial))
 {


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

2021-11-09 Thread Noel Grandin (via logerrit)
 drawinglayer/source/attribute/fillgradientattribute.cxx|   12 +++-
 drawinglayer/source/attribute/fillgraphicattribute.cxx |9 ++---
 drawinglayer/source/attribute/fillhatchattribute.cxx   |   12 +++-
 drawinglayer/source/attribute/fontattribute.cxx|9 +
 drawinglayer/source/attribute/lineattribute.cxx|   12 +++-
 drawinglayer/source/attribute/linestartendattribute.cxx|   12 +++-
 drawinglayer/source/attribute/materialattribute3d.cxx  |   10 ++
 drawinglayer/source/attribute/sdrfillattribute.cxx |   12 +++-
 drawinglayer/source/attribute/sdrfillgraphicattribute.cxx  |   12 +++-
 drawinglayer/source/attribute/sdrlightattribute3d.cxx  |7 ---
 drawinglayer/source/attribute/sdrlightingattribute3d.cxx   |   12 +++-
 drawinglayer/source/attribute/sdrlineattribute.cxx |   12 +++-
 drawinglayer/source/attribute/sdrlinestartendattribute.cxx |   12 +++-
 drawinglayer/source/attribute/sdrobjectattribute3d.cxx |7 ---
 drawinglayer/source/attribute/sdrsceneattribute3d.cxx  |   12 +++-
 drawinglayer/source/attribute/sdrshadowattribute.cxx   |   12 +++-
 drawinglayer/source/attribute/strokeattribute.cxx  |   12 +++-
 drawinglayer/source/geometry/viewinformation2d.cxx |9 +
 drawinglayer/source/geometry/viewinformation3d.cxx |   12 +++-
 drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx |1 -
 20 files changed, 113 insertions(+), 95 deletions(-)

New commits:
commit 151316b6010c45078e0a031f0ba07d6117c0109d
Author: Noel Grandin 
AuthorDate: Tue Nov 9 18:46:58 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Nov 9 20:42:24 2021 +0100

rtl::Static to thread-safe static

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

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index 0e42954e35e6..b8b06e20bbbf 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -19,7 +19,6 @@
 
 #include 
 #include 
-#include 
 
 
 namespace drawinglayer::attribute
@@ -92,8 +91,11 @@ namespace drawinglayer::attribute
 
 namespace
 {
-struct theGlobalDefault :
-public rtl::Static< FillGradientAttribute::ImplType, 
theGlobalDefault > {};
+FillGradientAttribute::ImplType& theGlobalDefault()
+{
+static FillGradientAttribute::ImplType SINGLETON;
+return SINGLETON;
+}
 }
 
 FillGradientAttribute::FillGradientAttribute(
@@ -111,7 +113,7 @@ namespace drawinglayer::attribute
 }
 
 FillGradientAttribute::FillGradientAttribute()
-:   mpFillGradientAttribute(theGlobalDefault::get())
+:   mpFillGradientAttribute(theGlobalDefault())
 {
 }
 
@@ -123,7 +125,7 @@ namespace drawinglayer::attribute
 
 bool FillGradientAttribute::isDefault() const
 {
-return 
mpFillGradientAttribute.same_object(theGlobalDefault::get());
+return mpFillGradientAttribute.same_object(theGlobalDefault());
 }
 
 FillGradientAttribute& FillGradientAttribute::operator=(const 
FillGradientAttribute&) = default;
diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx 
b/drawinglayer/source/attribute/fillgraphicattribute.cxx
index 95ed10e60dac..b36520d4f981 100644
--- a/drawinglayer/source/attribute/fillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx
@@ -86,8 +86,11 @@ namespace drawinglayer::attribute
 
 namespace
 {
-struct theGlobalDefault :
-public rtl::Static< FillGraphicAttribute::ImplType, 
theGlobalDefault > {};
+FillGraphicAttribute::ImplType& theGlobalDefault()
+{
+static FillGraphicAttribute::ImplType SINGLETON;
+return SINGLETON;
+}
 }
 
 FillGraphicAttribute::FillGraphicAttribute(
@@ -109,7 +112,7 @@ namespace drawinglayer::attribute
 
 bool FillGraphicAttribute::isDefault() const
 {
-return mpFillGraphicAttribute.same_object(theGlobalDefault::get());
+return mpFillGraphicAttribute.same_object(theGlobalDefault());
 }
 
 FillGraphicAttribute& FillGraphicAttribute::operator=(const 
FillGraphicAttribute&) = default;
diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx 
b/drawinglayer/source/attribute/fillhatchattribute.cxx
index 19739a2c3dcf..bc892a024842 100644
--- a/drawinglayer/source/attribute/fillhatchattribute.cxx
+++ 

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

2021-10-31 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 2023a5291984438de52a95e5bc560a82d69eaca1
Author: Caolán McNamara 
AuthorDate: Sun Oct 31 14:51:24 2021 +
Commit: Caolán McNamara 
CommitDate: Sun Oct 31 17:33:46 2021 +0100

crashtesting: failure on conversion of fdo74498-1.doc to pdf

noticable since...

commit 894b4911ffb96ff667fdeb3aec7922316ab7230a
Date:   Thu Oct 28 09:27:29 2021 +0200

pass DX array around using o3tl::span instead of pointer

but presumably a problem since...

commit 793905906980e77a9853a8dd01fab95b65ca4f02
Date:   Tue Sep 14 15:28:33 2010 +0200

filled-tab-editeng.diff: Filled tab wasn't filled in shapes

n#564454

here I assume the right fix is to extend the DXArray (if non-empty) to
match the new length using the value of the initial entry of the old
DXArray

Change-Id: I36a6040c2d05e108c7c6f9cdab9a33557036cd22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124528
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 831972d187ab..b055ef229ce2 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -307,6 +307,14 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 aText = aFilled.makeStringAndClear();
 nPos = 0;
 nLen = nChars;
+
+if (!aTransformedDXArray.empty())
+{
+sal_Int32 nDX = aTransformedDXArray[0];
+aTransformedDXArray.resize(nLen);
+for (sal_Int32 i = 1; i < nLen; ++i)
+aTransformedDXArray[i] = aTransformedDXArray[i - 1] + 
nDX;
+}
 }
 
 if (!aTransformedDXArray.empty())


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

2021-10-30 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/textlayoutdevice.cxx  |2 -
 editeng/source/accessibility/AccessibleStringWrap.cxx |2 -
 include/vcl/outdev.hxx|2 -
 include/vcl/vcllayout.hxx |2 -
 vcl/inc/sallayout.hxx |4 +-
 vcl/inc/textlayout.hxx|4 +-
 vcl/source/control/edit.cxx   |   26 +-
 vcl/source/gdi/sallayout.cxx  |   10 +++---
 vcl/source/gdi/textlayout.cxx |6 ++--
 vcl/source/outdev/text.cxx|   20 ++---
 10 files changed, 39 insertions(+), 39 deletions(-)

New commits:
commit 91399f5d9d9990d2e249155f4810cdaa5051e72b
Author: Noel Grandin 
AuthorDate: Sat Oct 30 15:43:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Oct 30 18:25:25 2021 +0200

tools::Long->sal_Int32 in GetCaretPositions

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

diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx 
b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 3dfd0258f099..102effd7fde1 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -331,7 +331,7 @@ std::vector 
TextLayouterDevice::getCaretPositions(const OUString& rText,
 if (nTextLength)
 {
 aRetval.reserve(2 * nTextLength);
-std::vector aArray(2 * nTextLength);
+std::vector aArray(2 * nTextLength);
 mrDevice.GetCaretPositions(rText, aArray.data(), nIndex, nLength);
 aRetval.assign(aArray.begin(), aArray.end());
 }
diff --git a/editeng/source/accessibility/AccessibleStringWrap.cxx 
b/editeng/source/accessibility/AccessibleStringWrap.cxx
index 29ed20295760..9dff63c3ce75 100644
--- a/editeng/source/accessibility/AccessibleStringWrap.cxx
+++ b/editeng/source/accessibility/AccessibleStringWrap.cxx
@@ -56,7 +56,7 @@ void AccessibleStringWrap::GetCharacterBounds( sal_Int32 
nIndex, tools::Rectangl
 }
 else
 {
-tools::Long aXArray[2];
+sal_Int32 aXArray[2];
 mrDev.GetCaretPositions( maText, aXArray, nIndex, 1 );
 rRect.SetLeft( 0 );
 rRect.SetTop( 0 );
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 900a4e88db80..151ab8236c6c 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1061,7 +1061,7 @@ public:
   vcl::text::TextLayoutCache 
const* = nullptr,
   SalLayoutGlyphs const*const 
pLayoutCache = nullptr) const;
 
-voidGetCaretPositions( const OUString&, 
tools::Long* pCaretXArray,
+voidGetCaretPositions( const OUString&, sal_Int32* 
pCaretXArray,
   sal_Int32 nIndex, sal_Int32 nLen,
   const SalLayoutGlyphs* pGlyphs = 
nullptr ) const;
 voidDrawStretchText( const Point& rStartPt, 
sal_uLong nWidth,
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index 34acb2fe733e..6ea9bc61bfbb 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -88,7 +88,7 @@ public:
 virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, 
DeviceCoordinate nCharExtra, int nFactor) const = 0;
 virtual DeviceCoordinate FillDXArray( std::vector* 
pDXArray ) const = 0;
 virtual DeviceCoordinate GetTextWidth() const { return FillDXArray( 
nullptr ); }
-virtual voidGetCaretPositions( int nArraySize, tools::Long* 
pCaretXArray ) const = 0;
+virtual voidGetCaretPositions( int nArraySize, sal_Int32* pCaretXArray 
) const = 0;
 virtual boolIsKashidaPosValid ( int /*nCharPos*/ ) const { return 
true; } // i60594
 
 // methods using glyph indexing
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 8dc16d9021c1..ab29a2022985 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -63,7 +63,7 @@ public:
 voidDrawText(SalGraphics&) const override;
 sal_Int32   GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate 
nCharExtra, int nFactor) const override;
 DeviceCoordinate FillDXArray(std::vector* pDXArray) 
const override;
-voidGetCaretPositions(int nArraySize, tools::Long* 
pCaretXArray) const override;
+voidGetCaretPositions(int nArraySize, sal_Int32* pCaretXArray) 
const override;
 boolGetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& 
nStart,
  const LogicalFontInstance** ppGlyphFont = 
nullptr,
  const vcl::font::PhysicalFontFace** 
pFallbackFont = nullptr) const 

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

2021-10-27 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/dumper/XShapeDumper.cxx |   31 +++-
 1 file changed, 13 insertions(+), 18 deletions(-)

New commits:
commit 380b9a819a29a8aa0525632065006f4bd026cf96
Author: Mike Kaganski 
AuthorDate: Tue Oct 26 07:55:30 2021 +0200
Commit: Mike Kaganski 
CommitDate: Wed Oct 27 11:33:30 2021 +0200

Move variable declaration to its use in if() condition

Helps understanding the condition more clearly.

Change-Id: Ibb2b60283ea650bfac93621feb0333953cac8fcf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124188
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx 
b/drawinglayer/source/dumper/XShapeDumper.cxx
index 7e258dc40619..1434de2ba219 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -1131,53 +1131,48 @@ void dumpPropertyValueAsElement(const 
beans::PropertyValue& rPropertyValue, xmlT
 OUStringToOString(rPropertyValue.Name, 
RTL_TEXTENCODING_UTF8).getStr());
 
 uno::Any aAny = rPropertyValue.Value;
-OUString sValue;
-float fValue;
-sal_Int32 nValue;
-bool bValue;
-awt::Rectangle aRectangleValue;
-uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> 
aAdjustmentValues;
-uno::Sequence< drawing::EnhancedCustomShapeParameterPair > aCoordinates;
-uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
-uno::Sequence< beans::PropertyValue > aPropSeq;
-if(aAny >>= sValue)
+if(OUString sValue; aAny >>= sValue)
 {
 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%s",
 OUStringToOString(sValue, RTL_TEXTENCODING_UTF8).getStr());
 }
-else if(aAny >>= nValue)
+else if(sal_Int32 nValue; aAny >>= nValue)
 {
 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%" SAL_PRIdINT32, nValue);
 }
-else if(aAny >>= fValue)
+else if(float fValue; aAny >>= fValue)
 {
 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%f", fValue);
 }
-else if(aAny >>= bValue)
+else if(bool bValue; aAny >>= bValue)
 {
 (void)xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("value"), 
"%s", (bValue? "true": "false"));
 }
-else if(rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
+else if(awt::Rectangle aRectangleValue;
+rPropertyValue.Name == "ViewBox" && (aAny >>= aRectangleValue))
 {
 EnhancedShapeDumper enhancedDumper(xmlWriter);
 enhancedDumper.dumpViewBoxAsElement(aRectangleValue);
 }
-else if(rPropertyValue.Name == "AdjustmentValues" && (aAny >>= 
aAdjustmentValues))
+else if(uno::Sequence< drawing::EnhancedCustomShapeAdjustmentValue> 
aAdjustmentValues;
+rPropertyValue.Name == "AdjustmentValues" && (aAny >>= 
aAdjustmentValues))
 {
 EnhancedShapeDumper enhancedDumper(xmlWriter);
 enhancedDumper.dumpAdjustmentValuesAsElement(aAdjustmentValues);
 }
-else if(rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
+else if(uno::Sequence< drawing::EnhancedCustomShapeParameterPair > 
aCoordinates;
+rPropertyValue.Name == "Coordinates" && (aAny >>= aCoordinates))
 {
 EnhancedShapeDumper enhancedDumper(xmlWriter);
 enhancedDumper.dumpCoordinatesAsElement(aCoordinates);
 }
-else if(rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
+else if(uno::Sequence< drawing::EnhancedCustomShapeSegment > aSegments;
+rPropertyValue.Name == "Segments" && (aAny >>= aSegments))
 {
 EnhancedShapeDumper enhancedDumper(xmlWriter);
 enhancedDumper.dumpSegmentsAsElement(aSegments);
 }
-else if(aAny >>= aPropSeq)
+else if(uno::Sequence< beans::PropertyValue > aPropSeq; aAny >>= aPropSeq)
 {
 (void)xmlTextWriterStartElement(xmlWriter, BAD_CAST( 
OUStringToOString(rPropertyValue.Name, RTL_TEXTENCODING_UTF8).getStr() ));
 


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

2021-10-19 Thread Hossein (via logerrit)
 drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx |6 +++---
 drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx  |4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 47728bb925b33a8fe536fed8c913a2669bf101b6
Author: Hossein 
AuthorDate: Mon Oct 18 20:03:05 2021 +0200
Commit: Mike Kaganski 
CommitDate: Tue Oct 19 22:33:11 2021 +0200

Use range based for loops

* Use range based for loops where it was possible in drawinglayer
  + Goal: Better readability of the code

Change-Id: I188d27ce09c0d603e39d40ea63e91a8666e5d885
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123758
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index 489c45cbd1cc..7baf93bf5292 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -159,18 +159,18 @@ namespace drawinglayer::primitive2d
 rOuterColor));
 
 // create solid fill steps
-for(size_t a(0); a < rEntries.size(); a++)
+for(const auto  : rEntries)
 {
 // create part polygon
 basegfx::B2DPolygon aNewPoly(rUnitPolygon);
 
-aNewPoly.transform(rEntries[a].maB2DHomMatrix);
+aNewPoly.transform(a.maB2DHomMatrix);
 
 // create solid fill
 rContainer.push_back(
 new PolyPolygonColorPrimitive2D(
 basegfx::B2DPolyPolygon(aNewPoly),
-rEntries[a].maBColor));
+a.maBColor));
 }
 }
 
diff --git a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx 
b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
index 7566f8be9384..0f386eea29de 100644
--- a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
@@ -69,10 +69,10 @@ namespace drawinglayer::primitive2d
 rGraphic,
 basegfx::B2DHomMatrix());
 
-for(size_t a(0); a < aMatrices.size(); a++)
+for(const auto  : aMatrices)
 {
 rContainer.push_back(new TransformPrimitive2D(
-getTransformation() * aMatrices[a],
+getTransformation() * a,
 Primitive2DContainer(xSeq)));
 }
 }


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

2021-10-07 Thread Hossein (via logerrit)
 drawinglayer/source/tools/emfpstringformat.cxx |   64 +
 1 file changed, 14 insertions(+), 50 deletions(-)

New commits:
commit a2b1c2835733fb028bc5433eb6805820c329daf3
Author: Hossein 
AuthorDate: Thu Oct 7 00:12:24 2021 +0200
Commit: Mike Kaganski 
CommitDate: Thu Oct 7 15:06:23 2021 +0200

Clean StringFormatFlags() in emfpstringformat.cxx

* Fix: StringFormatDirectionVertical was missing, and another enum
  was used instead by mistake

* Cleaned up StringFormatFlags() method
+ There was no need to check for each flag and add ", "
+ The method is only used for SAL_INFO
+ Just adding space in the end of each flag every time
+ Goal: Making code faster and also more readable

Change-Id: I4be2d291611f2b5d3c8a4490a8b273d5a4511dfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123200
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/tools/emfpstringformat.cxx 
b/drawinglayer/source/tools/emfpstringformat.cxx
index 071493c13062..0a053201b4ec 100644
--- a/drawinglayer/source/tools/emfpstringformat.cxx
+++ b/drawinglayer/source/tools/emfpstringformat.cxx
@@ -46,75 +46,39 @@ namespace emfplushelper
 {
 OUStringBuffer sFlags;
 
+// These are extracted from enum in emfpstringformat.hxx
 if (flag & StringFormatDirectionRightToLeft)
-sFlags.append("StringFormatDirectionRightToLeft");
+sFlags.append("StringFormatDirectionRightToLeft ");
 
-if (flag & StringFormatDirectionRightToLeft)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
-
-sFlags.append("StringFormatDirectionRightToLeft");
-}
+if (flag & StringFormatDirectionVertical)
+sFlags.append("StringFormatDirectionVertical ");
 
 if (flag & StringFormatNoFitBlackBox)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
-
-sFlags.append("StringFormatNoFitBlackBox");
-}
+sFlags.append("StringFormatNoFitBlackBox ");
 
 if (flag & StringFormatDisplayFormatControl)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
+sFlags.append("StringFormatDisplayFormatControl ");
 
-sFlags.append("StringFormatDisplayFormatControl");
-}
 if (flag & StringFormatNoFontFallback)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
+sFlags.append("StringFormatNoFontFallback ");
 
-sFlags.append("StringFormatNoFontFallback");
-}
 if (flag & StringFormatMeasureTrailingSpaces)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
+sFlags.append("StringFormatMeasureTrailingSpaces ");
 
-sFlags.append("StringFormatMeasureTrailingSpaces");
-}
 if (flag & StringFormatNoWrap)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
+sFlags.append("StringFormatNoWrap ");
 
-sFlags.append("StringFormatNoWrap");
-}
 if (flag & StringFormatLineLimit)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
+sFlags.append("StringFormatLineLimit ");
 
-sFlags.append("StringFormatLineLimit");
-}
 if (flag & StringFormatNoClip)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
+sFlags.append("StringFormatNoClip ");
 
-sFlags.append("StringFormatNoClip");
-}
 if (flag & StringFormatBypassGDI)
-{
-if (!sFlags.isEmpty())
-sFlags.append(", ");
-
-sFlags.append("StringFormatBypassGDI");
-}
+sFlags.append("StringFormatBypassGDI ");
 
+// There will be 1 extra space in the end. It could be truncated, but
+// as it is for SAL_INFO() only, it would not be important
 return sFlags.makeStringAndClear();
 }
 


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

2021-10-03 Thread Julien Nabet (via logerrit)
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 868e82d70be0921c8338ccfc49c90343f82a2dd1
Author: Julien Nabet 
AuthorDate: Sun Oct 3 14:01:51 2021 +0200
Commit: Julien Nabet 
CommitDate: Sun Oct 3 19:27:04 2021 +0200

drop 'using namespace std' in drawinglayer

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

diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx 
b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 961e02eec864..25e78ed4 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -27,7 +27,6 @@
 #include 
 
 using namespace com::sun::star;
-using namespace std;
 
 namespace drawinglayer::primitive2d
 {


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

2021-09-26 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx |1 +
 drawinglayer/source/primitive2d/controlprimitive2d.cxx |1 +
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx   |1 +
 drawinglayer/source/primitive2d/gridprimitive2d.cxx|1 +
 drawinglayer/source/primitive2d/helplineprimitive2d.cxx|1 +
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx |1 +
 drawinglayer/source/primitive2d/primitivetools2d.cxx   |4 
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx   |5 +++--
 drawinglayer/source/primitive2d/texteffectprimitive2d.cxx  |1 +
 include/drawinglayer/primitive2d/baseprimitive2d.hxx   |4 ++--
 10 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 7809e2fe6cd237a547d93293d1ea434d16ccb689
Author: Noel Grandin 
AuthorDate: Tue Sep 21 15:35:55 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 26 18:18:46 2021 +0200

recursive_mutex -> mutex in BasePrimitive2DImplBase

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

diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx 
b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
index f13b92bc4ddb..68f31cb4c67a 100644
--- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
@@ -82,6 +82,7 @@ namespace drawinglayer::primitive2d
 }
 
 // use parent implementation
+aGuard.unlock();
 BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, 
rViewInformation);
 }
 
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx 
b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 92f0ed5cf464..6eebc11a0fa5 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -336,6 +336,7 @@ namespace drawinglayer::primitive2d
 }
 
 // use parent implementation
+aGuard.unlock();
 BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, 
rViewInformation);
 }
 
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx 
b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index 666f5459ed39..b01f8d76222a 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -176,6 +176,7 @@ namespace drawinglayer::primitive2d
 std::unique_lock aGuard( m_aMutex );
 bool bAdaptDistance(0 != 
getFillHatch().getMinimalDiscreteDistance());
 
+aGuard.unlock();
 if(bAdaptDistance)
 {
 // behave view-dependent
diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx 
b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
index 64816b076862..c7929a89c7cf 100644
--- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
@@ -324,6 +324,7 @@ namespace drawinglayer::primitive2d
 }
 
 // use parent implementation
+aGuard.unlock();
 BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, 
rViewInformation);
 }
 
diff --git a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx 
b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
index 0db4f37470c2..ba1a680560bb 100644
--- a/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/helplineprimitive2d.cxx
@@ -174,6 +174,7 @@ namespace drawinglayer::primitive2d
 }
 
 // use parent implementation
+aGuard.unlock();
 BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, 
rViewInformation);
 }
 
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx 
b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 184f72fdb810..961e02eec864 100644
--- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
@@ -193,6 +193,7 @@ void PolygonMarkerPrimitive2D::get2DDecomposition(
 }
 
 // use parent implementation
+aGuard.unlock();
 BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, 
rViewInformation);
 }
 
diff --git a/drawinglayer/source/primitive2d/primitivetools2d.cxx 
b/drawinglayer/source/primitive2d/primitivetools2d.cxx
index 61e060e5ecfa..c4ab4f5c800b 100644
--- a/drawinglayer/source/primitive2d/primitivetools2d.cxx
+++ b/drawinglayer/source/primitive2d/primitivetools2d.cxx
@@ -45,6 +45,7 @@ namespace drawinglayer::primitive2d
 }
 
 // call base implementation
+aGuard.unlock();
 

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

2021-09-23 Thread Miklos Vajna (via logerrit)
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx |   73 
++
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |8 -
 drawinglayer/source/tools/primitive2dxmldump.cxx  |4 
 include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx |   12 +
 include/drawinglayer/primitive2d/shadowprimitive2d.hxx|8 -
 svx/qa/unit/table.cxx |   12 -
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx  |   72 
+++--
 svx/source/table/viewcontactoftableobj.cxx|   15 +-
 8 files changed, 101 insertions(+), 103 deletions(-)

New commits:
commit 00fa364a2403dc23a786d3f91fde06e10b3a4a9a
Author: Miklos Vajna 
AuthorDate: Thu Sep 23 16:55:19 2021 +0200
Commit: Miklos Vajna 
CommitDate: Thu Sep 23 17:48:59 2021 +0200

Related: tdf#144091 svx: fix interaction of transp cell fill and transp 
shadow

This is a follow-up to commit 37a52d30bbfcf1d073779b50139c4dafa507be4b
(tdf#144091 svx: fix unwanted blur of shadow from table cell fill,
2021-09-20), where it turned out that the original bugdoc was just a
special case of almost full transparency (80%), that's why avoiding the
blur fixed the problem.

A more general approach instead is to multiply the alpha or the cell
fill of table shapes and the alpha of the shadow itself. The end result
is the same (80% transparency) for the first bugdoc, but this gives back
the blur on the second bugdoc.

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

diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
index 3d4bbdfecb92..6ea066b35754 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -31,28 +30,6 @@ using namespace com::sun::star;
 
 namespace drawinglayer::primitive2d
 {
-namespace
-{
-void get2DDecompositionOfChildren(const ShadowPrimitive2D& rPrimitive,
-  Primitive2DDecompositionVisitor& rVisitor,
-  const Primitive2DContainer& rChildren)
-{
-if (rChildren.empty())
-return;
-
-// create a modifiedColorPrimitive containing the shadow color and the 
content
-const basegfx::BColorModifierSharedPtr aBColorModifier
-= 
std::make_shared(rPrimitive.getShadowColor());
-const Primitive2DReference xRefA(
-new ModifiedColorPrimitive2D(Primitive2DContainer(rChildren), 
aBColorModifier));
-Primitive2DContainer aSequenceB{ xRefA };
-
-// build transformed primitiveVector with shadow offset and add to target
-rVisitor.append(
-new TransformPrimitive2D(rPrimitive.getShadowTransform(), 
std::move(aSequenceB)));
-}
-}
-
 ShadowPrimitive2D::ShadowPrimitive2D(
 const basegfx::B2DHomMatrix& rShadowTransform,
 const basegfx::BColor& rShadowColor,
@@ -89,41 +66,21 @@ void get2DDecompositionOfChildren(const ShadowPrimitive2D& 
rPrimitive,
 
 void 
ShadowPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& 
rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const
 {
-get2DDecompositionOfChildren(*this, rVisitor, getChildren());
-}
-
-void ShadowPrimitive2D::get2DDecompositionWithoutBlur(
-Primitive2DDecompositionVisitor& rVisitor,
-const geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-Primitive2DContainer aChildren;
-// Only decompose children which are not blurred (they opted in 
for this).
-std::copy_if(getChildren().begin(), getChildren().end(), 
std::back_inserter(aChildren),
- [](const Primitive2DReference& xChild) {
- auto pChild
- = 
dynamic_cast(
- xChild.get());
- return pChild && pChild->getExcludeFromBlur();
- });
-
-get2DDecompositionOfChildren(*this, rVisitor, aChildren);
-}
-
-void ShadowPrimitive2D::get2DDecompositionWithBlur(
-Primitive2DDecompositionVisitor& rVisitor,
-const geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-// Only decompose children which are blurred (which is the 
default).
-Primitive2DContainer aChildren;
-std::copy_if(getChildren().begin(), getChildren().end(), 
std::back_inserter(aChildren),
- [](const Primitive2DReference& xChild) {
- auto 

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

2021-09-22 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx  |2 +-
 include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx |4 
++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 58418e9a85a007f550d9deb02729fc0c96cc1efd
Author: Noel Grandin 
AuthorDate: Wed Sep 22 09:43:33 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 22 12:30:15 2021 +0200

reduce copying in BufferedDecompositionPrimitive2D

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

diff --git 
a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx 
b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
index 301d501e6e32..6846a3bcdd26 100644
--- a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
@@ -40,7 +40,7 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition(
 Primitive2DContainer aNewSequence;
 create2DDecomposition(aNewSequence, rViewInformation);
 
const_cast(this)->setBuffered2DDecomposition(
-aNewSequence);
+std::move(aNewSequence));
 }
 
 rVisitor.append(getBuffered2DDecomposition());
diff --git 
a/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx 
b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
index 66bb9f29af24..c09635c6d60d 100644
--- a/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
+++ b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx
@@ -79,9 +79,9 @@ protected:
 {
 return maBuffered2DDecomposition;
 }
-void setBuffered2DDecomposition(const Primitive2DContainer& rNew)
+void setBuffered2DDecomposition(Primitive2DContainer&& rNew)
 {
-maBuffered2DDecomposition = rNew;
+maBuffered2DDecomposition = std::move(rNew);
 }
 
 /** method which is to be used to implement the local decomposition of a 
2D primitive. */


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

2021-09-21 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx |2 
 drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx   |2 
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |   64 
+-
 drawinglayer/source/primitive2d/controlprimitive2d.cxx   |2 
 drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx|2 
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx |2 
 drawinglayer/source/primitive2d/gridprimitive2d.cxx  |2 
 drawinglayer/source/primitive2d/helplineprimitive2d.cxx  |2 
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx   |2 
 drawinglayer/source/primitive2d/primitivetools2d.cxx |8 -
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx |4 
 drawinglayer/source/primitive2d/texteffectprimitive2d.cxx|2 
 include/drawinglayer/primitive2d/baseprimitive2d.hxx |   41 
+-
 13 files changed, 112 insertions(+), 23 deletions(-)

New commits:
commit 19d638eaedf84cefadf55d561c3c36df33fed6fe
Author: Noel Grandin 
AuthorDate: Tue Sep 21 10:01:03 2021 +0200
Commit: Noel Grandin 
CommitDate: Tue Sep 21 15:34:21 2021 +0200

reduce cost of BasePrimitive2D (tdf#125892)

the default WeakComponentImplHelper wants to allocate two child objects
(osl::Mutex and BroadcastHelper).

So use a custom re-implemenation that does not need to allocate any
child objects.

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

diff --git 
a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx 
b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
index 896f85d81f1e..301d501e6e32 100644
--- a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
@@ -33,7 +33,7 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition(
 Primitive2DDecompositionVisitor& rVisitor,
 const geometry::ViewInformation2D& rViewInformation) const
 {
-::osl::MutexGuard aGuard(m_aMutex);
+std::unique_lock aGuard(m_aMutex);
 
 if (getBuffered2DDecomposition().empty())
 {
diff --git a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx 
b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
index 90ff831da005..f13b92bc4ddb 100644
--- a/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx
@@ -67,7 +67,7 @@ namespace drawinglayer::primitive2d
 
 void 
BackgroundColorPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& 
rVisitor, const geometry::ViewInformation2D& rViewInformation) const
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if(!getBuffered2DDecomposition().empty() && (maLastViewport != 
rViewInformation.getViewport()))
 {
diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 61cd0923ad3d..71a13346beff 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -24,15 +24,73 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace css;
 
-namespace drawinglayer::primitive2d
+BasePrimitive2DImplBase::~BasePrimitive2DImplBase() {}
+
+css::uno::Any BasePrimitive2DImplBase::queryInterface(css::uno::Type const& 
rType)
+{
+css::uno::Any aReturn = ::cppu::queryInterface(
+rType, static_cast(this), 
static_cast(this),
+static_cast(this), 
static_cast(this),
+static_cast(this));
+if (aReturn.hasValue())
+return aReturn;
+return OWeakObject::queryInterface(rType);
+}
+
+void BasePrimitive2DImplBase::acquire() noexcept { OWeakObject::acquire(); }
+
+void BasePrimitive2DImplBase::release() noexcept
 {
-BasePrimitive2D::BasePrimitive2D()
-: BasePrimitive2DImplBase(m_aMutex)
+if (osl_atomic_decrement(_refCount) != 0)
+return;
+
+// ensure no other references are created, via the weak connection point, 
from now on
+disposeWeakConnectionPoint();
+// restore reference count:
+osl_atomic_increment(_refCount);
+//if (! rBHelper.bDisposed) {
+//try {
+//dispose();
+//}
+//catch (RuntimeException const& exc) { // don't break throw ()
+//SAL_WARN( "cppuhelper", exc );
+//}
+//OSL_ASSERT( rBHelper.bDisposed );
+//}
+OWeakObject::release();
+}
+
+void BasePrimitive2DImplBase::dispose() {}
+
+void BasePrimitive2DImplBase::addEventListener(
+css::uno::Reference const&)
 {
+assert(false);

[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer svx/CppunitTest_svx_unit.mk svx/qa svx/source

2021-09-20 Thread Miklos Vajna (via logerrit)
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx |   73 
+--
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx   |6 
 drawinglayer/source/tools/primitive2dxmldump.cxx  |   33 
+++
 include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx |7 
 include/drawinglayer/primitive2d/shadowprimitive2d.hxx|8 
 svx/CppunitTest_svx_unit.mk   |1 
 svx/qa/unit/data/table-shadow-blur.pptx   |binary
 svx/qa/unit/table.cxx |  102 
++
 svx/source/table/viewcontactoftableobj.cxx|   13 -
 9 files changed, 221 insertions(+), 22 deletions(-)

New commits:
commit 37a52d30bbfcf1d073779b50139c4dafa507be4b
Author: Miklos Vajna 
AuthorDate: Mon Sep 20 11:26:53 2021 +0200
Commit: Miklos Vajna 
CommitDate: Mon Sep 20 12:57:23 2021 +0200

tdf#144091 svx: fix unwanted blur of shadow from table cell fill

Initial render support for shadows of table shapes were added in commit
a75bf43a8d6c5dec6dcc86908c142ceec541aa8c (tdf#129961 svx: add rendering
for table shadow as direct format, 2020-12-02).

That already noticed a trick with the shadow of table shapes: the shadow
is generate from the cell fill and the border, but not from the text.

An additional trick is that when blur is enabled for the table shape's
shadow, then only the border should be blurred, not the cell fill.

In the bug document's case, the effective cell background was gray, with
a semi-transparent red shadow. We used to render cc with blur and
cc without blur, now we correctly render cca3a3, matching
PowerPoint.

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

diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
index 6ea066b35754..3d4bbdfecb92 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -30,6 +31,28 @@ using namespace com::sun::star;
 
 namespace drawinglayer::primitive2d
 {
+namespace
+{
+void get2DDecompositionOfChildren(const ShadowPrimitive2D& rPrimitive,
+  Primitive2DDecompositionVisitor& rVisitor,
+  const Primitive2DContainer& rChildren)
+{
+if (rChildren.empty())
+return;
+
+// create a modifiedColorPrimitive containing the shadow color and the 
content
+const basegfx::BColorModifierSharedPtr aBColorModifier
+= 
std::make_shared(rPrimitive.getShadowColor());
+const Primitive2DReference xRefA(
+new ModifiedColorPrimitive2D(Primitive2DContainer(rChildren), 
aBColorModifier));
+Primitive2DContainer aSequenceB{ xRefA };
+
+// build transformed primitiveVector with shadow offset and add to target
+rVisitor.append(
+new TransformPrimitive2D(rPrimitive.getShadowTransform(), 
std::move(aSequenceB)));
+}
+}
+
 ShadowPrimitive2D::ShadowPrimitive2D(
 const basegfx::B2DHomMatrix& rShadowTransform,
 const basegfx::BColor& rShadowColor,
@@ -66,21 +89,41 @@ namespace drawinglayer::primitive2d
 
 void 
ShadowPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& 
rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const
 {
-if(getChildren().empty())
-return;
-
-// create a modifiedColorPrimitive containing the shadow color and 
the content
-const basegfx::BColorModifierSharedPtr aBColorModifier =
-std::make_shared(
-getShadowColor());
-const Primitive2DReference xRefA(
-new ModifiedColorPrimitive2D(
-Primitive2DContainer(getChildren()),
-aBColorModifier));
-Primitive2DContainer aSequenceB { xRefA };
-
-// build transformed primitiveVector with shadow offset and add to 
target
-rVisitor.append(new TransformPrimitive2D(getShadowTransform(), 
std::move(aSequenceB)));
+get2DDecompositionOfChildren(*this, rVisitor, getChildren());
+}
+
+void ShadowPrimitive2D::get2DDecompositionWithoutBlur(
+Primitive2DDecompositionVisitor& rVisitor,
+const geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+Primitive2DContainer aChildren;
+// Only decompose children which are not blurred (they opted in 
for this).
+std::copy_if(getChildren().begin(), getChildren().end(), 
std::back_inserter(aChildren),
+ 

[Libreoffice-commits] core.git: drawinglayer/source framework/inc svtools/source

2021-09-11 Thread Noel Grandin (via logerrit)
 drawinglayer/source/attribute/fillgradientattribute.cxx |   10 +++
 drawinglayer/source/attribute/sdrlineattribute.cxx  |   22 
 framework/inc/uielement/commandinfo.hxx |2 -
 svtools/source/control/valueacc.cxx |4 +-
 svtools/source/control/valueimp.hxx |   10 +++
 5 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit d8910519f1bc5aa284a79b7d24581d087adf0c29
Author: Noel Grandin 
AuthorDate: Sat Sep 11 14:11:38 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 11 14:59:36 2021 +0200

clang:optin.performance.Padding

Excessive padding in 'struct ValueSetItem' (8 padding bytes, where 0 is
optimal).
Excessive padding in 'struct framework::CommandInfo' (12 padding bytes,
where 4 is optimal). Optimal fields order: aIds, nId, nImageInfo,
consider reordering the fields or adding explicit padding members
[optin.performance.Padding]
Excessive padding in 'class
drawinglayer::attribute::ImpFillGradientAttribute' (10 padding bytes,
where 2 is optimal).
Excessive padding in 'class
drawinglayer::attribute::ImpSdrLineAttribute' (8 padding bytes, where 0
is optimal).

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

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index 1d3a67b02a7a..0e42954e35e6 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -28,13 +28,13 @@ namespace drawinglayer::attribute
 {
 public:
 // data definitions
-GradientStyle   meStyle;
 double  mfBorder;
 double  mfOffsetX;
 double  mfOffsetY;
 double  mfAngle;
 basegfx::BColor maStartColor;
 basegfx::BColor maEndColor;
+GradientStyle   meStyle;
 sal_uInt16  mnSteps;
 
 ImpFillGradientAttribute(
@@ -46,23 +46,23 @@ namespace drawinglayer::attribute
 const basegfx::BColor& rStartColor,
 const basegfx::BColor& rEndColor,
 sal_uInt16 nSteps)
-:   meStyle(eStyle),
-mfBorder(fBorder),
+:   mfBorder(fBorder),
 mfOffsetX(fOffsetX),
 mfOffsetY(fOffsetY),
 mfAngle(fAngle),
 maStartColor(rStartColor),
 maEndColor(rEndColor),
+meStyle(eStyle),
 mnSteps(nSteps)
 {
 }
 
 ImpFillGradientAttribute()
-:   meStyle(GradientStyle::Linear),
-mfBorder(0.0),
+:   mfBorder(0.0),
 mfOffsetX(0.0),
 mfOffsetY(0.0),
 mfAngle(0.0),
+meStyle(GradientStyle::Linear),
 mnSteps(0)
 {
 }
diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx 
b/drawinglayer/source/attribute/sdrlineattribute.cxx
index 3dd7e16d6ab6..217ed813cdcd 100644
--- a/drawinglayer/source/attribute/sdrlineattribute.cxx
+++ b/drawinglayer/source/attribute/sdrlineattribute.cxx
@@ -28,13 +28,13 @@ namespace drawinglayer::attribute
 {
 public:
 // line definitions
-basegfx::B2DLineJoinmeJoin; // 
B2DLINEJOIN_* defines
 double  mfWidth;// 
1/100th mm, 0.0==hair
 double  mfTransparence; // 
[0.0 .. 1.0], 0.0==no transp.
+double  mfFullDotDashLen;   // sum 
of maDotDashArray (for convenience)
 basegfx::BColor maColor;// 
color of line
+std::vector< double >   maDotDashArray; // 
array of double which defines the dot-dash pattern
+basegfx::B2DLineJoinmeJoin; // 
B2DLINEJOIN_* defines
 css::drawing::LineCap   meCap;  // 
BUTT, ROUND, or SQUARE
-std::vector< double > maDotDashArray; // array 
of double which defines the dot-dash pattern
-double  mfFullDotDashLen;   // sum 
of maDotDashArray (for convenience)
 
 ImpSdrLineAttribute(
 basegfx::B2DLineJoin eJoin,
@@ -44,22 +44,22 @@ namespace 

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

2021-09-09 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7e76ea4bcc720826be457ac6ea26fba36193f006
Author: Noel Grandin 
AuthorDate: Thu Sep 9 15:34:56 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Sep 9 16:25:48 2021 +0200

fix std::move same object more than once

after
commit 8104d771b10a5c8b15eae4b67aa112ae2ef77b5b
tdf#144052 reduce Primitive2D copying

spotted by mikekanganski

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

diff --git a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx 
b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
index 958d3bf17960..7566f8be9384 100644
--- a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
@@ -73,7 +73,7 @@ namespace drawinglayer::primitive2d
 {
 rContainer.push_back(new TransformPrimitive2D(
 getTransformation() * aMatrices[a],
-std::move(xSeq)));
+Primitive2DContainer(xSeq)));
 }
 }
 else


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

2021-09-08 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/Tools.cxx |   14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

New commits:
commit c07f4a7d04eb44020045859d305f4510ae9acfc4
Author: Noel Grandin 
AuthorDate: Wed Sep 8 20:20:55 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Sep 8 22:20:41 2021 +0200

no need to call expand() here

we can just return the value directly

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

diff --git a/drawinglayer/source/primitive2d/Tools.cxx 
b/drawinglayer/source/primitive2d/Tools.cxx
index 45b2a993b3a7..7be666a2cbd0 100644
--- a/drawinglayer/source/primitive2d/Tools.cxx
+++ b/drawinglayer/source/primitive2d/Tools.cxx
@@ -32,16 +32,12 @@ basegfx::B2DRange
 getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate,
 const geometry::ViewInformation2D& 
aViewInformation)
 {
-basegfx::B2DRange aRetval;
+if (!rCandidate)
+return basegfx::B2DRange();
 
-if (rCandidate.is())
-{
-// get C++ implementation base
-const BasePrimitive2D* 
pCandidate(static_cast(rCandidate.get()));
-aRetval.expand(pCandidate->getB2DRange(aViewInformation));
-}
-
-return aRetval;
+// get C++ implementation base
+const BasePrimitive2D* 
pCandidate(static_cast(rCandidate.get()));
+return pCandidate->getB2DRange(aViewInformation);
 }
 
 bool arePrimitive2DReferencesEqual(const Primitive2DReference& rxA, const 
Primitive2DReference& rxB)


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

2021-08-31 Thread Noel Grandin (via logerrit)
 drawinglayer/source/animation/animationtiming.cxx|3 -
 drawinglayer/source/attribute/fillgradientattribute.cxx  |2 -
 drawinglayer/source/attribute/fillgraphicattribute.cxx   |4 --
 drawinglayer/source/attribute/fillhatchattribute.cxx |1 
 drawinglayer/source/attribute/fontattribute.cxx  |4 --
 drawinglayer/source/attribute/lineattribute.cxx  |3 -
 drawinglayer/source/attribute/linestartendattribute.cxx  |1 
 drawinglayer/source/attribute/materialattribute3d.cxx|6 ---
 drawinglayer/source/attribute/sdrfillattribute.cxx   |6 ---
 drawinglayer/source/attribute/sdrfillgraphicattribute.cxx|8 

 drawinglayer/source/attribute/sdrlightingattribute3d.cxx |2 -
 drawinglayer/source/attribute/sdrlineattribute.cxx   |2 -
 drawinglayer/source/attribute/sdrlinestartendattribute.cxx   |4 --
 drawinglayer/source/attribute/sdrshadowattribute.cxx |7 
+---
 drawinglayer/source/attribute/strokeattribute.cxx|3 -
 drawinglayer/source/geometry/viewinformation3d.cxx   |   17 
+-
 drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx |6 ---
 drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx  |3 -
 drawinglayer/source/primitive2d/PolyPolygonGradientPrimitive2D.cxx   |6 +--
 drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx|3 -
 drawinglayer/source/primitive2d/PolyPolygonHairlinePrimitive2D.cxx   |3 -
 drawinglayer/source/primitive2d/PolyPolygonHatchPrimitive2D.cxx  |6 +--
 drawinglayer/source/primitive2d/PolyPolygonMarkerPrimitive2D.cxx |3 -
 drawinglayer/source/primitive2d/PolyPolygonSelectionPrimitive2D.cxx  |3 -
 drawinglayer/source/primitive2d/PolyPolygonStrokePrimitive2D.cxx |7 
+---
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx  |3 -
 drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx   |6 +--
 drawinglayer/source/primitive2d/bitmapprimitive2d.cxx|3 -
 drawinglayer/source/primitive2d/borderlineprimitive2d.cxx|3 -
 drawinglayer/source/primitive2d/controlprimitive2d.cxx   |   13 
++-
 drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx|3 -
 drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx|   13 
+--
 drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx|5 --
 drawinglayer/source/primitive2d/epsprimitive2d.cxx   |3 -
 drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx  |6 +--
 drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx   |3 -
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx |6 +--
 drawinglayer/source/primitive2d/graphicprimitive2d.cxx   |7 
+---
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |2 -
 drawinglayer/source/primitive2d/gridprimitive2d.cxx  |7 
+---
 drawinglayer/source/primitive2d/groupprimitive2d.cxx |3 -
 drawinglayer/source/primitive2d/helplineprimitive2d.cxx  |7 
+---
 drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx   |3 -
 drawinglayer/source/primitive2d/mediaprimitive2d.cxx |3 -
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx  |3 -
 drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx   |3 -
 drawinglayer/source/primitive2d/patternfillprimitive2d.cxx   |3 -
 drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx|6 +--
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx   |   14 
++--
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx |8 
+---
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx   |   16 
++---
 drawinglayer/source/primitive2d/textbreakuphelper.cxx|3 -
 drawinglayer/source/primitive2d/texteffectprimitive2d.cxx|3 -
 drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx |3 -
 drawinglayer/source/primitive2d/textlayoutdevice.cxx |3 -
 drawinglayer/source/primitive2d/textlineprimitive2d.cxx  |3 -
 drawinglayer/source/primitive2d/textprimitive2d.cxx  |4 --
 drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx |3 -
 drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx |3 -
 drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx|3 -
 drawinglayer/source/primitive3d/baseprimitive3d.cxx  |2 -
 drawinglayer/source/primitive3d/groupprimitive3d.cxx |3 -
 

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

2021-08-27 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/patternfillprimitive2d.cxx  |   45 +++
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   74 
 drawinglayer/source/processor2d/vclpixelprocessor2d.hxx |2 
 include/drawinglayer/primitive2d/patternfillprimitive2d.hxx |   12 +
 4 files changed, 132 insertions(+), 1 deletion(-)

New commits:
commit 3cbe3a0259bea4dec70e72191ec3c03441926a07
Author: Noel Grandin 
AuthorDate: Mon Jun 14 15:05:59 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 27 08:48:19 2021 +0200

tdf#101083 speed up SVG rendering with pattern fill

By pushing the work down to the vcl layer, which has much more
efficient ways of dump lots of copies of a single image

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

diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx 
b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
index e7a1f7480b6c..45776edc50d5 100644
--- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
@@ -93,6 +93,30 @@ namespace drawinglayer::primitive2d
 }
 }
 
+void PatternFillPrimitive2D::getTileSize(
+sal_uInt32& rWidth,
+sal_uInt32& rHeight,
+const geometry::ViewInformation2D& rViewInformation) const
+{
+const basegfx::B2DRange aMaskRange(getMask().getB2DRange());
+
+// get discrete rounded up square size of a single tile
+const basegfx::B2DHomMatrix aMaskRangeTransformation(
+basegfx::utils::createScaleTranslateB2DHomMatrix(
+aMaskRange.getRange(),
+aMaskRange.getMinimum()));
+const basegfx::B2DHomMatrix aTransform(
+rViewInformation.getObjectToViewTransformation() * 
aMaskRangeTransformation);
+const basegfx::B2DPoint aTopLeft(aTransform * 
getReferenceRange().getMinimum());
+const basegfx::B2DPoint aX(aTransform * 
basegfx::B2DPoint(getReferenceRange().getMaxX(), 
getReferenceRange().getMinY()));
+const basegfx::B2DPoint aY(aTransform * 
basegfx::B2DPoint(getReferenceRange().getMinX(), 
getReferenceRange().getMaxY()));
+const double fW(basegfx::B2DVector(aX - aTopLeft).getLength());
+const double fH(basegfx::B2DVector(aY - aTopLeft).getLength());
+
+rWidth = basegfx::fround(ceil(fW));
+rHeight = basegfx::fround(ceil(fH));
+}
+
 Primitive2DContainer PatternFillPrimitive2D::createContent(const 
geometry::ViewInformation2D& rViewInformation) const
 {
 Primitive2DContainer aContent;
@@ -142,7 +166,7 @@ namespace drawinglayer::primitive2d
 
 // check if content needs to be clipped
 const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
-const basegfx::B2DRange 
aContentRange(getChildren().getB2DRange(rViewInformation));
+const basegfx::B2DRange 
aContentRange(aContent.getB2DRange(rViewInformation));
 
 if(!aUnitRange.isInside(aContentRange))
 {
@@ -158,6 +182,25 @@ namespace drawinglayer::primitive2d
 return aContent;
 }
 
+//  create buffered content in given resolution
+BitmapEx PatternFillPrimitive2D::createTileImage(sal_uInt32 nWidth, 
sal_uInt32 nHeight) const
+{
+const geometry::ViewInformation2D aViewInformation2D;
+const Primitive2DContainer 
aContent(createContent(aViewInformation2D));
+const primitive2d::Primitive2DReference xEmbedRef(
+new primitive2d::TransformPrimitive2D(
+basegfx::utils::createScaleB2DHomMatrix(nWidth, 
nHeight),
+aContent));
+const primitive2d::Primitive2DContainer xEmbedSeq { xEmbedRef };
+
+return convertToBitmapEx(
+xEmbedSeq,
+aViewInformation2D,
+nWidth,
+nHeight,
+nWidth * nHeight);
+}
+
 void 
PatternFillPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, 
const geometry::ViewInformation2D& rViewInformation) const
 {
 Primitive2DContainer aRetval;
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 4e9e963ef065..58f5f2881402 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -27,7 +27,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -57,6 +59,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

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

2021-08-20 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/geometry/viewinformation3d.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit af1b02ede015e21cdad9ad98f8f042db4f31c4ce
Author: Stephan Bergmann 
AuthorDate: Fri Aug 20 15:07:37 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Aug 20 16:27:27 2021 +0200

-Werror,-Wunused-private-field

...after cf66fd32ed8a31d4ca6f031a13e90caf19f40682 "loplugin:unusedmethods"

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

diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx 
b/drawinglayer/source/geometry/viewinformation3d.cxx
index bab2e31f9630..93ba5e2e20c9 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -66,9 +66,6 @@ namespace drawinglayer::geometry
 // the point in time
 double  mfViewTime;
 
-// the complete PropertyValue representation (if already created)
-uno::Sequence< beans::PropertyValue >   mxViewInformation;
-
 // the extra PropertyValues; does not contain the transformations
 uno::Sequence< beans::PropertyValue >   mxExtendedInformation;
 
@@ -224,7 +221,6 @@ namespace drawinglayer::geometry
 maProjection(rProjection),
 maDeviceToView(rDeviceToView),
 mfViewTime(fViewTime),
-mxViewInformation(),
 mxExtendedInformation()
 {
 impInterpretPropertyValues(rExtendedParameters);
@@ -236,7 +232,6 @@ namespace drawinglayer::geometry
 maProjection(),
 maDeviceToView(),
 mfViewTime(),
-mxViewInformation(rViewParameters),
 mxExtendedInformation()
 {
 impInterpretPropertyValues(rViewParameters);
@@ -248,7 +243,6 @@ namespace drawinglayer::geometry
 maProjection(),
 maDeviceToView(),
 mfViewTime(),
-mxViewInformation(),
 mxExtendedInformation()
 {
 }


[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer include/unotools sfx2/source

2021-08-20 Thread Noel Grandin (via logerrit)
 drawinglayer/source/geometry/viewinformation2d.cxx  |   66 --
 drawinglayer/source/geometry/viewinformation3d.cxx  |  131 
 include/drawinglayer/geometry/viewinformation2d.hxx |2 
 include/drawinglayer/geometry/viewinformation3d.hxx |9 -
 include/unotools/compatibility.hxx  |   12 -
 sfx2/source/dialog/StyleList.cxx|6 
 sfx2/source/dialog/templdlg.cxx |   42 --
 sfx2/source/inc/StyleList.hxx   |2 
 sfx2/source/inc/templdgi.hxx|1 
 9 files changed, 271 deletions(-)

New commits:
commit cf66fd32ed8a31d4ca6f031a13e90caf19f40682
Author: Noel Grandin 
AuthorDate: Fri Aug 20 10:26:50 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 20 13:08:07 2021 +0200

loplugin:unusedmethods

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

diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx 
b/drawinglayer/source/geometry/viewinformation2d.cxx
index 115d8cd0b039..e15f2082acd1 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -290,72 +290,6 @@ createViewInformation2D(const 
css::uno::Sequence& rVi
  fViewTime, bReducedDisplayQuality);
 }
 
-uno::Sequence
-createPropertyValues(const ViewInformation2D& rViewInformation2D)
-{
-const bool bObjectTransformationUsed(
-!rViewInformation2D.getObjectTransformation().isIdentity());
-const bool 
bViewTransformationUsed(!rViewInformation2D.getViewTransformation().isIdentity());
-const bool bViewportUsed(!rViewInformation2D.getViewport().isEmpty());
-const bool bTimeUsed(0.0 < rViewInformation2D.getViewTime());
-const bool 
bVisualizedPageUsed(rViewInformation2D.getVisualizedPage().is());
-const bool 
bReducedDisplayQualityUsed(rViewInformation2D.getReducedDisplayQuality());
-uno::Sequence aPropertyValues;
-
-sal_uInt32 nIndex = 0;
-
-const sal_uInt32 nCount((bObjectTransformationUsed ? 1 : 0) + 
(bViewTransformationUsed ? 1 : 0)
-+ (bViewportUsed ? 1 : 0) + (bTimeUsed ? 1 : 0)
-+ (bVisualizedPageUsed ? 1 : 0) + 
(bReducedDisplayQualityUsed ? 1 : 0));
-
-aPropertyValues.realloc(nCount);
-
-if (bObjectTransformationUsed)
-{
-css::geometry::AffineMatrix2D aAffineMatrix2D;
-basegfx::unotools::affineMatrixFromHomMatrix(aAffineMatrix2D,
- 
rViewInformation2D.getObjectTransformation());
-aPropertyValues[nIndex].Name = g_PropertyName_ObjectTransformation;
-aPropertyValues[nIndex].Value <<= aAffineMatrix2D;
-nIndex++;
-}
-
-if (bViewTransformationUsed)
-{
-css::geometry::AffineMatrix2D aAffineMatrix2D;
-basegfx::unotools::affineMatrixFromHomMatrix(aAffineMatrix2D,
- 
rViewInformation2D.getViewTransformation());
-aPropertyValues[nIndex].Name = g_PropertyName_ViewTransformation;
-aPropertyValues[nIndex].Value <<= aAffineMatrix2D;
-nIndex++;
-}
-
-if (bViewportUsed)
-{
-const css::geometry::RealRectangle2D aViewport(
-
basegfx::unotools::rectangle2DFromB2DRectangle(rViewInformation2D.getViewport()));
-aPropertyValues[nIndex].Name = g_PropertyName_Viewport;
-aPropertyValues[nIndex].Value <<= aViewport;
-nIndex++;
-}
-
-if (bTimeUsed)
-{
-aPropertyValues[nIndex].Name = g_PropertyName_Time;
-aPropertyValues[nIndex].Value <<= rViewInformation2D.getViewTime();
-nIndex++;
-}
-
-if (bVisualizedPageUsed)
-{
-aPropertyValues[nIndex].Name = g_PropertyName_VisualizedPage;
-aPropertyValues[nIndex].Value <<= 
rViewInformation2D.getVisualizedPage();
-nIndex++;
-}
-
-return aPropertyValues;
-}
-
 } // end of namespace drawinglayer::geometry
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx 
b/drawinglayer/source/geometry/viewinformation3d.cxx
index b3e75bffa6dd..bab2e31f9630 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -211,122 +211,6 @@ namespace drawinglayer::geometry
 mxExtendedInformation.realloc(nExtendedInsert);
 }
 
-// central method to create a Sequence of PropertyValues 
containing he complete
-// data set
-void impFillViewInformationFromContent()
-{
-const bool 
bObjectTransformationUsed(!maObjectTransformation.isIdentity());
-const bool bOrientationUsed(!maOrientation.isIdentity());
-const 

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

2021-08-18 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/baseprocessor2d.cxx  |   36 ++-
 include/drawinglayer/processor2d/baseprocessor2d.hxx |7 +++
 2 files changed, 26 insertions(+), 17 deletions(-)

New commits:
commit 2e74c1107bc8422ee7a819722f3f0a366127330f
Author: Noel Grandin 
AuthorDate: Tue Aug 17 16:04:56 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed Aug 18 21:17:19 2021 +0200

use visitor callback to avoid container construction (tdf#105575)

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

diff --git a/drawinglayer/source/processor2d/baseprocessor2d.cxx 
b/drawinglayer/source/processor2d/baseprocessor2d.cxx
index 00d71151e887..a078fe882e9e 100644
--- a/drawinglayer/source/processor2d/baseprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/baseprocessor2d.cxx
@@ -41,28 +41,32 @@ namespace drawinglayer::processor2d
 
 void BaseProcessor2D::process(const primitive2d::BasePrimitive2D& 
rCandidate)
 {
-primitive2d::Primitive2DContainer aContainer;
-rCandidate.get2DDecomposition(aContainer, getViewInformation2D());
-process(aContainer);
+// use the visitor API to avoid the cost of constructing 
Primitive2DContainers
+rCandidate.get2DDecomposition(*this, getViewInformation2D());
 }
 
-void BaseProcessor2D::process(const primitive2d::Primitive2DContainer& 
rSource)
+// Primitive2DDecompositionVisitor
+void BaseProcessor2D::append(const primitive2d::Primitive2DReference& 
rCandidate)
 {
-if(rSource.empty())
-return;
-
-const sal_Int32 nCount(rSource.size());
+const primitive2d::BasePrimitive2D* pBasePrimitive = static_cast< 
const primitive2d::BasePrimitive2D* >(rCandidate.get());
+processBasePrimitive2D(*pBasePrimitive);
+}
+void BaseProcessor2D::append(const primitive2d::Primitive2DContainer& 
rContainer)
+{
+process(rContainer);
+}
+void BaseProcessor2D::append(primitive2d::Primitive2DContainer&& 
rCandidate)
+{
+process(rCandidate);
+}
 
-for(sal_Int32 a(0); a < nCount; a++)
+void BaseProcessor2D::process(const primitive2d::Primitive2DContainer& 
rSource)
+{
+for (const primitive2d::Primitive2DReference& rCandidate : rSource)
 {
-// get reference
-const primitive2d::Primitive2DReference xReference(rSource[a]);
-
-if(xReference.is())
-{
-const primitive2d::BasePrimitive2D* pBasePrimitive = 
static_cast< const primitive2d::BasePrimitive2D* >(xReference.get());
+const primitive2d::BasePrimitive2D* pBasePrimitive = 
static_cast< const primitive2d::BasePrimitive2D* >(rCandidate.get());
+if (pBasePrimitive)
 processBasePrimitive2D(*pBasePrimitive);
-}
 }
 }
 
diff --git a/include/drawinglayer/processor2d/baseprocessor2d.hxx 
b/include/drawinglayer/processor2d/baseprocessor2d.hxx
index 1f0bd46efb62..4f1515109a77 100644
--- a/include/drawinglayer/processor2d/baseprocessor2d.hxx
+++ b/include/drawinglayer/processor2d/baseprocessor2d.hxx
@@ -22,6 +22,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -150,7 +151,7 @@ namespace drawinglayer::processor2d
 be helpful to add many for the purpose not interesting higher 
level primitives
 to not force their decomposition to be created and/or parsed.
  */
-class DRAWINGLAYER_DLLPUBLIC BaseProcessor2D
+class DRAWINGLAYER_DLLPUBLIC BaseProcessor2D : public  
drawinglayer::primitive2d::Primitive2DDecompositionVisitor
 {
 private:
 /// The ViewInformation2D itself. It's private to isolate accesses 
to it
@@ -174,6 +175,10 @@ namespace drawinglayer::processor2d
 
 void process(const primitive2d::BasePrimitive2D& rCandidate);
 
+// Primitive2DDecompositionVisitor
+virtual void append(const primitive2d::Primitive2DReference&) 
override final;
+virtual void append(const primitive2d::Primitive2DContainer&) 
override final;
+virtual void append(primitive2d::Primitive2DContainer&&) override 
final;
 
 public:
 /// constructor/destructor


[Libreoffice-commits] core.git: drawinglayer/source filter/source svx/source

2021-08-13 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/Tools.cxx   |   28 -
 drawinglayer/source/primitive3d/baseprimitive3d.cxx |   25 
 drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx |  333 +---
 drawinglayer/source/processor2d/baseprocessor2d.cxx |   16 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |  106 +--
 drawinglayer/source/processor2d/vclprocessor2d.cxx  |6 
 drawinglayer/source/processor3d/baseprocessor3d.cxx |   15 
 drawinglayer/source/tools/primitive2dxmldump.cxx|4 
 filter/source/svg/svgfilter.cxx |6 
 svx/source/sdr/animation/animationstate.cxx |   26 
 svx/source/svdraw/svdview.cxx   |8 
 11 files changed, 248 insertions(+), 325 deletions(-)

New commits:
commit fa01f5a1feeb93a88a330daeec8177a39916e6a3
Author: Noel Grandin 
AuthorDate: Fri Aug 13 09:05:04 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 13 12:49:00 2021 +0200

tdf#105575 Slow rendering when using a Logo command

Remove dynamic_cast'ing to Primitive2D, expensive and unnecessary

 noelgrandin: nobody is using XPrimtive that is not
derived from BasePrimitive2D in an extension ... mainly as it is
not even possible

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

diff --git a/drawinglayer/source/primitive2d/Tools.cxx 
b/drawinglayer/source/primitive2d/Tools.cxx
index a6321cac1a89..45b2a993b3a7 100644
--- a/drawinglayer/source/primitive2d/Tools.cxx
+++ b/drawinglayer/source/primitive2d/Tools.cxx
@@ -36,22 +36,9 @@ getB2DRangeFromPrimitive2DReference(const 
Primitive2DReference& rCandidate,
 
 if (rCandidate.is())
 {
-// try to get C++ implementation base
-const BasePrimitive2D* 
pCandidate(dynamic_cast(rCandidate.get()));
-
-if (pCandidate)
-{
-// use it if possible
-aRetval.expand(pCandidate->getB2DRange(aViewInformation));
-}
-else
-{
-// use UNO API call instead
-auto aViewParameters = 
geometry::createPropertyValues(aViewInformation);
-
-aRetval.expand(basegfx::unotools::b2DRectangleFromRealRectangle2D(
-rCandidate->getRange(aViewParameters)));
-}
+// get C++ implementation base
+const BasePrimitive2D* 
pCandidate(static_cast(rCandidate.get()));
+aRetval.expand(pCandidate->getB2DRange(aViewInformation));
 }
 
 return aRetval;
@@ -71,13 +58,8 @@ bool arePrimitive2DReferencesEqual(const 
Primitive2DReference& rxA, const Primit
 return true;
 }
 
-const BasePrimitive2D* pA(dynamic_cast(rxA.get()));
-const BasePrimitive2D* pB(dynamic_cast(rxB.get()));
-
-if (!pA || !pB)
-{
-return false;
-}
+const BasePrimitive2D* pA(static_cast(rxA.get()));
+const BasePrimitive2D* pB(static_cast(rxB.get()));
 
 return pA->operator==(*pB);
 }
diff --git a/drawinglayer/source/primitive3d/baseprimitive3d.cxx 
b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
index 4a69c7cc0a73..796f37888e8e 100644
--- a/drawinglayer/source/primitive3d/baseprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
@@ -98,20 +98,8 @@ namespace drawinglayer::primitive3d
 
 if(rCandidate.is())
 {
-// try to get C++ implementation base
-const BasePrimitive3D* pCandidate(dynamic_cast< 
BasePrimitive3D* >(rCandidate.get()));
-
-if(pCandidate)
-{
-// use it if possible
-aRetval.expand(pCandidate->getB3DRange(aViewInformation));
-}
-else
-{
-// use UNO API call instead
-const uno::Sequence< beans::PropertyValue >& 
rViewParameters(aViewInformation.getViewInformationSequence());
-
aRetval.expand(basegfx::unotools::b3DRectangleFromRealRectangle3D(rCandidate->getRange(rViewParameters)));
-}
+const BasePrimitive3D* pCandidate(static_cast< 
BasePrimitive3D* >(rCandidate.get()));
+aRetval.expand(pCandidate->getB3DRange(aViewInformation));
 }
 
 return aRetval;
@@ -149,13 +137,8 @@ namespace drawinglayer::primitive3d
 return true;
 }
 
-const BasePrimitive3D* pA(dynamic_cast< const BasePrimitive3D* 
>(rxA.get()));
-const BasePrimitive3D* pB(dynamic_cast< const BasePrimitive3D* 
>(rxB.get()));
-
-if(!pA || !pB)
-{
-return false;
-}
+const BasePrimitive3D* pA(static_cast< const BasePrimitive3D* 
>(rxA.get()));
+const BasePrimitive3D* pB(static_cast< const BasePrimitive3D* 

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

2021-08-05 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/processor2d/vclhelperbufferdevice.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 0dab89d88f6b42065033f64b69a6e04a31d477d6
Author: Stephan Bergmann 
AuthorDate: Thu Aug 5 08:16:53 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Aug 5 10:05:42 2021 +0200

Remove harmful static_cast

...that were present ever since the code's introduction in
c6df405c6c5e41212d69282d4f632893f108fda2 "#i39532#", but cause
`instdir/program/soffice --headless --convert-to pdf` of doc/abi5309-1.doc 
from
the crash-testing corpus to fail under UBSan with

> drawinglayer/source/processor2d/vclhelperbufferdevice.cxx:278:64: runtime 
error: -3.77964e+18 is outside the range of representable values of type 'int'

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

diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx 
b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
index a0e29d7e6942..5e995ec0627b 100644
--- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
+++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx
@@ -275,10 +275,8 @@ impBufferDevice::impBufferDevice(OutputDevice& rOutDev, 
const basegfx::B2DRange&
 {
 basegfx::B2DRange aRangePixel(rRange);
 aRangePixel.transform(mrOutDev.GetViewTransformation());
-const ::tools::Rectangle 
aRectPixel(static_cast(floor(aRangePixel.getMinX())),
-
static_cast(floor(aRangePixel.getMinY())),
-
static_cast(ceil(aRangePixel.getMaxX())),
-
static_cast(ceil(aRangePixel.getMaxY(;
+const ::tools::Rectangle aRectPixel(floor(aRangePixel.getMinX()), 
floor(aRangePixel.getMinY()),
+ceil(aRangePixel.getMaxX()), 
ceil(aRangePixel.getMaxY()));
 const Point aEmptyPoint;
 maDestPixel = ::tools::Rectangle(aEmptyPoint, 
mrOutDev.GetOutputSizePixel());
 maDestPixel.Intersection(aRectPixel);


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

2021-08-03 Thread Miklos Vajna (via logerrit)
 drawinglayer/source/tools/primitive2dxmldump.cxx   |4 ++-
 svx/qa/unit/data/slide-background.odp  |binary
 svx/qa/unit/data/slide-background.png  |binary
 svx/qa/unit/sdr.cxx|   24 +
 svx/source/sdr/primitive2d/sdrattributecreator.cxx |8 +++
 5 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit c88ff9298b25132fc34102230cef0263f045a523
Author: Miklos Vajna 
AuthorDate: Tue Aug 3 13:39:20 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 3 15:00:22 2021 +0200

tdf#142436 svx: fix handling of linked background images

Regression from commit 9fb7aaf570c03c8a26d763f1205fb8c890e8211a (Make
linked graphic register into LinkedManager again, 2018-04-13), the
problem was that now SvXMLImport::loadGraphicByURL() produces a Graphic
that has its type set to GraphicType::Default, but when
drawinglayer::primitive2d::createNewSdrFillGraphicAttribute() consumes
this graphic, it expects that the type is either a bitmap or a metafile.

Fix the problem by explicitly loading the image when the default-type,
origin-url-set case happens: this is rendering, so no problem to load
the URL and that will give us the expected graphic type.

This is also meant to keep the original problem fixed, since the Graphic
that is part of the doc model is unchanged.

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

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index d48115baafa6..a78b4a894e7a 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -422,7 +422,9 @@ void Primitive2dXmlDump::decomposeAndWrite(
 }
 rWriter.attribute("x", aTranslate.getX());
 rWriter.attribute("y", aTranslate.getY());
-rWriter.attribute("text", 
rTextSimplePortionPrimitive2D.getText());
+OUString aText = rTextSimplePortionPrimitive2D.getText();
+// TODO share code with 
sax_fastparser::FastSaxSerializer::write().
+rWriter.attribute("text", aText.replaceAll("", ""));
 rWriter.attribute("fontcolor", convertColorToString(

rTextSimplePortionPrimitive2D.getFontColor()));
 
diff --git a/svx/qa/unit/data/slide-background.odp 
b/svx/qa/unit/data/slide-background.odp
new file mode 100644
index ..ea62bd63903b
Binary files /dev/null and b/svx/qa/unit/data/slide-background.odp differ
diff --git a/svx/qa/unit/data/slide-background.png 
b/svx/qa/unit/data/slide-background.png
new file mode 100644
index ..3a8c5ceb4262
Binary files /dev/null and b/svx/qa/unit/data/slide-background.png differ
diff --git a/svx/qa/unit/sdr.cxx b/svx/qa/unit/sdr.cxx
index 10f9901a0d60..e6ca7f7a87ad 100644
--- a/svx/qa/unit/sdr.cxx
+++ b/svx/qa/unit/sdr.cxx
@@ -118,6 +118,30 @@ CPPUNIT_TEST_FIXTURE(SdrTest, testZeroWidthTextWrap)
 // i.e. the text on the only shape on the slide had 12 lines, not a single 
one.
 assertXPath(pDocument, "//textsimpleportion", 1);
 }
+
+CPPUNIT_TEST_FIXTURE(SdrTest, testSlideBackground)
+{
+// Given a document with a slide what has a linked background image:
+test::Directories aDirectories;
+OUString aURL = 
aDirectories.getURLFromSrc(u"svx/qa/unit/data/slide-background.odp");
+getComponent() = loadFromDesktop(aURL);
+uno::Reference 
xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+uno::Reference 
xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+
+// When rendering that document:
+drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
+= renderPageToPrimitives(xDrawPage);
+
+// Then make sure that the background has a bitmap:
+drawinglayer::Primitive2dXmlDump aDumper;
+xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
+// Without the accompanying fix in place, this test would have failed with:
+// - Expected: 1
+// - Actual  : 0
+// i.e. the rendering did not find the bitmap.
+assertXPath(pDocument, "//bitmap", 1);
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx 
b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 8b2fa387a836..855bc0daf573 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -58,6 +58,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -656,6 +657,13 @@ namespace drawinglayer::primitive2d
 {
 Graphic 

<    1   2   3   4   5   6   7   >