[Libreoffice-commits] core.git: drawinglayer/source filter/source framework/source include/vcl oox/source sd/source sfx2/source vcl/source

2023-12-03 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx |   12 
 filter/source/graphicfilter/icgm/bitmap.cxx  |2 
 framework/source/uiconfiguration/ImageList.cxx   |2 
 include/vcl/bitmap.hxx   |   29 
 include/vcl/bitmapex.hxx |   29 
 oox/source/export/drawingml.cxx  |2 
 sd/source/ui/view/viewoverlaymanager.cxx |   12 
 sfx2/source/control/recentdocsviewitem.cxx   |2 
 vcl/source/bitmap/BitmapEx.cxx   |   70 --
 vcl/source/bitmap/bitmap.cxx |  518 +++
 vcl/source/graphic/GraphicObject2.cxx|2 
 vcl/source/window/menubarwindow.cxx  |2 
 12 files changed, 363 insertions(+), 319 deletions(-)

New commits:
commit 29fc0ec9930fc1c09c0e79d41c56f93ae853c054
Author: Noel Grandin 
AuthorDate: Sat Dec 2 22:27:34 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Dec 3 17:39:43 2023 +0100

Split the *Bitmap::CopyPixel functions

into the two entire separate cases they want to handle, there is
no reason to mix the two different cases like this.

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

diff --git a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx 
b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
index 4789cc30cfdd..3d738cd09c99 100644
--- a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
+++ b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
@@ -68,15 +68,15 @@ void takeCareOfOffsetXY(
 const tools::Rectangle aSrcDst(Point(), rSize);
 aTarget.CopyPixel(aSrcDst, // Dst
   aSrcDst, // Src
-  );
+  rTarget);
 const Size aSizeA(b, h);
 aTarget.CopyPixel(tools::Rectangle(Point(0, h), aSizeA), // Dst
   tools::Rectangle(Point(a, 0), aSizeA), // Src
-  );
+  rTarget);
 const Size aSizeB(a, h);
 aTarget.CopyPixel(tools::Rectangle(Point(b, h), aSizeB), // Dst
   tools::Rectangle(Point(), aSizeB), // Src
-  );
+  rTarget);
 
 setOffsetXYCreatedBitmap(
 
const_cast(
@@ -111,15 +111,15 @@ void takeCareOfOffsetXY(
 const tools::Rectangle aSrcDst(Point(), rSize);
 aTarget.CopyPixel(aSrcDst, // Dst
   aSrcDst, // Src
-  );
+  rTarget);
 const Size aSizeA(w, b);
 aTarget.CopyPixel(tools::Rectangle(Point(w, 0), aSizeA), // Dst
   tools::Rectangle(Point(0, a), aSizeA), // Src
-  );
+  rTarget);
 const Size aSizeB(w, a);
 aTarget.CopyPixel(tools::Rectangle(Point(w, b), aSizeB), // Dst
   tools::Rectangle(Point(), aSizeB), // Src
-  );
+  rTarget);
 
 setOffsetXYCreatedBitmap(
 
const_cast(
diff --git a/filter/source/graphicfilter/icgm/bitmap.cxx 
b/filter/source/graphicfilter/icgm/bitmap.cxx
index f747c0af651d..f7fea35f3583 100644
--- a/filter/source/graphicfilter/icgm/bitmap.cxx
+++ b/filter/source/graphicfilter/icgm/bitmap.cxx
@@ -393,7 +393,7 @@ void CGMBitmap::ImplInsert( CGMBitmapDescriptor const & 
rSource, CGMBitmapDescri
 }
 rDest.mxBitmap.Expand( 0, rSource.mnY );
 rDest.mxBitmap.CopyPixel( tools::Rectangle( Point( 0, rDest.mnY ), Size( 
rSource.mnX, rSource.mnY ) ),
-tools::Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), 
 );
+tools::Rectangle( Point( 0, 0 ), Size( rSource.mnX, rSource.mnY ) ), 
rSource.mxBitmap );
 
 if ( ( rSource.mnR.Y == rDest.mnQ.Y ) && ( rSource.mnR.X == rDest.mnQ.X ) )
 {   // Insert on Bottom
diff --git a/framework/source/uiconfiguration/ImageList.cxx 
b/framework/source/uiconfiguration/ImageList.cxx
index 0e64d219c166..5fb0f44f65b6 100644
--- a/framework/source/uiconfiguration/ImageList.cxx
+++ b/framework/source/uiconfiguration/ImageList.cxx
@@ -56,7 +56,7 @@ BitmapEx ImageList::GetAsHorizontalStrip() const
 tools::Rectangle aDestRect( Point( nIdx * aImageSize.Width(), 0 ), 
aImageSize );
 ImageAryData *pData = maImages[ nIdx ].get();
 BitmapEx aTmp = pData->maImage.GetBitmapEx();
-aResult.CopyPixel( aDestRect, aSrcRect, );
+

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

2023-12-03 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |4 ++--
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.hxx |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f8610622068edc0d69854fb44546fae7245a9568
Author: Noel Grandin 
AuthorDate: Sat Dec 2 22:30:07 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Dec 3 16:36:18 2023 +0100

ProcessAndBlurAlphaMask should take an AlphaMask as param

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

diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index bcd5f779af79..ee4b6d4cb14f 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -30,12 +30,12 @@ namespace drawinglayer::primitive2d
Negative fErodeDilateRadius values mean erode, positive - dilate.
nTransparency defines minimal transparency level.
 */
-AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius,
+AlphaMask ProcessAndBlurAlphaMask(const AlphaMask& rMask, double 
fErodeDilateRadius,
   double fBlurRadius, sal_uInt8 nTransparency, 
bool bConvertTo1Bit)
 {
 // Invert it to operate in the transparency domain. Trying to update this 
method to
 // work in the alpha domain is fraught with hazards.
-Bitmap tmpMask = rMask;
+AlphaMask tmpMask = rMask;
 tmpMask.Invert();
 
 // Only completely white pixels on the initial mask must be considered for 
transparency. Any
diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.hxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.hxx
index 61079728d841..b6a62be8863e 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.hxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.hxx
@@ -29,7 +29,7 @@ namespace drawinglayer::primitive2d
Negative fErodeDilateRadius values mean erode, positive - dilate.
nTransparency defines minimal transparency level.
 */
-AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius,
+AlphaMask ProcessAndBlurAlphaMask(const AlphaMask& rMask, double 
fErodeDilateRadius,
   double fBlurRadius, sal_uInt8 nTransparency,
   bool bConvertTo1Bit = true);
 


[Libreoffice-commits] core.git: drawinglayer/source filter/source helpcompiler/source include/xmloff sax/source sc/source unoxml/source xmloff/source xmlsecurity/inc

2023-11-27 Thread Miklos Vajna (via logerrit)
 drawinglayer/source/tools/primitive2dxmldump.cxx |1 +
 filter/source/xsltfilter/LibXSLTTransformer.cxx  |2 +-
 helpcompiler/source/HelpLinker.cxx   |4 
 include/xmloff/xmltoken.hxx  |2 +-
 sax/source/fastparser/fastparser.cxx |2 +-
 sc/source/core/tool/interpr7.cxx |1 +
 sc/source/filter/xml/XMLExportDataPilot.cxx  |2 +-
 sc/source/filter/xml/XMLExportDatabaseRanges.cxx |2 +-
 sc/source/filter/xml/xmlfilti.cxx|6 +++---
 unoxml/source/dom/attr.cxx   |1 +
 unoxml/source/dom/document.cxx   |1 +
 unoxml/source/dom/documentbuilder.cxx|1 +
 unoxml/source/dom/entity.cxx |1 +
 unoxml/source/xpath/xpathapi.cxx |7 ++-
 xmloff/source/core/xmltoken.cxx  |2 +-
 xmloff/source/style/PageMasterStyleMap.cxx   |2 +-
 xmlsecurity/inc/xmlsec-wrapper.h |1 +
 xmlsecurity/inc/xmlsec/saxhelper.hxx |1 +
 18 files changed, 28 insertions(+), 11 deletions(-)

New commits:
commit c8f7408db73d2f2ccacb25a2b4fef8dfebdfc6cb
Author: Miklos Vajna 
AuthorDate: Mon Nov 27 08:02:59 2023 +0100
Commit: Miklos Vajna 
CommitDate: Mon Nov 27 16:09:13 2023 +0100

tdf#158302 fix build against system-libxml-2.12

Seen in a fedora:40 container, using --with-system-libcmis,
--with-system-liblangtag and --with-system-xmlsec.

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

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 76aefec902ea..f3b9ef1bc919 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -15,6 +15,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx 
b/filter/source/xsltfilter/LibXSLTTransformer.cxx
index 1a7c34805f1b..5e9a7c4bcd35 100644
--- a/filter/source/xsltfilter/LibXSLTTransformer.cxx
+++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx
@@ -333,7 +333,7 @@ namespace XSLT
 }
 else
 {
-xmlErrorPtr lastErr = xmlGetLastError();
+const xmlError* lastErr = xmlGetLastError();
 OUString msg;
 if (lastErr)
 msg = OStringToOUString(lastErr->message, 
RTL_TEXTENCODING_UTF8);
diff --git a/helpcompiler/source/HelpLinker.cxx 
b/helpcompiler/source/HelpLinker.cxx
index 3d52834dbe6b..898a8b26392a 100644
--- a/helpcompiler/source/HelpLinker.cxx
+++ b/helpcompiler/source/HelpLinker.cxx
@@ -815,7 +815,11 @@ static const HelpProcessingException* 
GpXMLParsingException = nullptr;
 
 extern "C" {
 
+#if LIBXML_VERSION >= 21200
+static void StructuredXMLErrorFunction(SAL_UNUSED_PARAMETER void *, const 
xmlError* error)
+#else
 static void StructuredXMLErrorFunction(SAL_UNUSED_PARAMETER void *, 
xmlErrorPtr error)
+#endif
 {
 std::string aErrorMsg = error->message;
 std::string aXMLParsingFile;
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 4e6441841774..ba42fae4d035 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -744,7 +744,7 @@ namespace xmloff::token {
 XML_EMBEDDED_VISIBLE_AREA,
 XML_EMBOSSED,
 XML_EMISSIVE_COLOR,
-XML_EMPTY,
+XML_TOKEN_EMPTY,
 XML_EMPTY_LINE_REFRESH,
 XML_ENABLE_NUMBERING,
 XML_ENABLED,
diff --git a/sax/source/fastparser/fastparser.cxx 
b/sax/source/fastparser/fastparser.cxx
index ec8065016a12..e0338e053cf0 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -578,7 +578,7 @@ Event& Entity::getEvent( CallbackType aType )
 OUString lclGetErrorMessage( xmlParserCtxtPtr ctxt, std::u16string_view 
sSystemId, sal_Int32 nLine )
 {
 const char* pMessage;
-xmlErrorPtr error = xmlCtxtGetLastError( ctxt );
+const xmlError* error = xmlCtxtGetLastError( ctxt );
 if( error && error->message )
 pMessage = error->message;
 else
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index 352c7cf70e45..ecb4ea346396 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace com::sun::star;
 
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx 
b/sc/source/filter/xml/XMLExportDataPilot.cxx
index da65bec0dab7..bd5f16d828ff 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -123,7 +123,7 @@ void ScXMLExportDataPilot::WriteDPCondition(const 
ScQueryEntry& aQueryEntry, boo
 
 if (aQueryEntry.IsQueryByEmpty())
 {
-

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

2023-11-20 Thread Patrick Luby (via logerrit)
 drawinglayer/source/tools/converters.cxx |   15 +++
 1 file changed, 15 insertions(+)

New commits:
commit 9a0dad2a649066a10ace53a06d563596330199a0
Author: Patrick Luby 
AuthorDate: Mon Nov 20 14:01:32 2023 -0500
Commit: Noel Grandin 
CommitDate: Tue Nov 21 07:13:17 2023 +0100

tdf#157558 invert and remove blended white color

Before commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
RemoveBlendedStartColor(COL_BLACK, aAlpha) would darken
the bitmap when running a slideshow, printing, or exporting
to PDF. To get the same effect, the alpha mask must be
inverted, RemoveBlendedStartColor(COL_WHITE, aAlpha)
called, and the alpha mask uninverted.

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

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 56fe2fb91791..3e32af49c508 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -268,7 +268,22 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 // Now that vcl supports bitmaps with an alpha channel, only apply
 // this correction to bitmaps without an alpha channel.
 if (pContent->GetBitCount() < 32)
+{
 aRetval.RemoveBlendedStartColor(COL_BLACK, aAlpha);
+}
+else
+{
+// tdf#157558 invert and remove blended white color
+// Before commit 81994cb2b8b32453a92bcb011830fcb884f22ff3,
+// RemoveBlendedStartColor(COL_BLACK, aAlpha) would darken
+// the bitmap when running a slideshow, printing, or exporting
+// to PDF. To get the same effect, the alpha mask must be
+// inverted, RemoveBlendedStartColor(COL_WHITE, aAlpha)
+// called, and the alpha mask uninverted.
+aAlpha.Invert();
+aRetval.RemoveBlendedStartColor(COL_WHITE, aAlpha);
+aAlpha.Invert();
+}
 // return combined result
 return BitmapEx(aRetval, aAlpha);
 }


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

2023-11-04 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |   10 +-
 drawinglayer/source/primitive2d/glowprimitive2d.cxx |6 --
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx |4 
 3 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit cfd7cffb00f9f4ee934006a706184fefc8cb8d9d
Author: Noel Grandin 
AuthorDate: Fri Nov 3 10:12:57 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Nov 5 06:32:17 2023 +0100

tdf#158014 Skia adds filled white areas in .svg when exporting to PDF

So my strategy here is to assume that ProcessAndBlurAlphaMask
was doing the right thing before
commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
Date:   Fri Apr 16 20:33:10 2021 +0200
Convert internal vcl bitmap formats transparency->alpha (II)
but the subsequent naiving changing of its logic undermines it
because of some subtle interaction.

So take the brute force approach of reverting most of the code
to its prior state (i.e. working in the transparency domain),
and doing an Invert() before and after the original code.

This seems to fix all of the test files I have on hand
for this situation for both Skia and non-Skia cases.

Change-Id: If4c4d4c5351a4ec55897bed96b57d28eda88f5dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158793
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index 298713517d2f..bcd5f779af79 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -33,9 +33,14 @@ namespace drawinglayer::primitive2d
 AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius,
   double fBlurRadius, sal_uInt8 nTransparency, 
bool bConvertTo1Bit)
 {
+// Invert it to operate in the transparency domain. Trying to update this 
method to
+// work in the alpha domain is fraught with hazards.
+Bitmap tmpMask = rMask;
+tmpMask.Invert();
+
 // 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(bConvertTo1Bit ? rMask.CreateMask(COL_BLACK) : rMask);
+BitmapEx mask(bConvertTo1Bit ? tmpMask.CreateMask(COL_WHITE) : tmpMask);
 
 // Scaling down increases performance without noticeable quality loss. 
Additionally,
 // current blur implementation can only handle blur radius between 2 and 
254.
@@ -71,6 +76,9 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius
 
 mask.Scale(rMask.GetSizePixel());
 
+// And switch to the alpha domain.
+mask.Invert();
+
 return AlphaMask(mask.GetBitmap());
 }
 
diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index c49ea68c9089..fb1a12fa1421 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -209,12 +209,6 @@ void GlowPrimitive2D::create2DDecomposition(
fDiscreteGlowRadius * 
fScale / 2.0,
255 - 
getGlowColor().GetAlpha()));
 
-// tdf#157502 and tdf#157652 invert alpha mask
-// Due to the switch from transparency to alpha in commit
-// 81994cb2b8b32453a92bcb011830fcb884f22ff3, invert the alpha
-// mask.
-mask.Invert();
-
 // The end result is the bitmap filled with glow color and blurred 
8-bit alpha mask
 Bitmap bmp(aAlpha.GetSizePixel(), vcl::PixelFormat::N24_BPP);
 bmp.Erase(getGlowColor());
diff --git a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx 
b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
index bfd8ebf71656..87e60467f1ac 100644
--- a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
@@ -206,10 +206,6 @@ void SoftEdgePrimitive2D::create2DDecomposition(
 break;
 AlphaMask blurMask(drawinglayer::primitive2d::ProcessAndBlurAlphaMask(
 aMask, -fDiscreteSoftRadius * fScale, fDiscreteSoftRadius * 
fScale, 0));
-// tdf#157086 invert the blur mask instead of the alpha mask
-// An invert is needed to fix tdf#156808 but inverting the alpha mask
-// causes tdf#157086 so invert the blur mask instead.
-blurMask.Invert();
 aMask.BlendWith(blurMask);
 
 // The end result is the original bitmap with blurred 8-bit alpha mask


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

2023-10-28 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 4a4e8a7aa2c9631f199014c125a1a926d327a005
Author: Bartosz Kosiorek 
AuthorDate: Sat Oct 28 21:55:59 2023 +0200
Commit: Bartosz Kosiorek 
CommitDate: Sat Oct 28 14:06:28 2023 +0200

Fix variable names according to documentation

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

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index b5b7d911476f..26b7563fec80 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1076,14 +1076,15 @@ namespace emfplushelper
 {
 case EmfPlusRecordTypeHeader:
 {
-sal_uInt32 header, version;
+sal_uInt32 version, emfPlusFlags;
+SAL_INFO("drawinglayer.emf", "EMF+\tDual: " << ((flags 
& 1) ? "true" : "false"));
 
-
rMS.ReadUInt32(header).ReadUInt32(version).ReadUInt32(mnHDPI).ReadUInt32(mnVDPI);
-SAL_INFO("drawinglayer.emf", "EMF+\tHeader: 0x" << 
std::hex << header);
-SAL_INFO("drawinglayer.emf", "EMF+\tVersion: " << 
std::dec << version);
+
rMS.ReadUInt32(version).ReadUInt32(emfPlusFlags).ReadUInt32(mnHDPI).ReadUInt32(mnVDPI);
+SAL_INFO("drawinglayer.emf", "EMF+\tVersion: 0x" << 
std::hex << version);
+SAL_INFO("drawinglayer.emf", "EMF+\tEmf+ Flags: 0x"  
<< emfPlusFlags << std::dec);
+SAL_INFO("drawinglayer.emf", "EMF+\tMetafile was 
recorded with a reference device context for " << ((emfPlusFlags & 1) ? "video 
display" : "printer"));
 SAL_INFO("drawinglayer.emf", "EMF+\tHorizontal DPI: " 
<< mnHDPI);
 SAL_INFO("drawinglayer.emf", "EMF+\tVertical DPI: " << 
mnVDPI);
-SAL_INFO("drawinglayer.emf", "EMF+\tDual: " << ((flags 
& 1) ? "true" : "false"));
 break;
 }
 case EmfPlusRecordTypeEndOfFile:


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

2023-10-26 Thread Noel Grandin (via logerrit)
 drawinglayer/source/tools/converters.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 6eb4cce433e5c4e905910d6dfdf6fc15065a9d3e
Author: Noel Grandin 
AuthorDate: Thu Oct 26 11:05:05 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Oct 26 15:46:10 2023 +0200

tdf#157083 Artifacts in logos (gen)

regression from commit
commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
Author: Noel Grandin 
Date:   Fri Apr 16 20:33:10 2021 +0200
Convert internal vcl bitmap formats transparency->alpha (II)

Change-Id: I1c269bcfa9b565258bc99c2810e960ae965f9b54
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158491
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 9283f7db779f..56fe2fb91791 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -268,7 +268,7 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 // Now that vcl supports bitmaps with an alpha channel, only apply
 // this correction to bitmaps without an alpha channel.
 if (pContent->GetBitCount() < 32)
-aRetval.RemoveBlendedStartColor(COL_WHITE, aAlpha);
+aRetval.RemoveBlendedStartColor(COL_BLACK, aAlpha);
 // return combined result
 return BitmapEx(aRetval, aAlpha);
 }


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

2023-10-19 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 26b63f4f2f71a48dc0a9be3356da88f8b5f143dc
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:11 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 19 19:56:49 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: drawinglayer

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 084cc0bef17e..193f5cdad31a 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1083,7 +1083,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 uno::Reference xPropertyInfo(
 xModelProperties.is() ? xModelProperties->getPropertySetInfo()
   : 
uno::Reference());
-static constexpr OUStringLiteral 
sPrintablePropertyName(u"Printable");
+static constexpr OUString 
sPrintablePropertyName(u"Printable"_ustr);
 
 if (xPropertyInfo.is() && 
xPropertyInfo->hasPropertyByName(sPrintablePropertyName))
 {
@@ -1264,7 +1264,7 @@ void 
VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(
 {
 // support for FIELD_SEQ_BEGIN, FIELD_SEQ_END and URL. It wraps text 
primitives (but is not limited to)
 // thus do the MetafileAction embedding stuff but just handle recursively.
-static constexpr OStringLiteral aCommentStringCommon("FIELD_SEQ_BEGIN");
+static constexpr OString aCommentStringCommon("FIELD_SEQ_BEGIN"_ostr);
 OUString aURL;
 
 switch (rFieldPrimitive.getType())
@@ -1358,7 +1358,7 @@ void 
VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D(
 void VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D(
 const primitive2d::TextHierarchyParagraphPrimitive2D& rParagraphPrimitive)
 {
-static constexpr OStringLiteral aCommentString("XTEXT_EOP");
+static constexpr OString aCommentString("XTEXT_EOP"_ostr);
 static bool bSuppressPDFExtOutDevDataSupport(false); // 
loplugin:constvars:ignore
 
 if (nullptr == mpPDFExtOutDevData || bSuppressPDFExtOutDevDataSupport)


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

2023-10-12 Thread Michael Stahl (via logerrit)
 drawinglayer/source/primitive2d/controlprimitive2d.cxx |4 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   20 
 include/drawinglayer/primitive2d/controlprimitive2d.hxx|8 +
 svx/source/sdr/contact/viewcontactofunocontrol.cxx |9 +
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx   |   10 +-
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   63 +
 6 files changed, 109 insertions(+), 5 deletions(-)

New commits:
commit d5c19ef9d30cde052e8cd2486ac9395e62d9c9a9
Author: Michael Stahl 
AuthorDate: Wed Oct 11 19:13:53 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Oct 12 11:54:51 2023 +0200

drawinglayer,svx: PDF/UA export: put Form SE into anchor paragraph SE

This is like commit d467f1aa3d028f399826c97e2eecedcd79efcf65
and commit 6e5d59c2ca6969e9491f97cd7a00d094fc62cfb3 but for the
form controls, which have their own special ControlPrimitive2D.

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

diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx 
b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 372fb61244a0..c8448efa981f 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -243,10 +243,12 @@ namespace drawinglayer::primitive2d
 uno::Reference< awt::XControlModel > xControlModel,
 uno::Reference xXControl,
 ::std::u16string_view const rTitle,
-::std::u16string_view const rDescription)
+::std::u16string_view const rDescription,
+void const*const pAnchorKey)
 :   maTransform(std::move(aTransform)),
 mxControlModel(std::move(xControlModel)),
 mxXControl(std::move(xXControl))
+, m_pAnchorStructureElementKey(pAnchorKey)
 {
 ::rtl::OUStringBuffer buf(rTitle);
 if (!rTitle.empty() && !rDescription.empty())
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index d87c70c7e772..084cc0bef17e 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1102,6 +1102,18 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 if (!bIsPrintableControl)
 return;
 
+::std::optional oAnchorParent;
+if (mpPDFExtOutDevData)
+{
+if (rControlPrimitive.GetAnchorStructureElementKey())
+{
+sal_Int32 const id = mpPDFExtOutDevData->EnsureStructureElement(
+rControlPrimitive.GetAnchorStructureElementKey());
+
oAnchorParent.emplace(mpPDFExtOutDevData->GetCurrentStructureElement());
+mpPDFExtOutDevData->SetCurrentStructureElement(id);
+}
+}
+
 const bool bPDFExport(mpPDFExtOutDevData && 
mpPDFExtOutDevData->GetIsExportFormFields());
 bool bDoProcessRecursively(true);
 
@@ -1154,6 +1166,10 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 }
 mpPDFExtOutDevData->CreateControl(*pPDFControl);
 mpPDFExtOutDevData->EndStructureElement();
+if (oAnchorParent)
+{
+mpPDFExtOutDevData->SetCurrentStructureElement(*oAnchorParent);
+}
 
 // no normal paint needed (see original 
UnoControlPDFExportContact::do_PaintObject);
 // do not process recursively
@@ -1236,6 +1252,10 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 if (mpPDFExtOutDevData)
 {
 mpPDFExtOutDevData->EndStructureElement();
+if (oAnchorParent)
+{
+mpPDFExtOutDevData->SetCurrentStructureElement(*oAnchorParent);
+}
 }
 }
 
diff --git a/include/drawinglayer/primitive2d/controlprimitive2d.hxx 
b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
index e33c26886cd9..a7128b7f7322 100644
--- a/include/drawinglayer/primitive2d/controlprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
@@ -58,6 +58,9 @@ private:
 /// yet another special snowflake way to generate PDF Alt text
 OUString m_AltText;
 
+/// anchor structure element (Writer)
+void const* const m_pAnchorStructureElementKey;
+
 /** used from getXControl() to create a local awt::XControl which is 
remembered in mxXControl
 and from thereon always used and returned by getXControl()
  */
@@ -81,7 +84,8 @@ public:
 ControlPrimitive2D(basegfx::B2DHomMatrix aTransform,
css::uno::Reference 
xControlModel,
css::uno::Reference xXControl,
-   ::std::u16string_view rTitle, ::std::u16string_view 
rDescription);
+   ::std::u16string_view 

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

2023-10-09 Thread Patrick Luby (via logerrit)
 drawinglayer/source/primitive2d/glowprimitive2d.cxx |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit c3073c81223e9bf0f499d9fd3cfa8a7e8cb497a5
Author: Patrick Luby 
AuthorDate: Mon Oct 9 11:38:00 2023 -0400
Commit: Noel Grandin 
CommitDate: Mon Oct 9 20:56:33 2023 +0200

tdf#157502 and tdf#157652 invert alpha mask

Due to the switch from transparency to alpha in commit
81994cb2b8b32453a92bcb011830fcb884f22ff3, invert the alpha
mask.

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

diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index 8504b1a902a8..c49ea68c9089 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -205,9 +205,15 @@ void GlowPrimitive2D::create2DDecomposition(
 // When blurring a sharp boundary (our case), it gets 50% of 
original intensity, and
 // 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(aAlpha, 
fDiscreteGlowRadius * fScale / 2.0,
- fDiscreteGlowRadius * 
fScale / 2.0,
- 255 - 
getGlowColor().GetAlpha()));
+AlphaMask mask(ProcessAndBlurAlphaMask(aAlpha, fDiscreteGlowRadius 
* fScale / 2.0,
+   fDiscreteGlowRadius * 
fScale / 2.0,
+   255 - 
getGlowColor().GetAlpha()));
+
+// tdf#157502 and tdf#157652 invert alpha mask
+// Due to the switch from transparency to alpha in commit
+// 81994cb2b8b32453a92bcb011830fcb884f22ff3, invert the alpha
+// mask.
+mask.Invert();
 
 // The end result is the bitmap filled with glow color and blurred 
8-bit alpha mask
 Bitmap bmp(aAlpha.GetSizePixel(), vcl::PixelFormat::N24_BPP);


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

2023-10-09 Thread Pranam Lashkari (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit cf17d5384cc8e254684bc1423176ad8562d49bee
Author: Pranam Lashkari 
AuthorDate: Mon Jun 26 22:28:06 2023 +0700
Commit: Pranam Lashkari 
CommitDate: Mon Oct 9 19:12:34 2023 +0200

vcl: render scaled fonts for LOK

problem:
In  online calc when fonts are not scaled, text box disappears when not 
active

Change-Id: I9c8fdb3c0d14a3e7ed502ddb2b46c0769a855280
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153624
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 
(cherry picked from commit 6460c685c3bc3f4929263c7681080056b59948fe)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153654
Tested-by: Jenkins
Reviewed-by: Pranam Lashkari 

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 3ad89f1cab63..2c3521ace0dd 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -23,6 +23,7 @@
 #include "vclhelperbufferdevice.hxx"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -162,7 +163,8 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 
 // tdf#153092 Ideally we don't have to scale the font and dxarray, 
but we might have
 // to nevertheless if dealing with non integer sizes
-const bool bScaleFont(aFontSize.getY() != 
std::round(aFontSize.getY()));
+const bool bScaleFont(aFontSize.getY() != 
std::round(aFontSize.getY())
+  || comphelper::LibreOfficeKit::isActive());
 vcl::Font aFont;
 
 // Get the VCL font


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

2023-10-04 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   10 -
 sw/source/core/text/EnhancedPDFExportHelper.cxx|   10 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   77 -
 vcl/source/gdi/pdfextoutdevdata.cxx|3 
 4 files changed, 91 insertions(+), 9 deletions(-)

New commits:
commit a8f522f4257729ea11178ebf165fdd3a2b7be240
Author: Michael Stahl 
AuthorDate: Mon Oct 2 20:33:42 2023 +0200
Commit: Michael Stahl 
CommitDate: Wed Oct 4 11:42:58 2023 +0200

vcl,drawinglayer,sw: PDF/UA export: footnote-container-in-list problem

The problem is that if there is a footnote in a list, the footnote
container becomes a child of the LI element that contains the footnote
anchor, which is of course nonsense.

This is because SwTaggedPDFHelper::CheckReopenTag() stopped using
SetCurrentStructureElement(), but unfortunately it's required so that
once the list ends, the correct parent element is restored for whatever
follows the list.

There is a similar problem in VclMetafileProcessor2D.

(regression from commit d467f1aa3d028f399826c97e2eecedcd79efcf65)

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 1a7beb8affc6..d87c70c7e772 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2527,7 +2527,7 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 // structured tag primitive
 const vcl::PDFWriter::StructElement& 
rTagElement(rStructureTagCandidate.getStructureElement());
 bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement));
-bool bNeedEndAnchor(false);
+::std::optional oAnchorParent;
 
 if (!rStructureTagCandidate.isTaggedSdrObject())
 {
@@ -2543,8 +2543,8 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 {
 sal_Int32 const id = 
mpPDFExtOutDevData->EnsureStructureElement(
 rStructureTagCandidate.GetAnchorStructureElementKey());
-mpPDFExtOutDevData->BeginStructureElement(id);
-bNeedEndAnchor = true;
+
oAnchorParent.emplace(mpPDFExtOutDevData->GetCurrentStructureElement());
+mpPDFExtOutDevData->SetCurrentStructureElement(id);
 }
 mpPDFExtOutDevData->WrapBeginStructureElement(rTagElement);
 switch (rTagElement)
@@ -2620,9 +2620,9 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 {
 // write end tag
 mpPDFExtOutDevData->EndStructureElement();
-if (bNeedEndAnchor)
+if (oAnchorParent)
 {
-mpPDFExtOutDevData->EndStructureElement();
+mpPDFExtOutDevData->SetCurrentStructureElement(*oAnchorParent);
 }
 }
 }
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx 
b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 3103b3fe9ef8..9ebc233dc687 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -458,7 +458,15 @@ bool SwTaggedPDFHelper::CheckReopenTag()
 
 if (pReopenKey)
 {
-OpenTagImpl(pReopenKey);
+// note: it would be possible to get rid of the 
SetCurrentStructureElement()
+// - which is quite ugly - for most cases by recreating the parents 
until the
+// current ancestor, but there are special cases cell frame rowspan > 
1 follow
+// and footnote frame follow where the parent of the follow is 
different from
+// the parent of the first one, and so in PDFExtOutDevData the wrong 
parent
+// would be restored and used for next elements.
+m_nRestoreCurrentTag = 
mpPDFExtOutDevData->GetCurrentStructureElement();
+sal_Int32 const id = 
mpPDFExtOutDevData->EnsureStructureElement(pReopenKey);
+mpPDFExtOutDevData->SetCurrentStructureElement(id);
 
 bRet = true;
 }
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index a07ceeb53eae..9709d9c57313 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -3733,7 +3733,7 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testSpans)
 CPPUNIT_ASSERT(pKids1);
 // assume there are no MCID ref at this level
 auto vKids1 = pKids1->GetElements();
-CPPUNIT_ASSERT_EQUAL(size_t(1), vKids1.size());
+CPPUNIT_ASSERT_EQUAL(size_t(2), vKids1.size());
 auto pRefKid10 = 
dynamic_cast(vKids1[0]);
 CPPUNIT_ASSERT(pRefKid10);
 auto pObject10 = 

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

2023-09-13 Thread Patrick Luby (via logerrit)
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx |7 ++-
 drawinglayer/source/tools/converters.cxx|4 ++--
 include/drawinglayer/converters.hxx |8 
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 4942aa1533af25cf102da7516bd5e521c553aa07
Author: Patrick Luby 
AuthorDate: Wed Sep 13 18:52:29 2023 -0400
Commit: Patrick Luby 
CommitDate: Thu Sep 14 01:52:22 2023 +0200

tdf#156808 force an alpha mask to be created even if it has no alpha

We need an alpha mask, even if it is totally opaque, so that
drawinglayer::primitive2d::ProcessAndBlurAlphaMask() can be called.
Otherwise, blurring of edges will fail in cases like running in a
slideshow or exporting to PDF.

Change-Id: If03b32a8a22ed960f1475710a9831cab33799b60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156903
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx 
b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
index 89e1fd545fcb..bfd8ebf71656 100644
--- a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
@@ -166,9 +166,14 @@ void SoftEdgePrimitive2D::create2DDecomposition(
 const sal_uInt32 
nDiscreteClippedHeight(ceil(aDiscreteClippedSize.getY()));
 const geometry::ViewInformation2D aViewInformation2D;
 const sal_uInt32 nMaximumQuadraticPixels(25);
+// tdf#156808 force an alpha mask to be created even if it has no alpha
+// We need an alpha mask, even if it is totally opaque, so that
+// drawinglayer::primitive2d::ProcessAndBlurAlphaMask() can be called.
+// Otherwise, blurring of edges will fail in cases like running in a
+// slideshow or exporting to PDF.
 const BitmapEx aBitmapEx(::drawinglayer::convertToBitmapEx(
 std::move(xEmbedSeq), aViewInformation2D, nDiscreteClippedWidth, 
nDiscreteClippedHeight,
-nMaximumQuadraticPixels));
+nMaximumQuadraticPixels, true));
 
 if (aBitmapEx.IsEmpty())
 break;
diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 80ae15a3b6a9..9283f7db779f 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -156,7 +156,7 @@ AlphaMask 
createAlphaMask(drawinglayer::primitive2d::Primitive2DContainer&& rSeq
 BitmapEx convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& 
rSeq,
const geometry::ViewInformation2D& 
rViewInformation2D,
sal_uInt32 nDiscreteWidth, sal_uInt32 
nDiscreteHeight,
-   sal_uInt32 nMaxSquarePixels)
+   sal_uInt32 nMaxSquarePixels, bool 
bForceAlphaMaskCreation)
 {
 drawinglayer::primitive2d::Primitive2DContainer aSequence(std::move(rSeq));
 
@@ -261,7 +261,7 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
 }
 #endif
 
-if (aAlpha.hasAlpha())
+if (bForceAlphaMaskCreation || aAlpha.hasAlpha())
 {
 // Need to correct content using known alpha to get to background-free
 // RGBA result, usable e.g. in PNG export(s) or convert-to-bitmap.
diff --git a/include/drawinglayer/converters.hxx 
b/include/drawinglayer/converters.hxx
index 0b4a5649874e..d090b1e0a921 100644
--- a/include/drawinglayer/converters.hxx
+++ b/include/drawinglayer/converters.hxx
@@ -38,10 +38,10 @@ AlphaMask DRAWINGLAYER_DLLPUBLIC createAlphaMask(
 
 // Helper for convertPrimitive2DContainerToBitmapEx below, but can be also used
 // directly
-BitmapEx DRAWINGLAYER_DLLPUBLIC
-convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSeq,
-  const geometry::ViewInformation2D& rViewInformation2D, 
sal_uInt32 nDiscreteWidth,
-  sal_uInt32 nDiscreteHeight, sal_uInt32 nMaxSquarePixels);
+BitmapEx DRAWINGLAYER_DLLPUBLIC convertToBitmapEx(
+drawinglayer::primitive2d::Primitive2DContainer&& rSeq,
+const geometry::ViewInformation2D& rViewInformation2D, sal_uInt32 
nDiscreteWidth,
+sal_uInt32 nDiscreteHeight, sal_uInt32 nMaxSquarePixels, bool 
bForceAlphaMaskCreation = false);
 
 // helper to convert any Primitive2DSequence to a good quality BitmapEx,
 // using default parameters


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

2023-09-12 Thread Patrick Luby (via logerrit)
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx |7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 798de29936b9a0c618bd31629936a4c836429e90
Author: Patrick Luby 
AuthorDate: Tue Sep 12 10:51:22 2023 -0400
Commit: Patrick Luby 
CommitDate: Tue Sep 12 20:51:48 2023 +0200

tdf#157086 invert the blur mask instead of the alpha mask

An invert is needed to fix tdf#156808 but inverting the alpha mask
causes tdf#157086 so invert the blur mask instead.

Change-Id: Id695d04f008932caadb0fc2b477b0a4b152fa66c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156854
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx 
b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
index 1da2f688d739..89e1fd545fcb 100644
--- a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
@@ -199,10 +199,13 @@ void SoftEdgePrimitive2D::create2DDecomposition(
 AlphaMask aMask(aBitmapEx.GetAlphaMask());
 if (aMask.IsEmpty()) // There is no mask, fully opaque
 break;
-const AlphaMask 
blurMask(drawinglayer::primitive2d::ProcessAndBlurAlphaMask(
+AlphaMask blurMask(drawinglayer::primitive2d::ProcessAndBlurAlphaMask(
 aMask, -fDiscreteSoftRadius * fScale, fDiscreteSoftRadius * 
fScale, 0));
+// tdf#157086 invert the blur mask instead of the alpha mask
+// An invert is needed to fix tdf#156808 but inverting the alpha mask
+// causes tdf#157086 so invert the blur mask instead.
+blurMask.Invert();
 aMask.BlendWith(blurMask);
-aMask.Invert();
 
 // The end result is the original bitmap with blurred 8-bit alpha mask
 BitmapEx result(aBitmapEx.GetBitmap(), aMask);


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

2023-09-08 Thread Noel Grandin (via logerrit)
 drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 380b586d6e69412aa5f4b9558ebb192ed8bcfc38
Author: Noel Grandin 
AuthorDate: Thu Sep 7 13:02:41 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 8 10:53:15 2023 +0200

XPrimitive2DRenderer does not need to implement XAggreggation

Checked on jenkins using 'make check' and

+void SAL_CALL setDelegator(css::uno::Reference 
const &) final { assert(false); }
+

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

diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx 
b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
index 2eb1373df0ae..58df9f4a7b28 100644
--- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
+++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
@@ -43,7 +43,7 @@ namespace drawinglayer::unorenderer
 namespace {
 
 class XPrimitive2DRenderer:
-public cppu::WeakAggImplHelper2<
+public cppu::WeakImplHelper<
 css::graphic::XPrimitive2DRenderer, css::lang::XServiceInfo>
 {
 public:


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

2023-08-28 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit e9dfa816f7002c686ad155682a21a06ec6041b5f
Author: Noel Grandin 
AuthorDate: Mon Aug 28 14:19:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Aug 28 18:14:59 2023 +0200

tdf#156808 soft edge effect makes image (except for soft edge) disappear

This is clearly fallout from
 commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
 Date:   Fri Apr 16 20:33:10 2021 +0200
 Convert internal vcl bitmap formats transparency->alpha (II)
And it clearly fixes the problem, but I'm not sure __why__ it fixes the
problem.

Change-Id: I805ed85dd22b2124328e6b4dba098c5f093aec55
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156198
Tested-by: Jenkins
Reviewed-by: Patrick Luby 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx 
b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
index 27e265ab1ae1..1da2f688d739 100644
--- a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
@@ -202,6 +202,7 @@ void SoftEdgePrimitive2D::create2DDecomposition(
 const AlphaMask 
blurMask(drawinglayer::primitive2d::ProcessAndBlurAlphaMask(
 aMask, -fDiscreteSoftRadius * fScale, fDiscreteSoftRadius * 
fScale, 0));
 aMask.BlendWith(blurMask);
+aMask.Invert();
 
 // The end result is the original bitmap with blurred 8-bit alpha mask
 BitmapEx result(aBitmapEx.GetBitmap(), aMask);


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

2023-08-21 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx  |   13 ++
 include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx |8 ++
 2 files changed, 21 insertions(+)

New commits:
commit 2ffed6f2d4936091285190d9d8b7f1141444f12e
Author: Caolán McNamara 
AuthorDate: Mon Aug 21 14:32:11 2023 +0100
Commit: Caolán McNamara 
CommitDate: Mon Aug 21 20:45:11 2023 +0200

split to allow getting decoration on its own

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

diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index b14e6994f7c9..c97b7a83bcae 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -52,6 +52,19 @@ namespace drawinglayer::primitive2d
 getLocale(),
 getFontColor(;
 
+CreateDecorationGeometryContent(rTarget, rDecTrans, rText,
+nTextPosition, nTextLength,
+rDXArray);
+}
+
+void TextDecoratedPortionPrimitive2D::CreateDecorationGeometryContent(
+Primitive2DContainer& rTarget,
+basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose const & 
rDecTrans,
+const OUString& rText,
+sal_Int32 nTextPosition,
+sal_Int32 nTextLength,
+const std::vector< double >& rDXArray) const
+{
 // see if something else needs to be done
 const bool bOverlineUsed(TEXT_LINE_NONE != getFontOverline());
 const bool bUnderlineUsed(TEXT_LINE_NONE != getFontUnderline());
diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx 
b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
index 73663ff95d32..a854a8833713 100644
--- a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -112,6 +112,14 @@ namespace drawinglayer::primitive2d
 bool getEmphasisMarkBelow() const { return mbEmphasisMarkBelow; }
 bool getShadow() const { return mbShadow; }
 
+void CreateDecorationGeometryContent(
+Primitive2DContainer& rTarget,
+basegfx::utils::B2DHomMatrixBufferedOnDemandDecompose const & 
rDecTrans,
+const OUString& rText,
+sal_Int32 nTextPosition,
+sal_Int32 nTextLength,
+const std::vector< double >& rDXArray) const;
+
 /// compare operator
 virtual bool operator==( const BasePrimitive2D& rPrimitive ) const 
override;
 


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

2023-08-17 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit e304163c8a70daab587f0b32855513887779
Author: Mike Kaganski 
AuthorDate: Thu Aug 17 13:11:30 2023 +0300
Commit: Mike Kaganski 
CommitDate: Thu Aug 17 15:06:27 2023 +0200

Simplify a bit

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

diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index f3909a1e1e94..298713517d2f 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -46,8 +46,7 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius
 fScale /= 2;
 fBlurRadius /= 2;
 fErodeDilateRadius /= 2;
-aSize.setHeight(aSize.Height() / 2);
-aSize.setWidth(aSize.Width() / 2);
+aSize /= 2;
 }
 
 // BmpScaleFlag::NearestNeighbor is important for following color 
replacement


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

2023-08-13 Thread Patrick Luby (via logerrit)
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   14 -
 slideshow/source/engine/shapes/gdimtftools.cxx   |   12 
 vcl/skia/salbmp.cxx  |   14 +
 vcl/source/app/salvtables.cxx|   16 ---
 4 files changed, 16 insertions(+), 40 deletions(-)

New commits:
commit 926c5246b6694d469a6caed5d7ea4c3a68648468
Author: Patrick Luby 
AuthorDate: Thu Aug 10 16:25:11 2023 -0400
Commit: Patrick Luby 
CommitDate: Sun Aug 13 19:46:13 2023 +0200

Related tdf#156630 and tdf#156629 force snapshot of alpha mask

On macOS, with Skia/Metal or Skia/Raster with a Retina display
(i.e. 2.0 window scale), the alpha mask gets upscaled in certain
cases.

This bug appears to be caused by pending scaling of an existing
SkImage in the bitmap parameter. So, force the SkiaSalBitmap to
handle its pending scaling.

This change consolidates the three duplicate fixes added in the
following commits into the AlphaMask(const Bitmap&) constructor.

  commit 12fd870113a663dde5ceb38c61f1986a34095d0e
  commit ce2d9f5dd4b6a26847c4779bce4866d969ff4400

From my light testing, the bitmap's SkImage is not scaled except
when running macOS with a Retina display. The only exception is
that this fix will be triggered on all platforms when exporting
to PDF images with an alpha mask.

Change-Id: Iea5afd55aac984ca606b2b4b44e457d81d76fac0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155568
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index 7c9f7b3f3397..e5658f6cf0d3 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -180,19 +180,7 @@ namespace drawinglayer::primitive2d
 BitmapEx bitmap;
 if( useAlphaMask )
 {
-AlphaMask 
aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), 
maVirtualDeviceMask->GetOutputSizePixel()));
-
-// Related tdf#156630 force snapshot of alpha mask
-// On macOS, with Skia/Raster with a Retina display (i.e.
-// 2.0 window scale), the alpha mask gets upscaled. Also,
-// when Skia is enabled, the alpha mask gets inverted in
-// the first export to PDF after launching the application.
-// These two bugs appear to be caused by asynchronous
-// rendering of the returned bitmap. So, we force a copy
-// of the alpha mask in case it changes before the bitmap
-// is actually drawn.
-AlphaMask::ScopedReadAccess pAccessAlpha(aMaskBitmap);
-
+const AlphaMask 
aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), 
maVirtualDeviceMask->GetOutputSizePixel()));
 bitmap = BitmapEx(aMainBitmap, aMaskBitmap);
 }
 else
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx 
b/slideshow/source/engine/shapes/gdimtftools.cxx
index 1928052b9260..2fc3c86ffa97 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -354,18 +354,6 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames&  
 o_rFrames,
 if( useAlphaMask )
 {
 AlphaMask aAlphaMask(pVDevMask->GetBitmap(aEmptyPoint, aAnimSize));
-
-// Related tdf#156630 force snapshot of alpha mask
-// On macOS, with Skia/Raster with a Retina display (i.e.
-// 2.0 window scale), the alpha mask gets upscaled. Also,
-// when Skia is enabled, the alpha mask gets inverted in
-// the first export to PDF after launching the application.
-// These two bugs appear to be caused by asynchronous
-// rendering of the returned bitmap. So, we force a copy
-// of the alpha mask in case it changes before the bitmap
-// is actually drawn.
-AlphaMask::ScopedReadAccess pAccessAlpha(aAlphaMask);
-
 pMtf->AddAction(
 new MetaBmpExAction( aEmptyPoint,
  BitmapEx(
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 8e07a00ec2d2..b5da2e4bd432 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -224,6 +224,20 @@ BitmapBuffer* 
SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
 assert(!mEraseColorSet);
 break;
 case BitmapAccessMode::Info:
+// Related tdf#156630 and tdf#156629 force snapshot of alpha mask
+// On macOS, with Skia/Metal or Skia/Raster with a Retina display
+// (i.e. 2.0 

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

2023-08-10 Thread Patrick Luby (via logerrit)
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   22 +++-
 slideshow/source/engine/shapes/gdimtftools.cxx   |   57 +--
 svx/source/sdr/contact/objectcontactofpageview.cxx   |4 
 vcl/skia/osx/gdiimpl.cxx |5 
 4 files changed, 75 insertions(+), 13 deletions(-)

New commits:
commit 12fd870113a663dde5ceb38c61f1986a34095d0e
Author: Patrick Luby 
AuthorDate: Mon Aug 7 12:17:36 2023 -0400
Commit: Patrick Luby 
CommitDate: Thu Aug 10 14:01:10 2023 +0200

tdf#156630 eliminate opaque parts when drawing animated PNG images

Due to the switch from transparency to alpha in commit
81994cb2b8b32453a92bcb011830fcb884f22ff3, flip the background colors
for the VirtualDevices and invert an alpha mask.

On macOS, with Skia/Raster with a Retina display (i.e.  2.0 window
scale), the alpha mask gets upscaled. Also, when Skia is enabled,
the alpha mask gets inverted in the first export to PDF after
launching the application. These two bugs appear to be caused by
asynchronous rendering of the returned bitmap. So, we force a copy
of the alpha mask in case it changes before the bitmap is actually
drawn.

Lastly, respect system animation settings when determining if the image
should be animated.

Change-Id: I8144691a6c99bf8361b301b88d22172991463f26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155429
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index f3c4cf69911c..7c9f7b3f3397 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -104,6 +104,10 @@ namespace drawinglayer::primitive2d
 maVirtualDeviceMask->EnableMapMode(false);
 maVirtualDevice->SetOutputSizePixel(aTarget);
 maVirtualDeviceMask->SetOutputSizePixel(aTarget);
+
+// tdf#156630 make erase calls fill with transparency
+maVirtualDevice->SetBackground(COL_BLACK);
+maVirtualDeviceMask->SetBackground(COL_ALPHA_TRANSPARENT);
 }
 
 maVirtualDevice->Erase();
@@ -176,12 +180,26 @@ namespace drawinglayer::primitive2d
 BitmapEx bitmap;
 if( useAlphaMask )
 {
-const AlphaMask 
aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), 
maVirtualDeviceMask->GetOutputSizePixel()));
+AlphaMask 
aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), 
maVirtualDeviceMask->GetOutputSizePixel()));
+
+// Related tdf#156630 force snapshot of alpha mask
+// On macOS, with Skia/Raster with a Retina display (i.e.
+// 2.0 window scale), the alpha mask gets upscaled. Also,
+// when Skia is enabled, the alpha mask gets inverted in
+// the first export to PDF after launching the application.
+// These two bugs appear to be caused by asynchronous
+// rendering of the returned bitmap. So, we force a copy
+// of the alpha mask in case it changes before the bitmap
+// is actually drawn.
+AlphaMask::ScopedReadAccess pAccessAlpha(aMaskBitmap);
+
 bitmap = BitmapEx(aMainBitmap, aMaskBitmap);
 }
 else
 {
-const Bitmap 
aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), 
maVirtualDeviceMask->GetOutputSizePixel()));
+Bitmap aMaskBitmap(maVirtualDeviceMask->GetBitmap(Point(), 
maVirtualDeviceMask->GetOutputSizePixel()));
+// tdf#156630 invert the alpha mask
+aMaskBitmap.Invert(); // convert from transparency to alpha
 bitmap = BitmapEx(aMainBitmap, aMaskBitmap);
 }
 
diff --git a/slideshow/source/engine/shapes/gdimtftools.cxx 
b/slideshow/source/engine/shapes/gdimtftools.cxx
index c5a215eefbc4..1928052b9260 100644
--- a/slideshow/source/engine/shapes/gdimtftools.cxx
+++ b/slideshow/source/engine/shapes/gdimtftools.cxx
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -272,6 +273,10 @@ bool getAnimationFromGraphic( VectorOfMtfAnimationFrames&  
 o_rFrames,
 pVDevMask->SetOutputSizePixel( aAnimSize );
 pVDevMask->EnableMapMode( false );
 
+// tdf#156630 make erase calls fill with transparency
+pVDev->SetBackground( Wallpaper( COL_BLACK ) );
+pVDevMask->SetBackground( Wallpaper( COL_ALPHA_TRANSPARENT ) );
+
 o_rLoopCount = aAnimation.GetLoopCount();
 
 for( sal_uInt16 i=0, nCount=aAnimation.Count(); i();
-Bitmap aAlphaMask = 

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

2023-08-05 Thread Patrick Luby (via logerrit)
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit fe9efb6d5eeba3adf81cd1f33b684fd8f57899f5
Author: Patrick Luby 
AuthorDate: Fri Aug 4 19:42:48 2023 -0400
Commit: Patrick Luby 
CommitDate: Sat Aug 5 14:27:56 2023 +0200

Related tdf#156508 fix rendering of the About dialog .svg

After 0e7d4ea64f84bdc62c10692dcd97c3a32e72e16e, white polygons are
drawn in the LibreOffice about .svg in both the About dialog and with
the .svg in a document.

Creating the mask with COL_WHITE instead of COL_BLACK appears to fix
this without causing tdf#156508 to reoccur.

Change-Id: I886451245126c2b7f936e30275965148bf029627
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155362
Tested-by: Jenkins
Reviewed-by: Patrick Luby 

diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index 3c45fdd030f4..f3909a1e1e94 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -35,7 +35,7 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius
 {
 // 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(bConvertTo1Bit ? rMask.CreateMask(COL_WHITE) : rMask);
+BitmapEx mask(bConvertTo1Bit ? rMask.CreateMask(COL_BLACK) : rMask);
 
 // Scaling down increases performance without noticeable quality loss. 
Additionally,
 // current blur implementation can only handle blur radius between 2 and 
254.


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

2023-08-04 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 0e7d4ea64f84bdc62c10692dcd97c3a32e72e16e
Author: Noel Grandin 
AuthorDate: Fri Aug 4 10:17:39 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Aug 4 13:34:39 2023 +0200

tdf#156508 Blur shadow is solid in edit and presentation mode

regression from
commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
Author: Noel Grandin 
Date:   Fri Apr 16 20:33:10 2021 +0200
Convert internal vcl bitmap formats transparency->alpha (II)

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

diff --git a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx 
b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
index 9bbdf7176935..3c45fdd030f4 100644
--- a/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
+++ b/drawinglayer/source/primitive2d/GlowSoftEgdeShadowTools.cxx
@@ -58,10 +58,10 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, 
double fErodeDilateRadius
 else if (fErodeDilateRadius < 0)
 BitmapFilter::Filter(mask, BitmapErodeFilter(-fErodeDilateRadius, 
0xFF));
 
-if (nTransparency != 255)
+if (nTransparency)
 {
 const Color aTransparency(nTransparency, nTransparency, nTransparency);
-mask.Replace(COL_WHITE, aTransparency);
+mask.Replace(COL_BLACK, aTransparency);
 }
 
 // We need 8-bit grey mask for blurring
@@ -72,8 +72,6 @@ AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius
 
 mask.Scale(rMask.GetSizePixel());
 
-mask.Invert(); // convert transparency to alpha
-
 return AlphaMask(mask.GetBitmap());
 }
 


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

2023-07-27 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit e06456180ade61aa519819702810a3b9779a6e9e
Author: Caolán McNamara 
AuthorDate: Thu Jul 27 10:30:35 2023 +0100
Commit: Caolán McNamara 
CommitDate: Thu Jul 27 15:13:06 2023 +0200

crashtesting: crash on export of forum-en-41439.odp to pdf

and various others.

since:

commit 81994cb2b8b32453a92bcb011830fcb884f22ff3
Date:   Fri Apr 16 20:33:10 2021 +0200

Convert internal vcl bitmap formats transparency->alpha (II)

changed drawinglayer/source/tools/converters.cxx convertToBitmapEx

return BitmapEx(aRetval, aAlpha);

if (aAlpha.hasAlpha())
return BitmapEx(aRetval, aAlpha);
else
return BitmapEx(aRetval);

and SoftEdgePrimitive2D::create2DDecomposition assumes a mask exists.

Presumably no mask -> fully opaque -> do nothing is the right outcome
here.

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

diff --git a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx 
b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
index ecf4e48338d6..27e265ab1ae1 100644
--- a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
@@ -197,6 +197,8 @@ void SoftEdgePrimitive2D::create2DDecomposition(
 
 // Get the Alpha and use as base to blur and apply the effect
 AlphaMask aMask(aBitmapEx.GetAlphaMask());
+if (aMask.IsEmpty()) // There is no mask, fully opaque
+break;
 const AlphaMask 
blurMask(drawinglayer::primitive2d::ProcessAndBlurAlphaMask(
 aMask, -fDiscreteSoftRadius * fScale, fDiscreteSoftRadius * 
fScale, 0));
 aMask.BlendWith(blurMask);


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

2023-07-20 Thread Sarper Akdemir (via logerrit)
 drawinglayer/source/processor2d/hittestprocessor2d.cxx  |   49 
 include/basegfx/range/Range2D.hxx   |7 ++
 include/drawinglayer/processor2d/hittestprocessor2d.hxx |   10 +--
 include/svx/sdrhittesthelper.hxx|   12 ++-
 sc/source/ui/drawfunc/fupoor.cxx|5 -
 sc/source/ui/drawfunc/fusel2.cxx|5 -
 sc/source/ui/unoobj/viewuno.cxx |5 -
 sd/source/ui/func/fudraw.cxx|   12 +--
 sd/source/ui/func/fusel.cxx |   12 +--
 sd/source/ui/view/sdview3.cxx   |   13 +---
 svx/source/accessibility/GraphCtlAccessibleContext.cxx  |2 
 svx/source/sdr/overlay/overlayobjectlist.cxx|2 
 svx/source/svdraw/sdrhittesthelper.cxx  |   19 ++
 svx/source/svdraw/svdetc.cxx|2 
 svx/source/svdraw/svdmrkv.cxx   |4 -
 svx/source/svdraw/svdobj.cxx|2 
 svx/source/svdraw/svdocapt.cxx  |2 
 svx/source/svdraw/svdoedge.cxx  |   12 +--
 svx/source/svdraw/svdview.cxx   |   25 +---
 19 files changed, 108 insertions(+), 92 deletions(-)

New commits:
commit 2c8c436c4a8546276e285dd18f3f7ded091a2c4e
Author: Sarper Akdemir 
AuthorDate: Tue Jul 18 16:57:59 2023 +0300
Commit: Thorsten Behrens 
CommitDate: Fri Jul 21 01:37:18 2023 +0200

tdf#152992: for Impress/Draw add horizontal hit tolerance for quick text 
edit

Implements horizontal hit tolerance for quick text edit in Impress & Draw
making it more forgiving. Previously it was required to click exactly on
the glyph to get a direct text cursor.

Refactors hittestprocessor2d so that it now supports pseudo per axis hit
tolerance.
i.e. underlying isInEpsilonRange hit check is still the same utilizing
the larger tolerance of the two per axis tolerance, but the preliminary
check that uses aPolygonRange.grow() and later aPolygonRange.isInside()
now filters hit misses out with respect to the per axis hit tolerance.

Utilizes hittestprocessor2d's new per axis tolerance to introduce hit
tolerance for quick text edit, making it similar to TextEdit mode hit
tolerance which only has horizontal tolerance.

Fixes wrong use of BoundRect hit to determine text frame border hits.
Which previously only made sense for TextFrame borders, and was mostly
useless for shapes with text inside.

Change-Id: I749e63752da05b01270bfcab2632c41879a848ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154640
Reviewed-by: Heiko Tietze 
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx 
b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 9af3504a5113..6e624fa4ef97 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -41,27 +41,25 @@ namespace drawinglayer::processor2d
 {
 HitTestProcessor2D::HitTestProcessor2D(const 
geometry::ViewInformation2D& rViewInformation,
 const basegfx::B2DPoint& rLogicHitPosition,
-double fLogicHitTolerance,
+const basegfx::B2DVector& rLogicHitTolerance,
 bool bHitTextOnly)
 :   BaseProcessor2D(rViewInformation),
-mfDiscreteHitTolerance(0.0),
+maDiscreteHitTolerance(rLogicHitTolerance),
 mbCollectHitStack(false),
 mbHit(false),
 mbHitTextOnly(bHitTextOnly)
 {
-// init hit tolerance
-mfDiscreteHitTolerance = fLogicHitTolerance;
+// ensure input parameters for hit tolerance is >= 0.0
+if (maDiscreteHitTolerance.getX() < 0.0)
+maDiscreteHitTolerance.setX(0.0);
+if (maDiscreteHitTolerance.getY() < 0.0)
+maDiscreteHitTolerance.setY(0.0);
 
-if(basegfx::fTools::less(mfDiscreteHitTolerance, 0.0))
-{
-// ensure input parameter for hit tolerance is >= 0.0
-mfDiscreteHitTolerance = 0.0;
-}
-else if(basegfx::fTools::more(mfDiscreteHitTolerance, 0.0))
+if (!maDiscreteHitTolerance.equalZero())
 {
 // generate discrete hit tolerance
-mfDiscreteHitTolerance = 
(getViewInformation2D().getObjectToViewTransformation()
-* basegfx::B2DVector(mfDiscreteHitTolerance, 
0.0)).getLength();
+maDiscreteHitTolerance
+= getViewInformation2D().getObjectToViewTransformation() * 
rLogicHitTolerance;
 }
 
 // generate discrete hit position
@@ -74,7 +72,7 @@ namespace drawinglayer::processor2d
 
 bool 

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

2023-07-14 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   20 -
 editeng/source/editeng/impedit3.cxx|2 
 filter/source/pdf/pdfexport.cxx|8 
 include/vcl/pdfextoutdevdata.hxx   |   11 
 include/vcl/pdfwriter.hxx  |   10 
 sw/source/core/text/EnhancedPDFExportHelper.cxx|2 
 sw/source/core/text/itrform2.cxx   |2 
 sw/source/uibase/docvw/AnnotationWin2.cxx  |2 
 vcl/inc/pdf/pdfwriter_impl.hxx |7 
 vcl/source/gdi/pdfextoutdevdata.cxx|   98 --
 vcl/source/gdi/pdfwriter.cxx   |   15 
 vcl/source/gdi/pdfwriter_impl.cxx  |  200 +
 12 files changed, 277 insertions(+), 100 deletions(-)

New commits:
commit 07d790ca473cd6e71f0343419b819fa6b485dc01
Author: Michael Stahl 
AuthorDate: Wed Jul 12 15:26:25 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 14 14:56:24 2023 +0200

tdf#154982 vcl: PDF Export: split BeginStructureElement

... into 3 parts:
EnsureStructureElement/InitStructureElement/BeginStructureElement

So EnsureStructureElement and BeginStructureElement/EndStructureElement
can be called multiple times for the same object, passing in a unique
key and PDFExtOutDevData will only create the element once.

InitStructureElement will be used exactly once for each object when its
actual content is exported.

In PDFExtOutDevData rely on the indexes being the same here and in
PDFWriterImpl, because then only PDFExtOutDevData needs to maintain the
map from key to index.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 85b9ca35abf1..b2045a5e18c0 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1127,7 +1127,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D(

mpOutputDevice->GetMapMode());
 pPDFControl->TextFont.SetFontSize(aFontSize);
 
-mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form);
+
mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Form);
 vcl::PDFWriter::StructAttributeValue role;
 switch (pPDFControl->Type)
 {
@@ -1174,7 +1174,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 
 if (mpPDFExtOutDevData)
 { // no corresponding PDF Form, use Figure instead
-mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Figure);
+mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Figure);
 mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, 
vcl::PDFWriter::Block);
 auto const 
range(rControlPrimitive.getB2DRange(getViewInformation2D()));
 tools::Rectangle const aLogicRect(
@@ -1315,7 +1315,7 @@ void 
VclMetafileProcessor2D::processTextHierarchyBulletPrimitive2D(
 if (mbInListItem)
 {
 maListElements.push(vcl::PDFWriter::LILabel);
-mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::LILabel);
+mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::LILabel);
 }
 
 // process recursively and add MetaFile comment
@@ -1354,7 +1354,7 @@ void 
VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D(
 {
 // No Tagged PDF -> Dump as Paragraph
 // Emulate data handling from old ImpEditEngine::Paint
-mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Paragraph);
+
mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::Paragraph);
 
 // Process recursively and add MetaFile comment
 process(rParagraphPrimitive);
@@ -1380,7 +1380,7 @@ void 
VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D(
 for (sal_Int16 a(mnCurrentOutlineLevel); a != nNewOutlineLevel; 
++a)
 {
 maListElements.push(vcl::PDFWriter::List);
-
mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::List);
+
mpPDFExtOutDevData->WrapBeginStructureElement(vcl::PDFWriter::List);
 }
 }
 else // if(nNewOutlineLevel < mnCurrentOutlineLevel)
@@ -1411,13 +1411,13 @@ void 
VclMetafileProcessor2D::processTextHierarchyParagraphPrimitive2D(
 {
 // Dump as ListItem
 maListElements.push(vcl::PDFWriter::ListItem);
-mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::ListItem);
+

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

2023-07-14 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 9a148e4fb402d203ab0d2683dc316aa8217b576c
Author: Michael Stahl 
AuthorDate: Tue Jul 11 14:04:14 2023 +0200
Commit: Michael Stahl 
CommitDate: Fri Jul 14 14:54:31 2023 +0200

tdf#154982 drawinglayer: post-order traversal of ObjectInfoPrimitive2D

For the signature line, the wrong alt-text is exported to PDF, because
the cui/source/dialogs/signature-line.svg contains lots of "desc"
elements, which are converted to ObjectInfoPrimitive2D, and currently
these are applied after the ObjectInfoPrimitive2D for the SdrObject.

So let's try to switch the order, fixes the bugdoc at least.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index aba9444b72e1..85b9ca35abf1 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -927,6 +927,9 @@ void VclMetafileProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimi
 void VclMetafileProcessor2D::processObjectInfoPrimitive2D(
 primitive2d::ObjectInfoPrimitive2D const& rObjectInfoPrimitive2D)
 {
+// tdf#154982 process content first, so this object overrides any nested 
one
+process(rObjectInfoPrimitive2D.getChildren());
+
 // currently StructureTagPrimitive2D is only used for SdrObjects - have to
 // avoid adding Alt text if the SdrObject is not actually tagged, as it
 // would then end up on an unrelated structure element.
@@ -964,9 +967,6 @@ void VclMetafileProcessor2D::processObjectInfoPrimitive2D(
 }
 }
 }
-
-// process content
-process(rObjectInfoPrimitive2D.getChildren());
 }
 
 void VclMetafileProcessor2D::processGraphicPrimitive2D(


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

2023-07-14 Thread Xisco Fauli (via logerrit)
 drawinglayer/source/tools/primitive2dxmldump.cxx |9 +++
 svgio/qa/cppunit/SvgImportTest.cxx   |   46 
 svgio/qa/cppunit/data/tdf156271.svg  |6 ++
 svgio/source/svgreader/svgcharacternode.cxx  |   63 ---
 4 files changed, 85 insertions(+), 39 deletions(-)

New commits:
commit a3d8f4079dc31a0496f86dc2f80eee9ad60415f5
Author: Xisco Fauli 
AuthorDate: Thu Jul 13 23:06:02 2023 +0200
Commit: Xisco Fauli 
CommitDate: Fri Jul 14 12:46:41 2023 +0200

tdf#156271: add dx shift on top of x position

Change-Id: I61263a7fec2ec8236221a10f8cb730899c878f5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154403
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 8adaf82327d3..a68692649f46 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -919,6 +919,15 @@ void Primitive2dXmlDump::decomposeAndWrite(
 const drawinglayer::attribute::FontAttribute& aFontAttribute
 = rTextSimplePortionPrimitive2D.getFontAttribute();
 rWriter.attribute("familyname", 
aFontAttribute.getFamilyName());
+const std::vector aDx = 
rTextSimplePortionPrimitive2D.getDXArray();
+if (aDx.size())
+{
+for (size_t iDx = 0; iDx < aDx.size(); ++iDx)
+{
+OString sName = "dx" + OString::number(iDx);
+rWriter.attribute(sName, OUString::number(aDx[iDx]));
+}
+}
 rWriter.endElement();
 }
 break;
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx 
b/svgio/qa/cppunit/SvgImportTest.cxx
index 7263439e86c1..0a976eb276e0 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -1431,6 +1431,52 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156269)
 assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", 
"#00");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf156271)
+{
+Primitive2DSequence aSequence = 
parseSvg(u"/svgio/qa/cppunit/data/tdf156271.svg");
+CPPUNIT_ASSERT_EQUAL(1, static_cast(aSequence.getLength()));
+
+drawinglayer::Primitive2dXmlDump dumper;
+xmlDocUniquePtr pDocument = 
dumper.dumpAndParse(Primitive2DContainer(aSequence));
+
+CPPUNIT_ASSERT (pDocument);
+
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"width", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"height", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"x", "40");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"y", "10");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"text", "AB");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"dx0", "-30");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", 
"dx1", "-19");
+
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"width", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"height", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"x", "40");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"y", "20");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"text", "AB");
+
+// Without the fix in place, this test would have failed with
+// - Expected: -30
+// - Actual  : 0
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"dx0", "-30");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", 
"dx1", "-19");
+
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"width", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"height", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"x", "40");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"y", "30");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"text", "AB");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"dx0", "-30");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", 
"dx1", "-19");
+
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"width", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"height", "16");
+assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", 
"x", "40");
+assertXPath(pDocument, 

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

2023-07-11 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 41d8bb928231372f3ef08ce4ba3ea91b17e3ae29
Author: Michael Stahl 
AuthorDate: Mon Jul 10 20:42:07 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Jul 11 12:51:40 2023 +0200

(related tdf#154777) drawinglayer: add BBox to Figure fallback of forms

PAC3 complains if the BBox is missing.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index eae5980bf56c..aba9444b72e1 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1176,6 +1176,11 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 { // no corresponding PDF Form, use Figure instead
 mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Figure);
 mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, 
vcl::PDFWriter::Block);
+auto const 
range(rControlPrimitive.getB2DRange(getViewInformation2D()));
+tools::Rectangle const aLogicRect(
+basegfx::fround(range.getMinX()), basegfx::fround(range.getMinY()),
+basegfx::fround(range.getMaxX()), 
basegfx::fround(range.getMaxY()));
+mpPDFExtOutDevData->SetStructureBoundingBox(aLogicRect);
 OUString const& rAltText(rControlPrimitive.GetAltText());
 if (!rAltText.isEmpty())
 {


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

2023-07-06 Thread Maxim Monastirsky (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |7 ++-
 editeng/source/editeng/editattr.cxx|2 +-
 editeng/source/editeng/editdoc.cxx |2 +-
 svx/source/tbxctrls/tbcontrl.cxx   |2 +-
 4 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 619ac8bbb31a62087ac1e3745cc28b461bfb49c0
Author: Maxim Monastirsky 
AuthorDate: Thu Jul 6 01:58:42 2023 +0300
Commit: Maxim Monastirsky 
CommitDate: Thu Jul 6 09:33:52 2023 +0200

tdf#126382 Correct check for transparency

Change-Id: I0664abae6f83736678108fab31dd119fae811054
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154082
Tested-by: Jenkins
Reviewed-by: Maxim Monastirsky 

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index ad680803438d..3ad89f1cab63 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -185,11 +185,8 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 
 // set FillColor Attribute
 const Color aFillColor(rTextCandidate.getTextFillColor());
-if (aFillColor != COL_TRANSPARENT)
-{
-aFont.SetFillColor(aFillColor);
-aFont.SetTransparent(false);
-}
+aFont.SetTransparent(aFillColor.IsTransparent());
+aFont.SetFillColor(aFillColor);
 
 // handle additional font attributes
 const primitive2d::TextDecoratedPortionPrimitive2D* pTCPP = 
nullptr;
diff --git a/editeng/source/editeng/editattr.cxx 
b/editeng/source/editeng/editattr.cxx
index 42e5f20206ba..a045f16ade81 100644
--- a/editeng/source/editeng/editattr.cxx
+++ b/editeng/source/editeng/editattr.cxx
@@ -230,7 +230,7 @@ 
EditCharAttribBackgroundColor::EditCharAttribBackgroundColor(
 void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* )
 {
 Color aColor = static_cast(GetItem())->GetValue();
-rFont.SetTransparent(aColor == COL_TRANSPARENT);
+rFont.SetTransparent(aColor.IsTransparent());
 rFont.SetFillColor(aColor);
 }
 
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 08750a94fcd2..d4dc4ee16e37 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -1998,7 +1998,7 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_BKGCOLOR ) == 
SfxItemState::SET ) )
 {
 auto& aColor = rSet.Get( EE_CHAR_BKGCOLOR ).GetValue();
-rFont.SetTransparent(aColor == COL_TRANSPARENT);
+rFont.SetTransparent(aColor.IsTransparent());
 rFont.SetFillColor(aColor);
 }
 if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontHeight ) == 
SfxItemState::SET ) )
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 052d8558386b..da8493c75059 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -2349,7 +2349,7 @@ void ColorWindow::SelectEntry(const NamedColor& 
rNamedColor)
 
 const Color  = rNamedColor.m_aColor;
 
-if (mxButtonAutoColor->get_visible() && (rColor == COL_TRANSPARENT || 
rColor == COL_AUTO))
+if (mxButtonAutoColor->get_visible() && rColor.IsFullyTransparent())
 {
 mpDefaultButton = mxButtonAutoColor.get();
 return;


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

2023-06-29 Thread gilssonn (via logerrit)
 drawinglayer/source/primitive2d/borderlineprimitive2d.cxx  |   21 ++---
 drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx |   10 +-
 2 files changed, 6 insertions(+), 25 deletions(-)

New commits:
commit d61baaff35e6b180c17b3d93309f00e0255e1a9b
Author: gilssonn 
AuthorDate: Sat Jun 10 21:45:48 2023 -0400
Commit: Ilmari Lauhakangas 
CommitDate: Fri Jun 30 06:53:33 2023 +0200

Corrective and refactoring changes in drawinglayer module

Correct and simplify comparison logic
and use std::transform for vector assignment.

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

diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx 
b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 45536a53124b..f54b71417735 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -282,23 +282,10 @@ namespace drawinglayer::primitive2d
 
 const BorderLinePrimitive2D& rCompare = static_cast(rPrimitive);
 
-if (getStart() == rCompare.getStart()
-&& getEnd() == rCompare.getEnd()
-&& getStrokeAttribute() == rCompare.getStrokeAttribute())
-{
-if (getBorderLines().size() == 
rCompare.getBorderLines().size())
-{
-for (size_t a(0); a < getBorderLines().size(); a++)
-{
-if (!(getBorderLines()[a] == 
rCompare.getBorderLines()[a]))
-{
-return false;
-}
-}
-}
-}
-
-return false;
+return (getStart() == rCompare.getStart()
+&& getEnd() == rCompare.getEnd()
+&& getStrokeAttribute() == rCompare.getStrokeAttribute()
+&& getBorderLines() == rCompare.getBorderLines());
 }
 
 // provide unique ID
diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx 
b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
index 955e6bd4f9ca..2b015fdad39b 100644
--- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
@@ -485,10 +485,7 @@ namespace drawinglayer::primitive3d
 
 Primitive3DContainer aRetval(aResultVector.size());
 
-for(size_t a(0); a < aResultVector.size(); a++)
-{
-aRetval[a] = Primitive3DReference(aResultVector[a]);
-}
+std::transform(aResultVector.cbegin(), aResultVector.cend(), 
aRetval.begin(), [](auto ){return Primitive3DReference(rResult);});
 
 return aRetval;
 }
@@ -707,10 +704,7 @@ using namespace com::sun::star;
 // prepare return value
 Primitive3DContainer aRetval(aResultVector.size());
 
-for(size_t a(0); a < aResultVector.size(); a++)
-{
-aRetval[a] = Primitive3DReference(aResultVector[a]);
-}
+std::transform(aResultVector.cbegin(), aResultVector.cend(), 
aRetval.begin(), [](auto ){return Primitive3DReference(rResult);});
 
 return aRetval;
 }


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

2023-06-29 Thread Paris Oplopoios (via logerrit)
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |   14 ---
 include/vcl/animate/AnimationFrame.hxx   |   14 +--
 vcl/source/animate/AnimationFrame.cxx|3 ++
 vcl/source/filter/png/PngImageReader.cxx |6 +++-
 4 files changed, 30 insertions(+), 7 deletions(-)

New commits:
commit 8dfde7d69a8bbdc8ce88aefded231b94e30271d6
Author: Paris Oplopoios 
AuthorDate: Sat Jun 24 17:36:09 2023 +0300
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 29 15:19:54 2023 +0200

tdf#104877 Implement APNG blending modes

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

diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index a95df2474744..f3c4cf69911c 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -252,6 +252,15 @@ namespace drawinglayer::primitive2d
 // prepare step
 const AnimationFrame& rAnimationFrame = 
maAnimation.Get(sal_uInt16(mnNextFrameToPrepare));
 
+bool bSourceBlending = rAnimationFrame.meBlend == 
Blend::Source;
+
+if (bSourceBlending)
+{
+tools::Rectangle 
aArea(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx.GetSizePixel());
+maVirtualDevice->Erase(aArea);
+maVirtualDeviceMask->Erase(aArea);
+}
+
 switch (rAnimationFrame.meDisposal)
 {
 case Disposal::Not:
@@ -278,14 +287,13 @@ namespace drawinglayer::primitive2d
 {
 // #i70772# react on no mask, for primitives, too.
 const AlphaMask & 
rMask(rAnimationFrame.maBitmapEx.GetAlphaMask());
-const Bitmap & 
rContent(rAnimationFrame.maBitmapEx.GetBitmap());
 
 maVirtualDeviceMask->Erase();
-
maVirtualDevice->DrawBitmap(rAnimationFrame.maPositionPixel, rContent);
+
maVirtualDevice->DrawBitmapEx(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx);
 
 if (rMask.IsEmpty())
 {
-const ::tools::Rectangle 
aRect(rAnimationFrame.maPositionPixel, rContent.GetSizePixel());
+const ::tools::Rectangle 
aRect(rAnimationFrame.maPositionPixel, 
rAnimationFrame.maBitmapEx.GetSizePixel());
 maVirtualDeviceMask->SetFillColor(COL_BLACK);
 maVirtualDeviceMask->SetLineColor();
 maVirtualDeviceMask->DrawRect(aRect);
diff --git a/include/vcl/animate/AnimationFrame.hxx 
b/include/vcl/animate/AnimationFrame.hxx
index 7aa6f0d54a2b..3e9a4b21d168 100644
--- a/include/vcl/animate/AnimationFrame.hxx
+++ b/include/vcl/animate/AnimationFrame.hxx
@@ -28,6 +28,12 @@ enum class Disposal
 Previous
 };
 
+enum class Blend
+{
+Source,
+Over
+};
+
 struct AnimationFrame
 {
 BitmapEx maBitmapEx;
@@ -35,22 +41,26 @@ struct AnimationFrame
 Size maSizePixel;
 tools::Long mnWait;
 Disposal meDisposal;
+Blend meBlend;
 bool mbUserInput;
 
 AnimationFrame()
 : mnWait(0)
 , meDisposal(Disposal::Not)
+, meBlend(Blend::Over)
 , mbUserInput(false)
 {
 }
 
 AnimationFrame(const BitmapEx& rBitmapEx, const Point& rPositionPixel, 
const Size& rSizePixel,
-   tools::Long nWait = 0, Disposal eDisposal = Disposal::Not)
+   tools::Long nWait = 0, Disposal eDisposal = Disposal::Not,
+   Blend eBlend = Blend::Over)
 : maBitmapEx(rBitmapEx)
 , maPositionPixel(rPositionPixel)
 , maSizePixel(rSizePixel)
 , mnWait(nWait)
 , meDisposal(eDisposal)
+, meBlend(eBlend)
 , mbUserInput(false)
 {
 }
@@ -60,7 +70,7 @@ struct AnimationFrame
 return (rAnimationFrame.maBitmapEx == maBitmapEx
 && rAnimationFrame.maPositionPixel == maPositionPixel
 && rAnimationFrame.maSizePixel == maSizePixel && 
rAnimationFrame.mnWait == mnWait
-&& rAnimationFrame.meDisposal == meDisposal
+&& rAnimationFrame.meDisposal == meDisposal && 
rAnimationFrame.meBlend == meBlend
 && rAnimationFrame.mbUserInput == mbUserInput);
 }
 
diff --git a/vcl/source/animate/AnimationFrame.cxx 
b/vcl/source/animate/AnimationFrame.cxx
index e2f9bae931fb..3593a0ab17e1 100644
--- 

[Libreoffice-commits] core.git: drawinglayer/source svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source

2023-06-29 Thread Xisco Fauli (via logerrit)
 drawinglayer/source/tools/primitive2dxmldump.cxx |   15 +-
 svgio/Library_svgio.mk   |1 
 svgio/inc/svgfedropshadownode.hxx|   48 +++
 svgio/inc/svgtoken.hxx   |1 
 svgio/qa/cppunit/SvgImportTest.cxx   |   17 ++
 svgio/qa/cppunit/data/filterFeDropShadow.svg |   10 +
 svgio/source/svgreader/svgdocumenthandler.cxx|9 +
 svgio/source/svgreader/svgfedropshadownode.cxx   |  147 +++
 svgio/source/svgreader/svgfilternode.cxx |7 +
 svgio/source/svgreader/svgtoken.cxx  |3 
 10 files changed, 253 insertions(+), 5 deletions(-)

New commits:
commit 14c40c460526f2e4ed2c24a3f50baae25a43a8f2
Author: Xisco Fauli 
AuthorDate: Wed Jun 28 23:46:37 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 29 10:40:06 2023 +0200

tdf#156066: Add support for feDropShadow filter

Change-Id: I0b2772a7211efb91821853e3369cfc3a5ef6a932
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153727
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 37ea828a6fbb..8adaf82327d3 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -40,6 +40,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1116,11 +1117,17 @@ void Primitive2dXmlDump::decomposeAndWrite(
 case PRIMITIVE2D_ID_SHADOWPRIMITIVE2D:
 {
 // ShadowPrimitive2D.
+const ShadowPrimitive2D& rShadowPrimitive2D
+= dynamic_cast(*pBasePrimitive);
 rWriter.startElement("shadow");
-drawinglayer::primitive2d::Primitive2DContainer 
aPrimitiveContainer;
-pBasePrimitive->get2DDecomposition(aPrimitiveContainer,
-   
drawinglayer::geometry::ViewInformation2D());
-decomposeAndWrite(aPrimitiveContainer, rWriter);
+rWriter.attribute("color",
+  
convertColorToString(rShadowPrimitive2D.getShadowColor()));
+rWriter.attributeDouble("blur", 
rShadowPrimitive2D.getShadowBlur());
+
+rWriter.startElement("transform");
+writeMatrix(rWriter, rShadowPrimitive2D.getShadowTransform());
+rWriter.endElement();
+
 rWriter.endElement();
 break;
 }
diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 20797e339a81..56d1f8dc1ae3 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -61,6 +61,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svggnode \
 svgio/source/svgreader/svganode \
 svgio/source/svgreader/svgfecolormatrixnode \
+svgio/source/svgreader/svgfedropshadownode \
 svgio/source/svgreader/svgfefloodnode \
 svgio/source/svgreader/svgfegaussianblurnode \
 svgio/source/svgreader/svgfeoffsetnode \
diff --git a/svgio/inc/svgfedropshadownode.hxx 
b/svgio/inc/svgfedropshadownode.hxx
new file mode 100644
index ..5cc4b51ed797
--- /dev/null
+++ b/svgio/inc/svgfedropshadownode.hxx
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgnode.hxx"
+#include "svgstyleattributes.hxx"
+
+namespace svgio::svgreader
+{
+class SvgFeDropShadowNode final : public SvgNode
+{
+private:
+SvgNumber maDx;
+SvgNumber maDy;
+SvgNumber maStdDeviation;
+SvgPaint maFloodColor;
+SvgNumber maFloodOpacity;
+
+public:
+SvgFeDropShadowNode(SvgDocument& rDocument, SvgNode* pParent);
+virtual ~SvgFeDropShadowNode() override;
+
+virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
+const OUString& aContent) override;
+
+void apply(drawinglayer::primitive2d::Primitive2DContainer& rTarget) const;
+};
+
+} // end of namespace svgio::svgreader
+
+/* 

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

2023-06-27 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   16 +++--
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 3b06c1835e9fcbbcdcd6ce2b207301f4f8bb6388
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Jun 27 13:46:51 2023 +0200
Commit: Armin Le Grand 
CommitDate: Tue Jun 27 18:37:16 2023 +0200

MCGR: tdf#155479 always propagate SVG-flag for sub-content metafiles

For SVG export it is necessary to always propagate the SVG-flag for
metafiles in *any* case impDumpToMetaFile is used and a new metafile
gets created (aContentMetafile here).
This is due to the subContent again may have any combinations of
gradients/transparenceGradients that are non-vcl-renderable and need
special handling.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index b774848cc3a4..eae5980bf56c 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2295,6 +2295,11 @@ void 
VclMetafileProcessor2D::processUnifiedTransparencePrimitive2D(
 
 // various content, create content-metafile
 GDIMetaFile aContentMetafile;
+
+// tdf#155479 always forward propagate SVG flag for 
sub-content,
+// it may contain cannotBeHandledByVCL gradients or 
transparencyGradients
+
aContentMetafile.setSVG(mpOutputDevice->GetConnectMetaFile()->getSVG());
+
 const tools::Rectangle aPrimitiveRectangle(
 impDumpToMetaFile(rContent, aContentMetafile));
 
@@ -2391,8 +2396,7 @@ void 
VclMetafileProcessor2D::processTransparencePrimitive2D(
 
 // tdf#155479 Yepp, as already mentioned above we need to add
 // some MCGR infos in case of SVG export, prepare that here
-if (nullptr != mpOutputDevice->GetConnectMetaFile()
-&& mpOutputDevice->GetConnectMetaFile()->getSVG())
+if (mpOutputDevice->GetConnectMetaFile()->getSVG())
 {
 // for SVG, do not use decompose & prep extra data
 bSVGTransparencyColorStops = true;
@@ -2411,11 +2415,9 @@ void 
VclMetafileProcessor2D::processTransparencePrimitive2D(
 // vcl/metafile, so add it directly. various content, create 
content-metafile
 GDIMetaFile aContentMetafile;
 
-// tdf#155479 do not forget to forward SVG flag for sub-content
-if (bSVGTransparencyColorStops)
-{
-aContentMetafile.setSVG(true);
-}
+// tdf#155479 always forward propagate SVG flag for sub-content,
+// it may contain cannotBeHandledByVCL gradients or 
transparencyGradients
+
aContentMetafile.setSVG(mpOutputDevice->GetConnectMetaFile()->getSVG());
 
 const tools::Rectangle aPrimitiveRectangle(impDumpToMetaFile(rContent, 
aContentMetafile));
 


[Libreoffice-commits] core.git: drawinglayer/source editeng/source i18npool/source include/editeng svx/CppunitTest_svx_styles.mk sw/CppunitTest_sw_uibase_uiview.mk

2023-06-15 Thread Noel Grandin (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   20 ++--
 drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx |3 
 editeng/source/editeng/eerdll.cxx  |   10 +-
 i18npool/source/localedata/LocaleNode.cxx  |   60 ++---
 i18npool/source/localedata/localedata.cxx  |   51 +++
 include/editeng/eerdll.hxx |1 
 svx/CppunitTest_svx_styles.mk  |1 
 sw/CppunitTest_sw_uibase_uiview.mk |1 
 8 files changed, 71 insertions(+), 76 deletions(-)

New commits:
commit 1a253362f6d1e1909913dce298630c92d431e41e
Author: Noel Grandin 
AuthorDate: Wed Jun 14 13:32:01 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Jun 15 18:15:18 2023 +0200

speed up startup time

by avoid conversion of static locale data from sal_Unicode to OUString
data - we can declare the data as OUStringConstExpr arrays and then
no conversion is necessary.

Here we trigger a problem - EditDLL has static data that tends
to get torn down __after__ the i18npool shared library has been
removed from memory, which means it tries to access OUStringLiteral
objects that no longer exists.

So use vcl::DeleteOnExit to explicitly clear that on application
shutdown.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 1b411d16f443..794f8085f9c8 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -520,7 +520,8 @@ void VclMetafileProcessor2D::popList()
 }
 
 // init static break iterator
-uno::Reference 
VclMetafileProcessor2D::mxBreakIterator;
+vcl::DeleteOnDeinit>
+VclMetafileProcessor2D::mxBreakIterator;
 
 VclMetafileProcessor2D::VclMetafileProcessor2D(const 
geometry::ViewInformation2D& rViewInformation,
OutputDevice& rOutDev)
@@ -1470,12 +1471,13 @@ void 
VclMetafileProcessor2D::processTextSimplePortionPrimitive2D(
 // #i101169# if(pTextDecoratedCandidate)
 {
 // support for TEXT_ MetaFile actions only for decorated texts
-if (!mxBreakIterator.is())
+if (!mxBreakIterator.get() || !mxBreakIterator.get()->get())
 {
 uno::Reference xContext(
 ::comphelper::getProcessComponentContext());
-mxBreakIterator = i18n::BreakIterator::create(xContext);
+mxBreakIterator.set(i18n::BreakIterator::create(xContext));
 }
+auto& rBreakIterator = *mxBreakIterator.get()->get();
 
 const OUString& rTxt = rTextCandidate.getText();
 const sal_Int32 nTextLength(rTextCandidate.getTextLength()); // 
rTxt.getLength());
@@ -1486,13 +1488,13 @@ void 
VclMetafileProcessor2D::processTextSimplePortionPrimitive2D(
 const sal_Int32 nTextPosition(rTextCandidate.getTextPosition());
 
 sal_Int32 nDone;
-sal_Int32 nNextCellBreak(mxBreakIterator->nextCharacters(
+sal_Int32 nNextCellBreak(rBreakIterator.nextCharacters(
 rTxt, nTextPosition, rLocale, 
css::i18n::CharacterIteratorMode::SKIPCELL, 0,
 nDone));
-css::i18n::Boundary 
nNextWordBoundary(mxBreakIterator->getWordBoundary(
+css::i18n::Boundary 
nNextWordBoundary(rBreakIterator.getWordBoundary(
 rTxt, nTextPosition, rLocale, css::i18n::WordType::ANY_WORD, 
true));
 sal_Int32 nNextSentenceBreak(
-mxBreakIterator->endOfSentence(rTxt, nTextPosition, rLocale));
+rBreakIterator.endOfSentence(rTxt, nTextPosition, rLocale));
 const OString aCommentStringA("XTEXT_EOC");
 const OString aCommentStringB("XTEXT_EOW");
 const OString aCommentStringC("XTEXT_EOS");
@@ -1504,21 +1506,21 @@ void 
VclMetafileProcessor2D::processTextSimplePortionPrimitive2D(
 {
 mpMetaFile->AddAction(
 new MetaCommentAction(aCommentStringA, i - 
nTextPosition));
-nNextCellBreak = mxBreakIterator->nextCharacters(
+nNextCellBreak = rBreakIterator.nextCharacters(
 rTxt, i, rLocale, 
css::i18n::CharacterIteratorMode::SKIPCELL, 1, nDone);
 }
 if (i == nNextWordBoundary.endPos)
 {
 mpMetaFile->AddAction(
 new MetaCommentAction(aCommentStringB, i - 
nTextPosition));
-nNextWordBoundary = mxBreakIterator->getWordBoundary(
+nNextWordBoundary = rBreakIterator.getWordBoundary(
 

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

2023-06-13 Thread Bartosz Kosiorek (via logerrit)
 dev/null |binary
 drawinglayer/source/tools/emfppath.cxx   |   42 +-
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |  263 +++
 emfio/qa/cppunit/emf/data/TestEmfPlusDrawCurve.emf   |binary
 emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emf |binary
 5 files changed, 143 insertions(+), 162 deletions(-)

New commits:
commit cbb215aa20783523555185c83875ea5d5b94535b
Author: Bartosz Kosiorek 
AuthorDate: Sat Jun 10 18:13:50 2023 +0200
Commit: Bartosz Kosiorek 
CommitDate: Tue Jun 13 12:59:33 2023 +0200

tdf#143877 Fix failing tests caused by floating point precision

Due to different imlementation of floating-point unit (FPU),
on different CPU platforms, the floating point numbers could
could be different.

https://stackoverflow.com/questions/64036879/differing-floating-point-calculation-results-between-x86-64-and-armv8-2-a

https://mcuoneclipse.com/2019/03/29/be-aware-floating-point-operations-on-arm-cortex-m4f/

With this path I have changed the tested images,
to use floating point numbers which are easily represented
by floating numbers (multiplied/divided by 2), like:
 - change tension to values: 0.125, 0.25, 0.5, 1.0, 1.5 ...
 - change position of curve to of control points to 256.0, 384.0 512.0

Previous values was hard to represent by floating numbers,
for example tension:
- 0.4 has been written as 0.39976158142
- 0.1 has been written as 0.09994039535

More information:
https://observablehq.com/@benaubin/floating-point

Additionally the precision of numbers were
increased to double.

Change-Id: I5725c1f2f474d0c00821edaa9bb2102cb172093f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152838
Reviewed-by: Stephan Bergmann 
Tested-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfppath.cxx 
b/drawinglayer/source/tools/emfppath.cxx
index bd5b2d357b0f..e7c4a5512c76 100644
--- a/drawinglayer/source/tools/emfppath.cxx
+++ b/drawinglayer/source/tools/emfppath.cxx
@@ -34,7 +34,12 @@ namespace
 
 namespace emfplushelper
 {
-typedef float matrix [4][4];
+typedef double matrix [4][4];
+
+constexpr sal_uInt32 nDetails = 8;
+constexpr double alpha[nDetails]
+= { 1. / nDetails, 2. / nDetails, 3. / nDetails, 4. / nDetails,
+5. / nDetails, 6. / nDetails, 7. / nDetails, 8. / nDetails };
 
 // see 2.2.2.21 EmfPlusInteger7
 // 2.2.2.22 EmfPlusInteger15
@@ -232,21 +237,20 @@ namespace emfplushelper
 m[0][2] = tension - 2.;
 m[1][0] = 2. * tension;
 m[1][1] = tension - 3.;
-m[1][2] = 3. - 2 * tension;
+m[1][2] = 3. - 2. * tension;
 m[3][1] = 1.;
 m[0][3] = m[2][2] = tension;
 m[0][0] = m[1][3] = m[2][0] = -tension;
 m[2][1] = m[2][3] = m[3][0] = m[3][2] = m[3][3] = 0.;
 }
 
-static float calculateSplineCoefficients(float p0, float p1, float p2, 
float p3, float alpha, matrix m)
+static double calculateSplineCoefficients(float p0, float p1, float p2, 
float p3, sal_uInt32 step, matrix m)
 {
-float a, b, c, d;
-a = m[0][0] * p0 + m[0][1] * p1 + m[0][2] * p2 + m[0][3] * p3;
-b = m[1][0] * p0 + m[1][1] * p1 + m[1][2] * p2 + m[1][3] * p3;
-c = m[2][0] * p0 + m[2][2] * p2;
-d = p1;
-return (d + alpha * (c + alpha * (b + alpha * a)));
+double a = m[0][0] * p0 + m[0][1] * p1 + m[0][2] * p2 + m[0][3] * p3;
+double b = m[1][0] * p0 + m[1][1] * p1 + m[1][2] * p2 + m[1][3] * p3;
+double c = m[2][0] * p0 + m[2][2] * p2;
+double d = p1;
+return (d + alpha[step] * (c + alpha[step] * (b + alpha[step] * a)));
 }
 
 ::basegfx::B2DPolyPolygon& EMFPPath::GetCardinalSpline(EmfPlusHelperData 
const& rR, float fTension,
@@ -254,11 +258,7 @@ namespace emfplushelper
 {
 ::basegfx::B2DPolygon polygon;
 matrix mat;
-float x, y;
-constexpr sal_uInt32 nDetails = 8;
-constexpr float alpha[nDetails]
-= { 1. / nDetails, 2. / nDetails, 3. / nDetails, 4. / nDetails,
-5. / nDetails, 6. / nDetails, 7. / nDetails, 8. / nDetails };
+double x, y;
 if (aNumSegments >= nPoints)
 aNumSegments = nPoints - 1;
 GetCardinalMatrix(fTension, mat);
@@ -274,9 +274,9 @@ namespace emfplushelper
 for (sal_uInt32 s = 0; s < nDetails; s++)
 {
 x = calculateSplineCoefficients(xPoints[i - 3], xPoints[i - 
2], xPoints[i - 1],
-xPoints[i], alpha[s], mat);
+xPoints[i], s, mat);
 y = calculateSplineCoefficients(yPoints[i - 3], yPoints[i - 
2], yPoints[i - 1],
-yPoints[i], alpha[s], mat);
+   

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

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

New commits:
commit fd1bd06509f4544cc18bdf2319c5456b33d08e52
Author: Andrea Gelmini 
AuthorDate: Fri Jun 9 13:24:34 2023 +0200
Commit: Julien Nabet 
CommitDate: Fri Jun 9 17:58:30 2023 +0200

Fix typo

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index feb30d33e1ed..1b411d16f443 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2387,7 +2387,7 @@ void 
VclMetafileProcessor2D::processTransparencePrimitive2D(
 // places using it would need adaption, ...), but combined with 
knowing that nearly
 // all usages ignore or render it locally anyways makes that a 
non-option.
 
-// tdf#155479 Yepp, as already mentionmed above we need to add
+// tdf#155479 Yepp, as already mentioned above we need to add
 // some MCGR infos in case of SVG export, prepare that here
 if (nullptr != mpOutputDevice->GetConnectMetaFile()
 && mpOutputDevice->GetConnectMetaFile()->getSVG())


[Libreoffice-commits] core.git: drawinglayer/source svgio/inc svgio/Library_svgio.mk svgio/qa svgio/source

2023-06-07 Thread Xisco Fauli (via logerrit)
 drawinglayer/source/tools/primitive2dxmldump.cxx |   13 +++
 svgio/Library_svgio.mk   |1 
 svgio/inc/svgfegaussianblurnode.hxx  |   59 +++
 svgio/inc/svgfilternode.hxx  |2 
 svgio/inc/svgtoken.hxx   |3 
 svgio/qa/cppunit/SvgImportTest.cxx   |   21 -
 svgio/qa/cppunit/data/filterFeGaussianBlur.svg   |   11 ++
 svgio/source/svgreader/svgdocumenthandler.cxx|   11 ++
 svgio/source/svgreader/svgfegaussianblurnode.cxx |   86 +++
 svgio/source/svgreader/svgfilternode.cxx |   22 +
 svgio/source/svgreader/svgstyleattributes.cxx|6 +
 svgio/source/svgreader/svgtoken.cxx  |6 +
 12 files changed, 235 insertions(+), 6 deletions(-)

New commits:
commit 77354ba8695f66331bfc6cc3f5e3f2e9d15f1740
Author: Xisco Fauli 
AuthorDate: Tue Jun 6 19:04:50 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed Jun 7 14:49:42 2023 +0200

tdf#132246: add basic support for feGaussianBlur

for now only apply it if in="SourceGraphic" is explicitly
used

Change-Id: I3daea354f61ba5f6b3d13da1e7a71e99d51f6729
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152684
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 2267a1080c13..7edb5bce5c89 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1134,6 +1135,18 @@ void Primitive2dXmlDump::decomposeAndWrite(
 rWriter.endElement();
 break;
 }
+case PRIMITIVE2D_ID_SOFTEDGEPRIMITIVE2D:
+{
+// SoftEdgePrimitive2D.
+const SoftEdgePrimitive2D& rSoftEdgePrimitive2D
+= dynamic_cast(*pBasePrimitive);
+rWriter.startElement("softedge");
+rWriter.attribute("radius", 
OUString::number(rSoftEdgePrimitive2D.getRadius()));
+
+decomposeAndWrite(rSoftEdgePrimitive2D.getChildren(), rWriter);
+rWriter.endElement();
+break;
+}
 
 case PRIMITIVE2D_ID_SCENEPRIMITIVE2D:
 {
diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk
index 8770f733d441..247653732d6f 100644
--- a/svgio/Library_svgio.mk
+++ b/svgio/Library_svgio.mk
@@ -57,6 +57,7 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\
 svgio/source/svgreader/svgellipsenode \
 svgio/source/svgreader/svggnode \
 svgio/source/svgreader/svganode \
+svgio/source/svgreader/svgfegaussianblurnode \
 svgio/source/svgreader/svgfilternode \
 svgio/source/svgreader/svggradientnode \
 svgio/source/svgreader/svggradientstopnode \
diff --git a/svgio/inc/svgfegaussianblurnode.hxx 
b/svgio/inc/svgfegaussianblurnode.hxx
new file mode 100644
index ..5dec4463198f
--- /dev/null
+++ b/svgio/inc/svgfegaussianblurnode.hxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include "svgnode.hxx"
+#include "svgstyleattributes.hxx"
+#include 
+
+namespace svgio::svgreader
+{
+/*
+FIXME: If no value is provided and this is the first filter primitive,
+then this filter primitive will use SourceGraphic as its input.
+If no value is provided and this is a subsequent filter primitive,
+then this filter primitive will use the result from the previous
+filter primitive as its input.
+*/
+enum class In
+{
+None,
+SourceGraphic
+};
+
+class SvgFeGaussianBlurNode final : public SvgNode
+{
+private:
+SvgNumber maStdDeviation;
+In maIn;
+
+public:
+SvgFeGaussianBlurNode(SvgDocument& rDocument, SvgNode* pParent);
+virtual ~SvgFeGaussianBlurNode() override;
+
+virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken,
+const OUString& aContent) override;
+
+void 

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

2023-06-01 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |   56 ++-
 drawinglayer/source/tools/emfphelperdata.hxx |2 
 drawinglayer/source/tools/emfppath.cxx   |  126 ++-
 drawinglayer/source/tools/emfppath.hxx   |5 
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |  184 +--
 emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emf |binary
 emfio/qa/cppunit/emf/data/TestEmfPlusRecordTypeDrawCurve.emf |binary
 7 files changed, 316 insertions(+), 57 deletions(-)

New commits:
commit 0b5c0d9e9d6c71d3531a7e1020af1753a50e873e
Author: Bartosz Kosiorek 
AuthorDate: Thu Jun 1 21:16:06 2023 +0200
Commit: Bartosz Kosiorek 
CommitDate: Thu Jun 1 21:17:06 2023 +0200

tdf#143877 EMF+ Implement EmfPlusDrawCurve with cardinal spline

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

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 879d40b925d5..b5b7d911476f 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -81,6 +81,8 @@ namespace emfplushelper
 case EmfPlusRecordTypeFillPolygon: return 
"EmfPlusRecordTypeFillPolygon";
 case EmfPlusRecordTypeDrawLines: return 
"EmfPlusRecordTypeDrawLines";
 case EmfPlusRecordTypeFillClosedCurve: return 
"EmfPlusRecordTypeFillClosedCurve";
+case EmfPlusRecordTypeDrawClosedCurve: return 
"EmfPlusRecordTypeDrawClosedCurve";
+case EmfPlusRecordTypeDrawCurve: return 
"EmfPlusRecordTypeDrawCurve";
 case EmfPlusRecordTypeFillEllipse: return 
"EmfPlusRecordTypeFillEllipse";
 case EmfPlusRecordTypeDrawEllipse: return 
"EmfPlusRecordTypeDrawEllipse";
 case EmfPlusRecordTypeFillPie: return "EmfPlusRecordTypeFillPie";
@@ -90,7 +92,6 @@ 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";
@@ -1374,6 +1375,30 @@ namespace emfplushelper
 
EMFPPlusDrawPolygon(::basegfx::B2DPolyPolygon(aPolygon), flags & 0xff);
 break;
 }
+case EmfPlusRecordTypeDrawCurve:
+{
+sal_uInt32 aOffset, aNumSegments, points;
+float aTension;
+rMS.ReadFloat(aTension);
+rMS.ReadUInt32(aOffset);
+rMS.ReadUInt32(aNumSegments);
+rMS.ReadUInt32(points);
+SAL_WARN("drawinglayer.emf",
+"EMF+\t Tension: " << aTension << " Offset: " 
<< aOffset
+   << " NumSegments: " << 
aNumSegments
+   << " Points: " << points);
+
+EMFPPath path(points, true);
+path.Read(rMS, flags);
+
+if (points >= 2)
+EMFPPlusDrawPolygon(
+path.GetCardinalSpline(*this, aTension, 
aOffset, aNumSegments),
+flags & 0xff);
+else
+SAL_WARN("drawinglayer.emf", "Not enough number of 
points");
+break;
+}
 case EmfPlusRecordTypeDrawClosedCurve:
 case EmfPlusRecordTypeFillClosedCurve:
 {
@@ -1383,28 +1408,29 @@ namespace emfplushelper
 if (type == EmfPlusRecordTypeFillClosedCurve)
 {
 rMS.ReadUInt32(brushIndexOrColor);
-SAL_INFO("drawinglayer.emf",
+SAL_INFO(
+"drawinglayer.emf",
 "EMF+\t Fill Mode: " << (flags & 0x2000 ? 
"Winding" : "Alternate"));
 }
 rMS.ReadFloat(aTension);
 rMS.ReadUInt32(points);
 SAL_WARN("drawinglayer.emf",
- "EMF+\t Tension: " << aTension << " Points: " 
<< points);
-

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

2023-05-31 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 74a306ef4aa425a5637c7c4766600de6c4bc504c
Author: Andrea Gelmini 
AuthorDate: Wed May 31 19:26:50 2023 +0200
Commit: Julien Nabet 
CommitDate: Wed May 31 21:04:19 2023 +0200

Fix typo

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 86ac335907d7..9b536bcbd3d7 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2311,7 +2311,7 @@ void 
VclMetafileProcessor2D::processTransparencePrimitive2D(
 //   - vcl/source/filter/wmf/emfwr.cxx -> same
 //   - vcl/source/filter/eps/eps.cxx -> same
 // NOTE: Theoretically it would be possible to make the new extended 
Gradient data
-// available in metafiles, with the known limitiations (not backward 
comp, all
+// available in metafiles, with the known limitations (not backward 
comp, all
 // places using it would need adaption, ...), but combined with 
knowing that nearly
 // all usages ignore or render it locally anyways makes that a 
non-option.
 pFiGradient = nullptr;


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

2023-05-31 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit aad2ca8bd3986510b2331752d92958c96ec93f9f
Author: Andrea Gelmini 
AuthorDate: Wed May 31 19:25:39 2023 +0200
Commit: Julien Nabet 
CommitDate: Wed May 31 21:03:30 2023 +0200

Fix typo

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index c73fa508fb60..86ac335907d7 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2301,7 +2301,7 @@ void 
VclMetafileProcessor2D::processTransparencePrimitive2D(
 if (nullptr != pFiGradient && 
pFiGradient->getFillGradient().cannotBeHandledByVCL())
 {
 // If not, reset the pointer and do not make use of this special case.
-// Adding a gradient in incomplete state that canot be handled by vcl
+// Adding a gradient in incomplete state that can not be handled by vcl
 // makes no sense and will knowingly lead to errors, especially with
 // MCGR extended possibilities. I checked what happens with the
 // MetaFloatTransparentAction added by OutputDevice::DrawTransparent, 
but


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

2023-05-31 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 006990b8d6337c232f0fe06fc284d83c44e6dc80
Author: Andrea Gelmini 
AuthorDate: Wed May 31 19:27:13 2023 +0200
Commit: Julien Nabet 
CommitDate: Wed May 31 21:02:03 2023 +0200

Fix typo

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index ea72d7ddccfc..c73fa508fb60 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2278,7 +2278,7 @@ void 
VclMetafileProcessor2D::processTransparencePrimitive2D(
 // try to identify a single FillGradientPrimitive2D in the
 // transparence part of the primitive. The hope is to handle
 // the more specific case in a better way than the general
-// TransparencePrimitive2D which has strongly seperated
+// TransparencePrimitive2D which has strongly separated
 // definitions for transparency and content, both completely
 // free definable by primitives
 const primitive2d::FillGradientPrimitive2D* pFiGradient(nullptr);


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

2023-05-31 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |  205 ++---
 1 file changed, 104 insertions(+), 101 deletions(-)

New commits:
commit f6c753cc0f42e94f89361b7d1c41dae069ed73aa
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue May 30 15:16:08 2023 +0200
Commit: Armin Le Grand 
CommitDate: Wed May 31 09:58:37 2023 +0200

MCGR: tdf#155437 handling of TransparencePrimitive2D for metafiles

In VclMetafileProcessor2D we need to take care of changed
circumstances for gradients with the MCGR adaptions. The
method processTransparencePrimitive2D tries to detect the
special case that the trapsparency part of the handled
TransparencePrimitive2D is a single TransparencyGradient.

If detected, this is handed directly to vcl using a
MetaFloatTransparentAction which contains a class
'Gradient', but the limited form from vcl (see
include/vcl/gradient.hxx). This class can only in very
limited scenarios directly handle/hold a gradient from
the model (even before MCGR).

For that case there is the helper method
'cannotBeHandledByVCL' that is already used to decide
if limited direct rendering using vcl can be used.
This has also be used here.

Also reworked the conversion to Bitmap as needed, the
existing versions created slight errors. For more
details see additional comments in the code.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 529a34ce599a..ea72d7ddccfc 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -64,6 +64,8 @@
 #include 
 #include 
 #include  // for 
Title/Description metadata
+#include 
+#include 
 
 #include 
 #include 
@@ -2266,28 +2268,59 @@ void 
VclMetafileProcessor2D::processTransparencePrimitive2D(
 // FillGradientPrimitive2D and reconstruct the gradient.
 // If that detection goes wrong, I have to create a transparence-blended 
bitmap. Eventually
 // do that in stripes, else RenderTransparencePrimitive2D may just be used
-const primitive2d::Primitive2DContainer& rContent = 
rTransparenceCandidate.getChildren();
-const primitive2d::Primitive2DContainer& rTransparence
-= rTransparenceCandidate.getTransparence();
+const primitive2d::Primitive2DContainer& 
rContent(rTransparenceCandidate.getChildren());
+const primitive2d::Primitive2DContainer& rTransparence(
+rTransparenceCandidate.getTransparence());
 
 if (rContent.empty() || rTransparence.empty())
 return;
 
 // try to identify a single FillGradientPrimitive2D in the
-// transparence part of the primitive
-const primitive2d::FillGradientPrimitive2D* pFiGradient = nullptr;
+// transparence part of the primitive. The hope is to handle
+// the more specific case in a better way than the general
+// TransparencePrimitive2D which has strongly seperated
+// definitions for transparency and content, both completely
+// free definable by primitives
+const primitive2d::FillGradientPrimitive2D* pFiGradient(nullptr);
 static bool bForceToBigTransparentVDev(false); // loplugin:constvars:ignore
 
+// check for single FillGradientPrimitive2D
 if (!bForceToBigTransparentVDev && 1 == rTransparence.size())
 {
-const primitive2d::Primitive2DReference xReference(rTransparence[0]);
-pFiGradient = dynamic_cast(xReference.get());
+pFiGradient
+= dynamic_cast(rTransparence[0].get());
+
+// check also for correct ID to exclude derived implementations
+if (pFiGradient
+&& PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D != 
pFiGradient->getPrimitive2DID())
+pFiGradient = nullptr;
 }
 
-// Check also for correct ID to exclude derived implementations
-if (pFiGradient && PRIMITIVE2D_ID_FILLGRADIENTPRIMITIVE2D == 
pFiGradient->getPrimitive2DID())
+// MCGR: tdf#155437 If we have identified a transparency gradient,
+// check if VCL is able to handle it at all
+if (nullptr != pFiGradient && 
pFiGradient->getFillGradient().cannotBeHandledByVCL())
 {
-// various content, create content-metafile
+// If not, reset the pointer and do not make use of this special case.
+// Adding a gradient in incomplete state that canot be handled by vcl
+// makes no sense and will knowingly lead to errors, especially with
+// MCGR extended possibilities. I checked what happens with the
+// MetaFloatTransparentAction added by OutputDevice::DrawTransparent, 
but
+// in most cases it gets converted to bitmap or even ignored, see e.g.
+// - 

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

2023-05-09 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/texture/texture.cxx |   20 ++--
 1 file changed, 6 insertions(+), 14 deletions(-)

New commits:
commit 81e77bcc7c454d79b302df7ad545e7da16b64ae0
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue May 9 12:29:30 2023 +0200
Commit: Armin Le Grand 
CommitDate: Tue May 9 15:03:11 2023 +0200

MCGR: Correct interpolate TextureMap due to possible zero value

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

diff --git a/drawinglayer/source/texture/texture.cxx 
b/drawinglayer/source/texture/texture.cxx
index aeeb5b61bb05..eb9df6469225 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -244,11 +244,7 @@ namespace drawinglayer::texture
 // set and add at target
 aCallback(
 maGradientInfo.getTextureTransform() * aNew,
-interpolate(
-aCStart, aCEnd,
-nSteps == 1
-? std::numeric_limits::infinity()
-: double(innerLoop) / double(nSteps - 1)));
+1 == nSteps ? aCStart : 
basegfx::BColor(interpolate(aCStart, aCEnd, double(innerLoop) / double(nSteps - 
1;
 }
 }
 
@@ -372,7 +368,7 @@ namespace drawinglayer::texture
 // set and add at target
 aCallback(
 maGradientInfo.getTextureTransform() * aNew,
-interpolate(aCStart, aCEnd, double(innerLoop) / 
double(nSteps - 1)));
+1 == nSteps ? aCStart : 
basegfx::BColor(interpolate(aCStart, aCEnd, double(innerLoop) / double(nSteps - 
1;
 }
 }
 
@@ -467,11 +463,7 @@ namespace drawinglayer::texture
 // set and add at target
 aCallback(
 maGradientInfo.getTextureTransform() * 
basegfx::utils::createScaleB2DHomMatrix(fSize, fSize),
-interpolate(
-aCStart, aCEnd,
-nSteps == 1
-? std::numeric_limits::infinity()
-: double(innerLoop) / double(nSteps - 1)));
+1 == nSteps ? aCStart : 
basegfx::BColor(interpolate(aCStart, aCEnd, double(innerLoop) / double(nSteps - 
1;
 }
 }
 
@@ -572,7 +564,7 @@ namespace drawinglayer::texture
 * basegfx::utils::createScaleB2DHomMatrix(
 1.0 - (bMTO ? fSize / fAR : fSize),
 1.0 - (bMTO ? fSize : fSize * fAR)),
-interpolate(aCStart, aCEnd, double(innerLoop) / 
double(nSteps - 1)));
+1 == nSteps ? aCStart : 
basegfx::BColor(interpolate(aCStart, aCEnd, double(innerLoop) / double(nSteps - 
1;
 }
 }
 
@@ -666,7 +658,7 @@ namespace drawinglayer::texture
 // set and add at target
 aCallback(
 maGradientInfo.getTextureTransform() * 
basegfx::utils::createScaleB2DHomMatrix(fSize, fSize),
-interpolate(aCStart, aCEnd, double(innerLoop) / 
double(nSteps - 1)));
+1 == nSteps ? aCStart : 
basegfx::BColor(interpolate(aCStart, aCEnd, double(innerLoop) / double(nSteps - 
1;
 }
 }
 
@@ -767,7 +759,7 @@ namespace drawinglayer::texture
 * basegfx::utils::createScaleB2DHomMatrix(
 1.0 - (bMTO ? fSize / fAR : fSize),
 1.0 - (bMTO ? fSize : fSize * fAR)),
-interpolate(aCStart, aCEnd, double(innerLoop) / 
double(nSteps - 1)));
+1 == nSteps ? aCStart : 
basegfx::BColor(interpolate(aCStart, aCEnd, double(innerLoop) / double(nSteps - 
1;
 }
 }
 


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

2023-04-28 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/geometry/viewinformation2d.cxx  |   35 +---
 include/drawinglayer/geometry/viewinformation2d.hxx |3 -
 svtools/source/config/optionsdrawinglayer.cxx   |   58 ++--
 3 files changed, 37 insertions(+), 59 deletions(-)

New commits:
commit 424bdeda9fea09f0b48b5551baf872656845c7c3
Author: Mike Kaganski 
AuthorDate: Fri Apr 28 12:32:19 2023 +0300
Commit: Mike Kaganski 
CommitDate: Fri Apr 28 16:29:56 2023 +0200

Move all handling of AA allowing from svt to drawinglayer

Commit 444bf8710d5da7b584fbcb94693e4ed8d2e29297 (Update handling of
AntiAliasing settings and processor2d, 2022-11-08) moved the actual
variable holding the AA state to drawinglayer, which introduced a
duplication of the information.

This moves all the handling from svt to drawinglayer, so that svt
functions only use respective drawinglayer functions. Well, almost:
the IsAAPossibleOnThisSystem function needs vcl, so stays in svt.

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

diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx 
b/drawinglayer/source/geometry/viewinformation2d.cxx
index 7e0240690a68..03089e41e36f 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -25,8 +25,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+
+#include 
 #include 
 
 using namespace com::sun::star;
@@ -48,7 +51,6 @@ constexpr OUStringLiteral g_PropertyName_PixelSnapHairline = 
u"PixelSnapHairline
 namespace
 {
 bool bForwardsAreInitialized(false);
-bool bForwardedAntiAliasing(true);
 bool bForwardPixelSnapHairline(true);
 }
 
@@ -105,8 +107,8 @@ public:
 , mxVisualizedPage()
 , mfViewTime(0.0)
 , mbReducedDisplayQuality(false)
-, mbUseAntiAliasing(bForwardedAntiAliasing)
-, mbPixelSnapHairline(bForwardedAntiAliasing && 
bForwardPixelSnapHairline)
+, mbUseAntiAliasing(ViewInformation2D::getGlobalAntiAliasing())
+, mbPixelSnapHairline(mbUseAntiAliasing && bForwardPixelSnapHairline)
 {
 }
 
@@ -227,13 +229,12 @@ ViewInformation2D::ViewInformation2D()
 bForwardsAreInitialized = true;
 if (!utl::ConfigManager::IsFuzzing())
 {
-bForwardedAntiAliasing = 
officecfg::Office::Common::Drawinglayer::AntiAliasing::get();
 bForwardPixelSnapHairline
 = 
officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get();
 }
 }
 
-setUseAntiAliasing(bForwardedAntiAliasing);
+setUseAntiAliasing(ViewInformation2D::getGlobalAntiAliasing());
 setPixelSnapHairline(bForwardPixelSnapHairline);
 }
 
@@ -352,10 +353,30 @@ void ViewInformation2D::setPixelSnapHairline(bool bNew)
 mpViewInformation2D->setPixelSnapHairline(bNew);
 }
 
-void ViewInformation2D::forwardAntiAliasing(bool bAntiAliasing)
+static std::atomic& globalAntiAliasing()
+{
+static std::atomic g_GlobalAntiAliasing
+= utl::ConfigManager::IsFuzzing()
+  || officecfg::Office::Common::Drawinglayer::AntiAliasing::get();
+return g_GlobalAntiAliasing;
+}
+
+/**
+  * Some code like to turn this stuff on and off during a drawing operation
+  * so it can "tunnel" information down through several layers,
+  * so we don't want to actually do a config write all the time.
+  */
+void ViewInformation2D::setGlobalAntiAliasing(bool bAntiAliasing, bool 
bTemporary)
 {
-bForwardedAntiAliasing = bAntiAliasing;
+if 
(globalAntiAliasing().compare_exchange_strong(o3tl::temporary(!bAntiAliasing), 
bAntiAliasing)
+&& !bTemporary)
+{
+auto batch = comphelper::ConfigurationChanges::create();
+
officecfg::Office::Common::Drawinglayer::AntiAliasing::set(bAntiAliasing, 
batch);
+batch->commit();
+}
 }
+bool ViewInformation2D::getGlobalAntiAliasing() { return globalAntiAliasing(); 
}
 
 void ViewInformation2D::forwardPixelSnapHairline(bool bPixelSnapHairline)
 {
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx 
b/include/drawinglayer/geometry/viewinformation2d.hxx
index e71ab08faead..8f1bd634fd58 100644
--- a/include/drawinglayer/geometry/viewinformation2d.hxx
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -159,7 +159,8 @@ public:
 bool getPixelSnapHairline() const;
 void setPixelSnapHairline(bool bNew);
 
-static void forwardAntiAliasing(bool bAntiAliasing);
+static void setGlobalAntiAliasing(bool bAntiAliasing, bool bTemporary);
+static bool getGlobalAntiAliasing();
 static void forwardPixelSnapHairline(bool bPixelSnapHairline);
 };
 
diff --git a/svtools/source/config/optionsdrawinglayer.cxx 
b/svtools/source/config/optionsdrawinglayer.cxx
index 0564adffa94c..a4ec26ad921d 100644
--- 

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

2023-04-27 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |   21 ++---
 1 file changed, 10 insertions(+), 11 deletions(-)

New commits:
commit b79a5cdcf0b98fef4b5bfeb380efcea322e9a51a
Author: Bartosz Kosiorek 
AuthorDate: Thu Apr 27 15:05:03 2023 +0200
Commit: Bartosz Kosiorek 
CommitDate: Thu Apr 27 21:17:15 2023 +0200

EMF+ tdf#103859 Optimize EmfPlusFillRects and EmfPlusDrawRects

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

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index a1e9b3b7adce..879d40b925d5 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1255,7 +1255,9 @@ namespace emfplushelper
 {
 // Silent MSVC warning C4701: potentially 
uninitialized local variable 'brushIndexOrColor' used
 sal_uInt32 brushIndexOrColor = 999;
-sal_Int32 rectangles;
+::basegfx::B2DPolyPolygon polyPolygon;
+sal_uInt32 rectangles;
+float x, y, width, height;
 const bool isColor = (flags & 0x8000);
 ::basegfx::B2DPolygon polygon;
 
@@ -1270,11 +1272,9 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf", "EMF+\t DrawRects");
 }
 
-rMS.ReadInt32(rectangles);
-
-for (int i = 0; i < rectangles; i++)
+rMS.ReadUInt32(rectangles);
+for (sal_uInt32 i = 0; i < rectangles; i++)
 {
-float x, y, width, height;
 ReadRectangle(rMS, x, y, width, height, bool(flags 
& 0x4000));
 polygon.clear();
 polygon.append(Map(x, y));
@@ -1284,13 +1284,12 @@ namespace emfplushelper
 polygon.setClosed(true);
 
 SAL_INFO("drawinglayer.emf", "EMF+\t\t rectangle: 
" << x << ", "<< y << " " << width << "x" << height);
-
-::basegfx::B2DPolyPolygon polyPolygon(polygon);
-if (type == EmfPlusRecordTypeFillRects)
-EMFPPlusFillPolygon(polyPolygon, isColor, 
brushIndexOrColor);
-else
-EMFPPlusDrawPolygon(polyPolygon, flags & 0xff);
+polyPolygon.append(polygon);
 }
+if (type == EmfPlusRecordTypeFillRects)
+EMFPPlusFillPolygon(polyPolygon, isColor, 
brushIndexOrColor);
+else
+EMFPPlusDrawPolygon(polyPolygon, flags & 0xff);
 break;
 }
 case EmfPlusRecordTypeFillPolygon:


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

2023-04-24 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |   12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

New commits:
commit 12e23067fd0acad3e06df50cefaa0a2cd73df3b5
Author: Bartosz Kosiorek 
AuthorDate: Mon Apr 24 05:08:00 2023 +0200
Commit: Bartosz Kosiorek 
CommitDate: Mon Apr 24 08:24:09 2023 +0200

EMF+ Minor optimization and clean up code of DrawBeziers

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

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 94c4c32f026f..a1e9b3b7adce 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1340,7 +1340,6 @@ namespace emfplushelper
 {
 sal_uInt32 aCount;
 float x1, y1, x2, y2, x3, y3, x4, y4;
-::basegfx::B2DPoint aStartPoint, aControlPointA, 
aControlPointB, aEndPoint;
 ::basegfx::B2DPolygon aPolygon;
 rMS.ReadUInt32(aCount);
 SAL_INFO("drawinglayer.emf", "EMF+\t DrawBeziers slot: 
" << (flags & 0xff));
@@ -1359,8 +1358,7 @@ namespace emfplushelper
 
 ReadPoint(rMS, x1, y1, flags);
 // We need to add first starting point
-aStartPoint = Map(x1, y1);
-aPolygon.append(aStartPoint);
+aPolygon.append(Map(x1, y1));
 SAL_INFO("drawinglayer.emf",
  "EMF+\t Bezier starting point: " << x1 << "," 
<< y1);
 for (sal_uInt32 i = 4; i <= aCount; i += 3)
@@ -1372,13 +1370,7 @@ namespace emfplushelper
 SAL_INFO("drawinglayer.emf",
  "EMF+\t Bezier points: " << x2 << "," << 
y2 << " " << x3 << ","
   << y3 << " " << 
x4 << "," << y4);
-
-aControlPointA = Map(x2, y2);
-aControlPointB = Map(x3, y3);
-aEndPoint = Map(x4, y4);
-aPolygon.appendBezierSegment(aControlPointA, 
aControlPointB, aEndPoint);
-// The ending coordinate of one Bezier curve is 
the starting coordinate of the next.
-aStartPoint = aEndPoint;
+aPolygon.appendBezierSegment(Map(x2, y2), Map(x3, 
y3), Map(x4, y4));
 }
 
EMFPPlusDrawPolygon(::basegfx::B2DPolyPolygon(aPolygon), flags & 0xff);
 break;


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

2023-04-23 Thread Bartosz Kosiorek (via logerrit)
 drawinglayer/source/tools/emfphelperdata.cxx |   27 +-
 emfio/qa/cppunit/emf/EmfImportTest.cxx   |   28 +++
 emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emf |binary
 3 files changed, 42 insertions(+), 13 deletions(-)

New commits:
commit ce008fa9d8f2752bdfeaeff763aafc774a4b4fb2
Author: Bartosz Kosiorek 
AuthorDate: Sun Apr 23 01:37:20 2023 +0200
Commit: Bartosz Kosiorek 
CommitDate: Sun Apr 23 17:42:21 2023 +0200

tdf#154789 EMF+ Performance boost of the EmfPlusRecordTypeDrawBeziers

There is several benefits of such performance optimization:
 1. We are drawing single curve instead of hundreds of small curves.
In the loop we are creating single Polygon and outside
of the loop we are invoking EMFPPlusDrawPolygon drawing method only
once. As https://bugs.documentfoundation.org/attachment.cgi?id=186725
image is using single EmfPlusRecordTypeDrawBeziers EMF+ record with
hundreds of curves, with using single EMFPPlusDrawPolygon call,
there is no lnger need for individual line creation (e.g. line
color, weight, line caps, line joints, line dashes, etc.)

- The PDF export performance without optimizations of the 
https://bugs.documentfoundation.org/attachment.cgi?id=186725:

time ./instdir/program/soffice --headless --convert-to 
"pdf:writer_pdf_Export" --outdir ~ ~/Pobrane/problem.docx
real 24m18,471s
user 2m56,004s
sys 1m37,816

- The PDF export performance with optimizations:

real 0m37,527s
user 0m37,004s
sys 0m0,531s

- With Libreoffice 7.5.2 from Ubuntu 22.04, the conversion was
crashed.

 2. The PDF export for document: 
https://bugs.documentfoundation.org/attachment.cgi?id=186725
was not working correctly for me. The original image is containing
chart. Without optimization, the exported chart was empty.
Current export is working correctly, and graph is visible.

 3. The standard opening of the document from 
https://bugs.documentfoundation.org/attachment.cgi?id=186725
is now much faster. The zooming in, move image operations are also
noticible faster.

Change-Id: Ic77d4c20a462587bb5da4a4df757e30c5ca04fc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150821
Tested-by: Jenkins
Reviewed-by: Noel Grandin 
Reviewed-by: Bartosz Kosiorek 

diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index b8a3abb2bac1..94c4c32f026f 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1345,11 +1345,15 @@ namespace emfplushelper
 rMS.ReadUInt32(aCount);
 SAL_INFO("drawinglayer.emf", "EMF+\t DrawBeziers slot: 
" << (flags & 0xff));
 SAL_INFO("drawinglayer.emf", "EMF+\t Number of points: 
" << aCount);
-SAL_WARN_IF((aCount - 1) % 3 != 0, "drawinglayer.emf", 
"EMF+\t Bezier Draw not support number of points other than 4, 7, 10, 13, 
16...");
+SAL_WARN_IF((aCount - 1) % 3 != 0, "drawinglayer.emf",
+"EMF+\t Bezier Draw not support number of 
points other than 4, 7, "
+"10, 13, 16...");
 
 if (aCount < 4)
 {
-SAL_WARN("drawinglayer.emf", "EMF+\t Bezier Draw 
does not support less than 4 points. Number of points: " << aCount);
+SAL_WARN("drawinglayer.emf", "EMF+\t Bezier Draw 
does not support less "
+ "than 4 points. 
Number of points: "
+ << aCount);
 break;
 }
 
@@ -1357,29 +1361,26 @@ namespace emfplushelper
 // We need to add first starting point
 aStartPoint = Map(x1, y1);
 aPolygon.append(aStartPoint);
-
+SAL_INFO("drawinglayer.emf",
+ "EMF+\t Bezier starting point: " << x1 << "," 
<< y1);
 for (sal_uInt32 i = 4; i <= aCount; i += 3)
 {
 ReadPoint(rMS, x2, y2, flags);
 ReadPoint(rMS, x3, y3, flags);
 ReadPoint(rMS, x4, y4, flags);
 
-SAL_INFO("drawinglayer.emf", "EMF+\t Bezier 
points: " << x1 << "," << y1 << " " << x2 << "," << y2 << " " << x3 << "," << 
y3 << " " << x4 << "," << y4);
+SAL_INFO("drawinglayer.emf",
+ "EMF+\t Bezier points: " << x2 << "," 

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

2023-04-22 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |   13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

New commits:
commit 0ad8d64478759abce42b0c11024e7460f6eb
Author: Caolán McNamara 
AuthorDate: Fri Apr 21 20:22:12 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sat Apr 22 22:34:17 2023 +0200

tdf#154957 Revert "use OutputDevice clipping if its just a set of 
rectangles"

it was an attempt at an optimization, but if it doesn't work just revert it.

The non-antialias case also doesn't work so the reverted commit
wasn't itself the problem but the existing path has some flaw I'm not
going to invest in figuring out.

This reverts commit ee0d5e7bb8614c50e71dd074b8440f412eb62ff3.

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

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index ecfbf31f7ec4..ad680803438d 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -845,17 +845,6 @@ void VclProcessor2D::RenderPolyPolygonGraphicPrimitive2D(
 }
 }
 
-namespace
-{
-bool isRectangles(const basegfx::B2DPolyPolygon& rPolyPoly)
-{
-for (sal_uInt32 i = 0, nCount = rPolyPoly.count(); i < nCount; ++i)
-if (!basegfx::utils::isRectangle(rPolyPoly.getB2DPolygon(i)))
-return false;
-return true;
-}
-}
-
 // mask group
 void VclProcessor2D::RenderMaskPrimitive2DPixel(const 
primitive2d::MaskPrimitive2D& rMaskCandidate)
 {
@@ -870,7 +859,7 @@ void VclProcessor2D::RenderMaskPrimitive2DPixel(const 
primitive2d::MaskPrimitive
 aMask.transform(maCurrentTransformation);
 
 // Unless smooth edges are needed, simply use clipping.
-if (isRectangles(aMask) || !getViewInformation2D().getUseAntiAliasing())
+if (basegfx::utils::isRectangle(aMask) || 
!getViewInformation2D().getUseAntiAliasing())
 {
 mpOutputDevice->Push(vcl::PushFlags::CLIPREGION);
 mpOutputDevice->IntersectClipRegion(vcl::Region(aMask));


[Libreoffice-commits] core.git: drawinglayer/source include/docmodel include/drawinglayer include/editeng include/svx oox/source svx/Library_svxcore.mk svx/qa svx/source sw/qa

2023-04-18 Thread Sarper Akdemir (via logerrit)
 drawinglayer/source/attribute/sdrshadowattribute.cxx  |   13 
 include/docmodel/theme/FormatScheme.hxx   |2 
 include/drawinglayer/attribute/sdrshadowattribute.hxx |6 ++
 include/editeng/unoprnms.hxx  |1 
 include/svx/RectangleAlignmentItem.hxx|   42 
 include/svx/svddef.hxx|4 +
 include/svx/unoshprp.hxx  |3 -
 oox/source/drawingml/effectproperties.cxx |5 +
 oox/source/drawingml/effectproperties.hxx |5 +
 oox/source/drawingml/effectpropertiescontext.cxx  |1 
 oox/source/token/properties.txt   |1 
 svx/Library_svxcore.mk|1 
 svx/qa/unit/data/tdf150020-shadow-alignment.pptx  |binary
 svx/qa/unit/sdr.cxx   |   47 ++
 svx/source/items/RectangleAlignmentItem.cxx   |   31 +++
 svx/source/sdr/primitive2d/sdrattributecreator.cxx|5 +
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx  |   45 -
 svx/source/svdraw/svdattr.cxx |4 +
 sw/qa/extras/layout/layout.cxx|   17 --
 19 files changed, 213 insertions(+), 20 deletions(-)

New commits:
commit c27946fb157fe46fbfaefbe93f2c6794b1af4411
Author: Sarper Akdemir 
AuthorDate: Wed Mar 15 19:25:03 2023 +0300
Commit: Sarper Akdemir 
CommitDate: Tue Apr 18 17:43:18 2023 +0200

tdf#150020 pptx import: handle algn for outerShdw

Introduces RectangleAlignmentItem that holds a value of the enum
model::RectangleAlignment.

Introduces SDRATTR_SHADOWALIGNMENT that holds alignment for a shadow.

Implements import of algn for outerShdw.

Makes the alignment considered while the shadow is being scaled.
Also adds a unit test that covers this.

Change-Id: I8f4eaed5f0d9428a7f405c65f19237f9e70ca151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148934
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir 

diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx 
b/drawinglayer/source/attribute/sdrshadowattribute.cxx
index 6e046f1f07c7..1eb1b3ea687c 100644
--- a/drawinglayer/source/attribute/sdrshadowattribute.cxx
+++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 namespace drawinglayer::attribute
@@ -32,6 +33,7 @@ namespace drawinglayer::attribute
 basegfx::B2DVector  maSize; // 
[0.0 .. 2.0]
 double  mfTransparence; // 
[0.0 .. 1.0], 0.0==no transp.
 sal_Int32   mnBlur; // 
[0   .. 180], radius of the blur
+model::RectangleAlignment   
meAlignment{model::RectangleAlignment::Unset}; // alignment of the shadow
 basegfx::BColor maColor;// 
color of shadow
 
 ImpSdrShadowAttribute(
@@ -39,11 +41,13 @@ namespace drawinglayer::attribute
 const basegfx::B2DVector& rSize,
 double fTransparence,
 sal_Int32 nBlur,
+model::RectangleAlignment eAlignment,
 const basegfx::BColor& rColor)
 :   maOffset(rOffset),
 maSize(rSize),
 mfTransparence(fTransparence),
 mnBlur(nBlur),
+meAlignment(eAlignment),
 maColor(rColor)
 {
 }
@@ -67,6 +71,7 @@ namespace drawinglayer::attribute
 && getSize() == rCandidate.getSize()
 && getTransparence() == rCandidate.getTransparence()
 && getBlur() == rCandidate.getBlur()
+&& meAlignment == rCandidate.meAlignment
 && getColor() == rCandidate.getColor());
 }
 };
@@ -86,9 +91,10 @@ namespace drawinglayer::attribute
 const basegfx::B2DVector& rSize,
 double fTransparence,
 sal_Int32 nBlur,
+model::RectangleAlignment eAlignment,
 const basegfx::BColor& rColor)
 :   mpSdrShadowAttribute(ImpSdrShadowAttribute(
-rOffset, rSize, fTransparence,nBlur, rColor))
+rOffset, rSize, fTransparence, nBlur, eAlignment, rColor))
 {
 }
 
@@ -141,6 +147,11 @@ namespace drawinglayer::attribute
 return mpSdrShadowAttribute->getBlur();
 }
 
+model::RectangleAlignment SdrShadowAttribute::getAlignment() const
+{
+return mpSdrShadowAttribute->meAlignment;
+}
+
 const basegfx::BColor& SdrShadowAttribute::getColor() const
 {
 return mpSdrShadowAttribute->getColor();
diff --git 

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

2023-04-06 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   23 -
 1 file changed, 22 insertions(+), 1 deletion(-)

New commits:
commit 5ef4d326a06f9fc0aff36bd5cdcba1b7af8e03db
Author: Michael Stahl 
AuthorDate: Wed Apr 5 18:00:27 2023 +0200
Commit: Michael Stahl 
CommitDate: Thu Apr 6 09:34:52 2023 +0200

tdf#152234 drawinglayer: PDF/UA export: fallback for unsupported forms

veraPDF complains:

  Specification: ISO 14289-1:2014, Clause: 7.1, Test number: 3
  Content shall be marked as Artifact or tagged as real content

Form element can only be used for those form controls for which
PDFWriterImpl can produce a Widget annotation; see createDefaultWidget().

For a label control, it's not editable so it's not a PDF widget.

For an image button, it could be implemented in VCL but isn't currently.

So a fallback is required in any case, "Figure" or "Div" can be used.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 58396ba0c73b..9adbb7501701 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1157,7 +1157,6 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 pPDFControl->TextFont.SetFontSize(aFontSize);
 
 mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form);
-OUString const& rAltText(rControlPrimitive.GetAltText());
 vcl::PDFWriter::StructAttributeValue role;
 switch (pPDFControl->Type)
 {
@@ -1177,6 +1176,7 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 // ISO 14289-1:2014, Clause: 7.18.4
 mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Role, 
role);
 // ISO 14289-1:2014, Clause: 7.18.1
+OUString const& rAltText(rControlPrimitive.GetAltText());
 if (!rAltText.isEmpty())
 {
 mpPDFExtOutDevData->SetAlternateText(rAltText);
@@ -1196,6 +1196,22 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 }
 }
 
+if (!bDoProcessRecursively)
+{
+return;
+}
+
+if (mpPDFExtOutDevData)
+{ // no corresponding PDF Form, use Figure instead
+mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Figure);
+mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement, 
vcl::PDFWriter::Block);
+OUString const& rAltText(rControlPrimitive.GetAltText());
+if (!rAltText.isEmpty())
+{
+mpPDFExtOutDevData->SetAlternateText(rAltText);
+}
+}
+
 // #i93169# used flag the wrong way; true means that nothing was done yet
 if (bDoProcessRecursively)
 {
@@ -1240,6 +1256,11 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 {
 process(rControlPrimitive);
 }
+
+if (mpPDFExtOutDevData)
+{
+mpPDFExtOutDevData->EndStructureElement();
+}
 }
 
 void VclMetafileProcessor2D::processTextHierarchyFieldPrimitive2D(


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

2023-04-04 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   19 +
 include/vcl/pdfwriter.hxx  |4 
 vcl/qa/cppunit/pdfexport/data/formcontrol.fodt |  192 +
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |  132 
 vcl/source/gdi/pdfwriter_impl.cxx  |   72 ++--
 5 files changed, 387 insertions(+), 32 deletions(-)

New commits:
commit 2a87a59a52ae26db5106f7d1f4346225d032b550
Author: Michael Stahl 
AuthorDate: Mon Mar 27 12:51:24 2023 +0200
Commit: Michael Stahl 
CommitDate: Tue Apr 4 15:01:15 2023 +0200

tdf#152234 vcl,drawinglayer: PDF/UA export: produce Role for form controls

veraPDF complains:

  Specification: ISO 14289-1:2014, Clause: 7.18.4, Test number: 2
  If the Form element omits a Role attribute (Table 348), it shall have
  only one child: an object reference (14.7.4.3) identifying the widget
  annotation per ISO 32000-1:2008, 14.8.4.5, Table 340.

LO forms produce both page content in an MCID and an /Annot, so Role is
needed.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 56675ff113ef..58396ba0c73b 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1158,6 +1158,25 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 
 mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form);
 OUString const& rAltText(rControlPrimitive.GetAltText());
+vcl::PDFWriter::StructAttributeValue role;
+switch (pPDFControl->Type)
+{
+case vcl::PDFWriter::PushButton:
+role = vcl::PDFWriter::Pb;
+break;
+case vcl::PDFWriter::RadioButton:
+role = vcl::PDFWriter::Rb;
+break;
+case vcl::PDFWriter::CheckBox:
+role = vcl::PDFWriter::Cb;
+break;
+default: // there is a paucity of roles, tv is the catch-all 
one
+role = vcl::PDFWriter::Tv;
+break;
+}
+// ISO 14289-1:2014, Clause: 7.18.4
+mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Role, 
role);
+// ISO 14289-1:2014, Clause: 7.18.1
 if (!rAltText.isEmpty())
 {
 mpPDFExtOutDevData->SetAlternateText(rAltText);
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index b16e7120b398..0d959f9add34 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -141,7 +141,7 @@ public:
 Placement, WritingMode, SpaceBefore, SpaceAfter, StartIndent, 
EndIndent,
 TextIndent, TextAlign, Width, Height, BlockAlign, InlineAlign,
 LineHeight, BaselineShift, TextDecorationType, ListNumbering,
-RowSpan, ColSpan, Scope,
+RowSpan, ColSpan, Scope, Role,
 
 // link destination is an artificial attribute that sets
 // the link annotation ID of a Link element
@@ -180,6 +180,8 @@ public:
 Underline, Overline, LineThrough,
 // Scope
 Row, Column, Both,
+// Role
+Rb, Cb, Pb, Tv,
 // ListNumbering
 Disc, Circle, Square, Decimal, UpperRoman, LowerRoman, UpperAlpha, 
LowerAlpha
 };
diff --git a/vcl/qa/cppunit/pdfexport/data/formcontrol.fodt 
b/vcl/qa/cppunit/pdfexport/data/formcontrol.fodt
new file mode 100644
index ..f6ec84585217
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/formcontrol.fodt
@@ -0,0 +1,192 @@
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; xmlns:c
 

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

2023-04-02 Thread Armin Le Grand (Allotropia) (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx  |   86 +++
 include/drawinglayer/processor2d/d2dpixelprocessor2d.hxx |   13 ++
 2 files changed, 79 insertions(+), 20 deletions(-)

New commits:
commit 389f338da025aa7bc26556a7167cd272b64b77fd
Author: Armin Le Grand (Allotropia) 
AuthorDate: Fri Mar 31 16:05:28 2023 +0200
Commit: Armin Le Grand 
CommitDate: Sun Apr 2 13:18:59 2023 +0200

SDPR: Use currently added lambda to render Gradients

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 0670ad2febd8..783060c2be4c 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -817,19 +818,10 @@ void 
D2DPixelProcessor2D::processPolygonHairlinePrimitive2D(
 increaseError();
 }
 
-void D2DPixelProcessor2D::processPolyPolygonColorPrimitive2D(
-const primitive2d::PolyPolygonColorPrimitive2D& 
rPolyPolygonColorPrimitive2D)
+bool D2DPixelProcessor2D::drawPolyPolygonColorTransformed(
+const basegfx::B2DHomMatrix& rTansformation, const 
basegfx::B2DPolyPolygon& rPolyPolygon,
+const basegfx::BColor& rColor)
 {
-const basegfx::B2DPolyPolygon& 
rPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon());
-const sal_uInt32 nCount(rPolyPolygon.count());
-
-if (!nCount)
-{
-// no geometry, done
-return;
-}
-
-bool bDone(false);
 std::shared_ptr 
pSystemDependentData_ID2D1PathGeometry(
 getOrCreateFillGeometry(rPolyPolygon));
 
@@ -837,19 +829,18 @@ void 
D2DPixelProcessor2D::processPolyPolygonColorPrimitive2D(
 {
 sal::systools::COMReference 
pTransformedGeometry;
 const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 
0.5 : 0.0);
-const basegfx::B2DHomMatrix& rObjectToView(
-getViewInformation2D().getObjectToViewTransformation());
+basegfx::B2DHomMatrix 
aTansformation(getViewInformation2D().getObjectToViewTransformation()
+ * rTansformation);
 HRESULT 
hr(aID2D1GlobalFactoryProvider.getID2D1Factory()->CreateTransformedGeometry(
 pSystemDependentData_ID2D1PathGeometry->getID2D1PathGeometry(),
-D2D1::Matrix3x2F(rObjectToView.a(), rObjectToView.b(), 
rObjectToView.c(),
- rObjectToView.d(), rObjectToView.e() + fAAOffset,
- rObjectToView.f() + fAAOffset),
+D2D1::Matrix3x2F(aTansformation.a(), aTansformation.b(), 
aTansformation.c(),
+ aTansformation.d(), aTansformation.e() + 
fAAOffset,
+ aTansformation.f() + fAAOffset),
 ));
 
 if (SUCCEEDED(hr) && pTransformedGeometry)
 {
-const basegfx::BColor aFillColor(
-
maBColorModifierStack.getModifiedColor(rPolyPolygonColorPrimitive2D.getBColor()));
+const basegfx::BColor 
aFillColor(maBColorModifierStack.getModifiedColor(rColor));
 const D2D1::ColorF aD2DColor(aFillColor.getRed(), 
aFillColor.getGreen(),
  aFillColor.getBlue());
 
@@ -860,11 +851,29 @@ void 
D2DPixelProcessor2D::processPolyPolygonColorPrimitive2D(
 {
 getRenderTarget()->SetTransform(D2D1::Matrix3x2F::Identity());
 getRenderTarget()->FillGeometry(pTransformedGeometry, 
pColorBrush);
-bDone = true;
+return true;
 }
 }
 }
 
+return false;
+}
+
+void D2DPixelProcessor2D::processPolyPolygonColorPrimitive2D(
+const primitive2d::PolyPolygonColorPrimitive2D& 
rPolyPolygonColorPrimitive2D)
+{
+const basegfx::B2DPolyPolygon& 
rPolyPolygon(rPolyPolygonColorPrimitive2D.getB2DPolyPolygon());
+const sal_uInt32 nCount(rPolyPolygon.count());
+
+if (!nCount)
+{
+// no geometry, done
+return;
+}
+
+const bool bDone(drawPolyPolygonColorTransformed(basegfx::B2DHomMatrix(), 
rPolyPolygon,
+ 
rPolyPolygonColorPrimitive2D.getBColor()));
+
 if (!bDone)
 increaseError();
 }
@@ -1912,6 +1921,37 @@ void D2DPixelProcessor2D::processFillGraphicPrimitive2D(
 increaseError();
 }
 
+void D2DPixelProcessor2D::processFillGradientPrimitive2D(
+const primitive2d::FillGradientPrimitive2D& rFillGradientPrimitive2D)
+{
+// draw all-covering initial BG polygon 1st
+bool bDone(drawPolyPolygonColorTransformed(
+basegfx::B2DHomMatrix(),
+basegfx::B2DPolyPolygon(
+

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

2023-03-27 Thread Michael Stahl (via logerrit)
 drawinglayer/source/primitive2d/controlprimitive2d.cxx |   20 +++--
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |7 +++-
 include/drawinglayer/primitive2d/controlprimitive2d.hxx|   14 +
 svx/source/sdr/contact/viewcontactofunocontrol.cxx |5 ++-
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx   |4 +-
 5 files changed, 31 insertions(+), 19 deletions(-)

New commits:
commit 002a6fee2fbd07c3f0cd1f1ddba39c691130727e
Author: Michael Stahl 
AuthorDate: Fri Mar 24 18:45:53 2023 +0100
Commit: Michael Stahl 
CommitDate: Mon Mar 27 08:40:08 2023 +

tdf#152234 drawinglayer,svx: PDF/UA export: add Alt text to form controls

  Specification: ISO 14289-1:2014, Clause: 7.18.1, Test number: 3
  A form field whose hidden flag is not set and whose rectangle is not 
outside the crop-box shall have a TU key present or all its Widget annotations 
shall have alternative descriptions (in the form of an Alt entry in the 
enclosing structure elements)

Form controls are weird because they have an SdrObject with the usual
name/title/description plus a property "HelpText" on the control itself
which is already exported as "/TU" on the /Annot unless it's empty.

Exporting the SdrObject properties via ObjectInfoPrimitive2D doesn't
work as tragically that is only created for form controls when painting
to the screen while PDF export takes a detour that needs special
handling.

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

diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx 
b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 6fe6e57c10d1..372fb61244a0 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -237,22 +238,23 @@ namespace drawinglayer::primitive2d
 rContainer.push_back(xReference);
 }
 
-ControlPrimitive2D::ControlPrimitive2D(
-basegfx::B2DHomMatrix aTransform,
-uno::Reference< awt::XControlModel > xControlModel)
-:   maTransform(std::move(aTransform)),
-mxControlModel(std::move(xControlModel))
-{
-}
-
 ControlPrimitive2D::ControlPrimitive2D(
 basegfx::B2DHomMatrix aTransform,
 uno::Reference< awt::XControlModel > xControlModel,
-uno::Reference< awt::XControl > xXControl)
+uno::Reference xXControl,
+::std::u16string_view const rTitle,
+::std::u16string_view const rDescription)
 :   maTransform(std::move(aTransform)),
 mxControlModel(std::move(xControlModel)),
 mxXControl(std::move(xXControl))
 {
+::rtl::OUStringBuffer buf(rTitle);
+if (!rTitle.empty() && !rDescription.empty())
+{
+buf.append(" - ");
+}
+buf.append(rDescription);
+m_AltText = buf.makeStringAndClear();
 }
 
 const uno::Reference< awt::XControl >& 
ControlPrimitive2D::getXControl() const
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index d82465ceb313..56675ff113ef 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1137,8 +1137,6 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 if (bPDFExport)
 {
 // PDF export. Emulate data handling from UnoControlPDFExportContact
-// I have now moved describePDFControl to toolkit, thus i can 
implement the PDF
-// form control support now as follows
 std::unique_ptr pPDFControl(
 ::toolkitform::describePDFControl(rXControl, *mpPDFExtOutDevData));
 
@@ -1159,6 +1157,11 @@ void VclMetafileProcessor2D::processControlPrimitive2D(
 pPDFControl->TextFont.SetFontSize(aFontSize);
 
 mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::Form);
+OUString const& rAltText(rControlPrimitive.GetAltText());
+if (!rAltText.isEmpty())
+{
+mpPDFExtOutDevData->SetAlternateText(rAltText);
+}
 mpPDFExtOutDevData->CreateControl(*pPDFControl);
 mpPDFExtOutDevData->EndStructureElement();
 
diff --git a/include/drawinglayer/primitive2d/controlprimitive2d.hxx 
b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
index e3d5a5c0948d..e33c26886cd9 100644
--- a/include/drawinglayer/primitive2d/controlprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/controlprimitive2d.hxx
@@ -55,6 +55,9 @@ private:
 /// the last used scaling, 

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

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

New commits:
commit 8361cef32d54d2dec32e22c35c6d77ca792ae90a
Author: Andrea Gelmini 
AuthorDate: Fri Mar 24 11:36:38 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Mar 26 08:09:32 2023 +

Fix typos

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

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 0f77b4eada3a..d6da12a1e32e 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1003,7 +1003,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
 if (bTryDirectRender)
 {
 // MCGR: Avoid one level of primitive creation, use 
FillGradientPrimitive2D
-// tooling to directly create needed geoemtry & color for getting 
better
+// tooling to directly create needed geometry & color for getting 
better
 // performance (partially compensate for potentially more 
expensive multi
 // color gradients).
 // To handle a primitive that needs paint, either use decompose, 
or - when you
@@ -1012,7 +1012,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
 // since primitives by definition are self-contained what means 
they have all
 // needed data locally available to do so.
 // The question is the complexity to invest - the implemented 
decompose
-// is always a good hint what is neeed to do this. In this case I 
decided
+// is always a good hint of what is needed to do this. In this 
case I decided
 // to add some tooling methods to the primitive itself to support 
this. These
 // are used in decompose and can be used - as here now - for 
direct handling,
 // too. This is always a possibility in primitive handling - you 
can, but do not


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

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

New commits:
commit ae4e5e38b5ec99123ef478143501a9b0a3650171
Author: Andrea Gelmini 
AuthorDate: Fri Mar 24 11:37:25 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Mar 24 17:56:51 2023 +

Fix typo

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

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index d6a259157886..0f77b4eada3a 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -1008,7 +1008,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
 // color gradients).
 // To handle a primitive that needs paint, either use decompose, 
or - when you
 // do not want that for any reason, e.g. extra primitives created 
- implement
-// a direct handling in your primitive rendererer. This is always 
possible
+// a direct handling in your primitive renderer. This is always 
possible
 // since primitives by definition are self-contained what means 
they have all
 // needed data locally available to do so.
 // The question is the complexity to invest - the implemented 
decompose


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

2023-03-24 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   12 +---
 1 file changed, 1 insertion(+), 11 deletions(-)

New commits:
commit 1249706aeaaf60ccafa3675ca203de09f26aebc8
Author: Michael Stahl 
AuthorDate: Thu Mar 23 18:29:14 2023 +0100
Commit: Michael Stahl 
CommitDate: Fri Mar 24 10:36:11 2023 +

drawinglayer: remove obsolete comment

The code is now in vcl/source/gdi/formpdfexport.cxx

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index da99da610883..d82465ceb313 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -722,17 +722,7 @@ VclMetafileProcessor2D::~VclMetafileProcessor2D()
 
 - UnoControlPDFExportContact is only created when PDFExtOutDevData is used 
at the
   target and uno control data is created in 
UnoControlPDFExportContact::do_PaintObject.
-  This may be added in primitive MetaFile renderer.
-  Adding support...
-  OOps, the necessary helper stuff is in svx/source/form/formpdxexport.cxx 
in namespace
-  svxform. Have to talk to FS if this has to be like that. Especially since
-  vcl::PDFWriter::AnyWidget is filled out, which is already part of vcl.
-  Wrote an eMail to FS, he is on vacation currently. I see no reason why 
not to move
-  that stuff to somewhere else, maybe tools or svtools ?!? We will see...
-  Moved to toolkit, so I have to link against it. I tried VCL first, but 
it did
-  not work since VCLUnoHelper::CreateFont is unresolved in VCL (!). Other 
than the name
-  may imply, it is defined in toolkit (!). Since toolkit is linked against 
VCL itself,
-  the lowest movement plane is toolkit.
+  This was added in primitive MetaFile renderer.
   Checked form control export, it works well. Done.
 
 - In goodies, in GraphicObject::Draw, when the used Graphic is linked, 
infos are


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

2023-03-22 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/attribute/fillgradientattribute.cxx  |   35 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx  |   63 +++-
 include/drawinglayer/attribute/fillgradientattribute.hxx |7 
 svx/source/sdr/primitive2d/sdrattributecreator.cxx   |  106 ---
 4 files changed, 129 insertions(+), 82 deletions(-)

New commits:
commit 9331d2d333feb911e16f20ce899f2de220bee2f1
Author: Armin Le Grand (allotropia) 
AuthorDate: Wed Mar 22 11:44:52 2023 +0100
Commit: Armin Le Grand 
CommitDate: Wed Mar 22 14:28:19 2023 +

MCGR: Corrected error with Case16 wrong gradient shortcut

Also simplified using the test cases, these now depend on
an ENV VAR called MCGR_TEST. Fallback is no test. For
seeing a multi-color gradient use 1, for Case16 use 16.
If active, all gradients are replaced with the one active
for the test, 2D and 3D. This is temporary but also for
pro build to check for speed there.

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

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index 62bde03a29f6..b25a4dab2f25 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -154,6 +154,41 @@ namespace drawinglayer::attribute
 return mpFillGradientAttribute->hasSingleColor();
 }
 
+// MCGR: Check if rendering cannot be handled by old vcl stuff
+bool FillGradientAttribute::cannotBeHandledByVCL() const
+{
+// MCGR: If GradientStops are used, use decomposition since vcl is 
not able
+// to render multi-color gradients
+if (getColorStops().size() != 2)
+{
+return true;
+}
+
+// MCGR: If GradientStops do not start and stop at traditional 
Start/EndColor,
+// use decomposition since vcl is not able to render this
+if (!getColorStops().empty())
+{
+if 
(!basegfx::fTools::equalZero(getColorStops().front().getStopOffset())
+|| 
!basegfx::fTools::equal(getColorStops().back().getStopOffset(), 1.0))
+{
+return true;
+}
+}
+
+// VCL should be able to handle all styles, but for tdf#133477 the 
VCL result
+// is different from processing the gradient manually by 
drawinglayer
+// (and the Writer unittest for it fails). Keep using the 
drawinglayer code
+// until somebody founds out what's wrong and fixes it.
+if (getStyle() != drawinglayer::attribute::GradientStyle::Linear
+&& getStyle() != drawinglayer::attribute::GradientStyle::Axial
+&& getStyle() != 
drawinglayer::attribute::GradientStyle::Radial)
+{
+return true;
+}
+
+return false;
+}
+
 FillGradientAttribute& FillGradientAttribute::operator=(const 
FillGradientAttribute&) = default;
 
 FillGradientAttribute& 
FillGradientAttribute::operator=(FillGradientAttribute&&) = default;
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index c49deaf3f369..9f0875e2f489 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -497,16 +497,30 @@ void VclPixelProcessor2D::processBitmapPrimitive2D(
 void VclPixelProcessor2D::processPolyPolygonGradientPrimitive2D(
 const primitive2d::PolyPolygonGradientPrimitive2D& rPolygonCandidate)
 {
-// direct draw of gradient
+basegfx::B2DPolyPolygon 
aLocalPolyPolygon(rPolygonCandidate.getB2DPolyPolygon());
+
+// no geometry, no need to render, done
+if (!aLocalPolyPolygon.count())
+return;
+
+// *try* direct draw (AKA using old VCL stuff) to render gradient
 const attribute::FillGradientAttribute& 
rGradient(rPolygonCandidate.getFillGradient());
+
+// MCGR: *many* - and not only GradientStops - cases cannot be handled by 
VCL
+// so use decomposition
+// NOTE: There may be even more reasons to detect, e.g. a 
ViewTransformation
+// that uses shear/rotate/mirror (what VCL cannot handle at all), see
+// other checks already in processFillGradientPrimitive2D
+if (rGradient.cannotBeHandledByVCL())
+{
+process(rPolygonCandidate);
+return;
+}
+
 basegfx::BColor aStartColor(
 
maBColorModifierStack.getModifiedColor(rGradient.getColorStops().front().getStopColor()));
 basegfx::BColor aEndColor(
 
maBColorModifierStack.getModifiedColor(rGradient.getColorStops().back().getStopColor()));
-

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

2023-03-22 Thread Michael Stahl (via logerrit)
 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx  |7 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |5 
 include/drawinglayer/primitive2d/structuretagprimitive2d.hxx |6 
 include/svx/sdr/contact/objectcontact.hxx|5 
 include/svx/sdr/contact/objectcontactofpageview.hxx  |1 
 include/vcl/pdfextoutdevdata.hxx |   14 +
 include/vcl/pdfwriter.hxx|7 
 sd/source/ui/unoidl/unomodel.cxx |3 
 svx/inc/sdr/contact/objectcontactofobjlistpainter.hxx|1 
 svx/source/sdr/contact/objectcontact.cxx |5 
 svx/source/sdr/contact/objectcontactofobjlistpainter.cxx |   11 
 svx/source/sdr/contact/objectcontactofpageview.cxx   |   11 
 svx/source/sdr/contact/viewobjectcontact.cxx |   14 +
 svx/source/sdr/contact/viewobjectcontactofpageobj.cxx|4 
 sw/source/core/text/EnhancedPDFExportHelper.cxx  |2 
 vcl/inc/pdf/pdfwriter_impl.hxx   |7 
 vcl/qa/cppunit/pdfexport/data/vid.odt|binary
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |  130 +++
 vcl/source/gdi/pdfextoutdevdata.cxx  |   44 +++
 vcl/source/gdi/pdfwriter.cxx |5 
 vcl/source/gdi/pdfwriter_impl.cxx|   85 +--
 21 files changed, 336 insertions(+), 31 deletions(-)

New commits:
commit e84b310b59825fd572d79def98c3d21566aac603
Author: Michael Stahl 
AuthorDate: Thu Mar 16 19:48:31 2023 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 22 11:53:38 2023 +

vcl,drawinglayer,svx,sw,sd: PDF/UA export: Annot StructElem for SdrMediaObj

veraPDF complains:

  Specification: ISO 14289-1:2014, Clause: 7.18.1, Test number: 1
  An annotation, excluding annotations of subtype Widget, Popup or
  Link, shall be nested within an Annot tag

This is very similar to Link annotations, that is to say, extremely
complicated to get it thought the convoluted PDF export code, with
additional complication that the StructElem is produced by drawinglayer
and the page annotation by sw.

Put another map into PDFExtOutDevData where sw code puts stuff for the
SdrObject that drawinglayer can find.

The test had the problem that PDFObjectParser::parse() could not handle:

<>

Fix dropping the "1".

Change-Id: If5bf7c552e26ebb7e631030b8aaecd4281e77acc
(cherry picked from commit c78e90bd28cc4d6d3bde473535107784b12d9c0d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149008
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx 
b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
index 7e4de87ed64a..62da91ecc00f 100644
--- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
@@ -31,13 +31,18 @@ namespace drawinglayer::primitive2d
 bool bBackground,
 bool bIsImage,
 Primitive2DContainer&& aChildren,
-sal_Int32 const nAnchorStructureElementId)
+sal_Int32 const nAnchorStructureElementId,
+::std::vector const*const pAnnotIds)
 :   GroupPrimitive2D(std::move(aChildren)),
 maStructureElement(rStructureElement),
 mbBackground(bBackground),
 mbIsImage(bIsImage)
 ,   m_nAnchorStructureElementId(nAnchorStructureElementId)
 {
+if (pAnnotIds)
+{
+m_AnnotIds = *pAnnotIds;
+}
 }
 
 bool StructureTagPrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index d75b67716de8..da99da610883 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2460,6 +2460,7 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 case vcl::PDFWriter::Table:
 case vcl::PDFWriter::Formula:
 case vcl::PDFWriter::Figure:
+case vcl::PDFWriter::Annot:
 {
 auto const 
range(rStructureTagCandidate.getB2DRange(getViewInformation2D()));
 tools::Rectangle const aLogicRect(
@@ -2471,6 +2472,10 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 default:
 break;
 }
+if (rTagElement == vcl::PDFWriter::Annot)
+{
+
mpPDFExtOutDevData->SetStructureAnnotIds(rStructureTagCandidate.GetAnnotIds());
+}
 

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

2023-03-09 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |   20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

New commits:
commit 45d335e388566565ed53f7f7628f7351f88fd242
Author: Caolán McNamara 
AuthorDate: Wed Mar 8 13:59:50 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 9 08:28:54 2023 +

crashtesting: assert seen on load of moz1297206-1.svg

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

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index f13b7c4aadb2..ecfbf31f7ec4 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -377,9 +377,23 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 const Point aOrigin(
 basegfx::fround(aCurrentTranslate.getX() / 
aCurrentScaling.getX()),
 basegfx::fround(aCurrentTranslate.getY() / 
aCurrentScaling.getY()));
-MapMode aMapMode(mpOutputDevice->GetMapMode().GetMapUnit(), 
aOrigin,
- Fraction(aCurrentScaling.getX()),
- Fraction(aCurrentScaling.getY()));
+
+Fraction aScaleX(aCurrentScaling.getX());
+if (!aScaleX.IsValid())
+{
+SAL_WARN("drawinglayer", "invalid X Scale");
+return;
+}
+
+Fraction aScaleY(aCurrentScaling.getY());
+if (!aScaleY.IsValid())
+{
+SAL_WARN("drawinglayer", "invalid Y Scale");
+return;
+}
+
+MapMode aMapMode(mpOutputDevice->GetMapMode().GetMapUnit(), 
aOrigin, aScaleX,
+ aScaleY);
 
 if (fCurrentRotate)
 aTextTranslate *= 
basegfx::utils::createRotateB2DHomMatrix(fCurrentRotate);


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

2023-03-05 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/primitive3d/textureprimitive3d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9f844b8917414345db4b599c7da9219532e31429
Author: Andrea Gelmini 
AuthorDate: Sun Mar 5 00:56:37 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Mar 5 08:47:00 2023 +

Fix typo

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

diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx 
b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
index 549932e93049..ae89ebbe2ddc 100644
--- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
@@ -94,7 +94,7 @@ namespace drawinglayer::primitive3d
 // create TransparenceTexturePrimitive3D with fixed 
transparence as replacement
 const basegfx::BColor aGray(getTransparence(), 
getTransparence(), getTransparence());
 
-// create ColorSteps with StartColor == EndCoOlor == aGray
+// create ColorSteps with StartColor == EndColor == aGray
 const basegfx::ColorSteps aColorSteps {
 basegfx::ColorStep(0.0, aGray),
 basegfx::ColorStep(1.0, aGray) };


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

2023-03-02 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ba42b8b95b2166f9bd578cd90c54e9826a755a6e
Author: Caolán McNamara 
AuthorDate: Thu Mar 2 15:50:52 2023 +
Commit: Caolán McNamara 
CommitDate: Thu Mar 2 20:01:44 2023 +

tdf#153672 Use RelativeMapMode so text in gdis are scaled/offset correctly

otherwise it overrides the outer GdiMetaFiles efforts to position the
origin and the text is rendered off-canvas in this scenario

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

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 4563d30c518f..f13b7c4aadb2 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -389,7 +389,7 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 if (bChangeMapMode)
 {
 mpOutputDevice->Push(vcl::PushFlags::MAPMODE);
-mpOutputDevice->SetMapMode(aMapMode);
+mpOutputDevice->SetRelativeMapMode(aMapMode);
 }
 }
 else


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

2023-03-01 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit f5a352f560d2cd2cdb4f23456ca2be0f728ee8ad
Author: Andrea Gelmini 
AuthorDate: Wed Mar 1 12:57:46 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Mar 1 12:23:10 2023 +

Fix typo

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 2f9f75369207..c2c3ad698b40 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2008,7 +2008,7 @@ void 
VclMetafileProcessor2D::processPolyPolygonGradientPrimitive2D(
 
 if (!rGradientCandidate.getFillGradient().getColorSteps().empty())
 {
-// MCGR: if we have COlorSteps, do not try to fallbacl to old 
VCL-Gradient,
+// MCGR: if we have COlorSteps, do not try to fallback to old 
VCL-Gradient,
 // that will *not* be capable of representing this properly. Use the
 // correct decomposition instead
 process(rGradientCandidate);


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

2023-03-01 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |9 +
 1 file changed, 9 insertions(+)

New commits:
commit 7c132fd14f7955e2bfbb600b78e939b9eae6a870
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Feb 28 11:32:43 2023 +0100
Commit: Armin Le Grand 
CommitDate: Wed Mar 1 09:18:07 2023 +

MCGR: support ColorSteps in emf export

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index d2f4a4cc08c5..2f9f75369207 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2006,6 +2006,15 @@ void 
VclMetafileProcessor2D::processPolyPolygonGradientPrimitive2D(
 return;
 }
 
+if (!rGradientCandidate.getFillGradient().getColorSteps().empty())
+{
+// MCGR: if we have COlorSteps, do not try to fallbacl to old 
VCL-Gradient,
+// that will *not* be capable of representing this properly. Use the
+// correct decomposition instead
+process(rGradientCandidate);
+return;
+}
+
 // #i112245# Metafiles use tools Polygon and are not able to have more 
than 65535 points
 // per polygon. Split polygon until there are less than that
 fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon);


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

2023-02-28 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/texture/texture.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit f474418bc195f34fd3729406ebaf94234afd4260
Author: Andrea Gelmini 
AuthorDate: Tue Feb 28 12:33:16 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Mar 1 05:50:39 2023 +

Fix typo

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

diff --git a/drawinglayer/source/texture/texture.cxx 
b/drawinglayer/source/texture/texture.cxx
index 22f56f33b8bd..788594f3b8eb 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -492,7 +492,7 @@ namespace drawinglayer::texture
 const double fIncrementX(bMTO ? fStripeWidth / fAR : 
fStripeWidth);
 const double fIncrementY(bMTO ? fStripeWidth : fStripeWidth * 
fAR);
 
-// get correct start for innner loop (see above)
+// get correct start for inner loop (see above)
 const sal_uInt32 nStartInnerLoop(cs_l == mnColorSteps.begin() 
? 1 : 0);
 
 for (sal_uInt32 innerLoop(nStartInnerLoop); innerLoop < 
nSteps; innerLoop++)
@@ -582,7 +582,7 @@ namespace drawinglayer::texture
 const double fOffsetEnd(cs_r->getOffset());
 const double fStripeWidth((fOffsetEnd - fOffsetStart) / 
nSteps);
 
-// get correct start for innner loop (see above)
+// get correct start for inner loop (see above)
 const sal_uInt32 nStartInnerLoop(cs_l == mnColorSteps.begin() 
? 1 : 0);
 
 for (sal_uInt32 innerLoop(nStartInnerLoop); innerLoop < 
nSteps; innerLoop++)
@@ -682,7 +682,7 @@ namespace drawinglayer::texture
 const double fIncrementX(bMTO ? fStripeWidth / fAR : 
fStripeWidth);
 const double fIncrementY(bMTO ? fStripeWidth : fStripeWidth * 
fAR);
 
-// get correct start for innner loop (see above)
+// get correct start for inner loop (see above)
 const sal_uInt32 nStartInnerLoop(cs_l == mnColorSteps.begin() 
? 1 : 0);
 
 for (sal_uInt32 innerLoop(nStartInnerLoop); innerLoop < 
nSteps; innerLoop++)


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

2023-02-25 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/texture/texture.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 86eb8f694634623b30eabf4e02ef769a7aba4937
Author: Andrea Gelmini 
AuthorDate: Fri Feb 24 20:57:50 2023 +0100
Commit: Julien Nabet 
CommitDate: Sat Feb 25 10:36:59 2023 +

Fix typo

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

diff --git a/drawinglayer/source/texture/texture.cxx 
b/drawinglayer/source/texture/texture.cxx
index 44ce9336ac89..e3ed2780af4e 100644
--- a/drawinglayer/source/texture/texture.cxx
+++ b/drawinglayer/source/texture/texture.cxx
@@ -392,7 +392,7 @@ namespace drawinglayer::texture
 const double fOffsetEnd(cs_r->getOffset());
 const double fStripeWidth((fOffsetEnd - fOffsetStart) / 
nSteps);
 
-// get correct start for innner loop (see above)
+// get correct start for inner loop (see above)
 const sal_uInt32 nStartInnerLoop(cs_l == mnColorSteps.begin() 
? 1 : 0);
 
 for (sal_uInt32 innerLoop(nStartInnerLoop); innerLoop < 
nSteps; innerLoop++)


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

2023-02-22 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/attribute/fillgradientattribute.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 894b1a8b226e562a7aa38032cf56b1600f011805
Author: Andrea Gelmini 
AuthorDate: Wed Feb 22 14:39:59 2023 +0100
Commit: Julien Nabet 
CommitDate: Wed Feb 22 14:04:03 2023 +

Fix typo

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

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index 2056d58acf7f..07bc82e4e549 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -70,7 +70,7 @@ namespace drawinglayer::attribute
 // use two r/w heads on the data band maColorSteps
 size_t curr(0), next(1);
 
-// during procesing, check if all colors are the same. We 
know the
+// during processing, check if all colors are the same. We 
know the
 // StartColor, so to all be the same, all also have to be 
equal to
 // StartColor (including EndColor, use to initialize)
 bool bAllTheSameColor(rStartColor == rEndColor);
@@ -86,14 +86,14 @@ namespace drawinglayer::attribute
 // check for < 0.0 (should not really happen, see 
::ColorStep)
 // also check for == 0.0 which would mean than an 
implicit
 // StartColor was given in ColorSteps - ignore that, 
we want
-// the explicitely given StartColor to always win
+// the explicitly given StartColor to always win
 if(basegfx::fTools::lessOrEqual(fNextOffset, 0.0))
 continue;
 
 // check for > 1.0 (should not really happen, see 
::ColorStep)
 // also check for == 1.0 which would mean than an 
implicit
 // EndColor was given in ColorSteps - ignore that, we 
want
-// the explicitely given EndColor to always win
+// the explicitly given EndColor to always win
 if(basegfx::fTools::moreOrEqual(fNextOffset, 1.0))
 continue;
 


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

2023-02-19 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive3d/baseprimitive3d.cxx |3 +--
 drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx |2 +-
 drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx  |2 +-
 drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx   |4 ++--
 drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx |4 ++--
 drawinglayer/source/processor3d/shadow3dextractor.cxx   |1 +
 drawinglayer/source/texture/texture3d.cxx   |1 +
 include/drawinglayer/primitive3d/baseprimitive3d.hxx|7 +++
 8 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit ac8963b688b3ce787455a1c7e1506aec10838ff6
Author: Noel Grandin 
AuthorDate: Fri Feb 17 14:04:53 2023 +0200
Commit: Noel Grandin 
CommitDate: Sun Feb 19 18:33:52 2023 +

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

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

diff --git a/drawinglayer/source/primitive3d/baseprimitive3d.cxx 
b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
index 5bd980012a61..c2c8cc9f7e0f 100644
--- a/drawinglayer/source/primitive3d/baseprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/baseprimitive3d.cxx
@@ -29,7 +29,6 @@ using namespace com::sun::star;
 namespace drawinglayer::primitive3d
 {
 BasePrimitive3D::BasePrimitive3D()
-:   BasePrimitive3DImplBase(m_aMutex)
 {
 }
 
@@ -76,7 +75,7 @@ namespace drawinglayer::primitive3d
 
 Primitive3DContainer 
BufferedDecompositionPrimitive3D::get3DDecomposition(const 
geometry::ViewInformation3D& rViewInformation) const
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if(getBuffered3DDecomposition().empty())
 {
diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx 
b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
index 668f7dab4439..3e0abc582732 100644
--- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
@@ -292,7 +292,7 @@ namespace drawinglayer::primitive3d
 
 Primitive3DContainer HatchTexturePrimitive3D::get3DDecomposition(const 
geometry::ViewInformation3D& /*rViewInformation*/) const
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if(getBuffered3DDecomposition().empty())
 {
diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx 
b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
index 2ff7462b7a9f..955e6bd4f9ca 100644
--- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx
@@ -749,7 +749,7 @@ using namespace com::sun::star;
 
 Primitive3DContainer PolygonTubePrimitive3D::get3DDecomposition(const 
geometry::ViewInformation3D& rViewInformation) const
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if(getLast3DDecomposition().empty())
 {
diff --git a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx 
b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
index e223b7911185..34f4d8472284 100644
--- a/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx
@@ -376,7 +376,7 @@ namespace drawinglayer::primitive3d
 // again when no longer geometry is needed for non-visible 3D 
objects as it is now for chart
 if(getPolyPolygon().count() && maSlices.empty())
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 const_cast< SdrExtrudePrimitive3D& >(*this).impCreateSlices();
 }
@@ -481,7 +481,7 @@ namespace drawinglayer::primitive3d
 (!getBuffered3DDecomposition().empty()
 && *mpLastRLGViewInformation != rViewInformation))
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 // conditions of last local decomposition with reduced 
lines have changed. Remember
 // new one and clear current decompositiopn
diff --git a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx 
b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
index 49011f10a74a..ca6e11eec4d4 100644
--- a/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx
@@ -228,7 +228,7 @@ namespace drawinglayer::primitive3d
 // again when no longer geometry is needed for non-visible 3D 
objects as it is now for chart
 

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

2023-02-12 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/attribute/fillgradientattribute.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7e1a4a518ef6a8a32f4acf4fe3cc634c3573f778
Author: Andrea Gelmini 
AuthorDate: Sun Feb 12 12:40:01 2023 +0100
Commit: Julien Nabet 
CommitDate: Sun Feb 12 21:27:13 2023 +

Fix typos

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

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index 3d13c4050670..32edd39340fe 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -51,7 +51,7 @@ namespace drawinglayer::attribute
 meStyle(eStyle),
 mnSteps(nSteps)
 {
-// always add start color to guarentee a color at all. It's 
also just safer
+// always add start color to guarantee a color at all. It's 
also just safer
 // to have one and not an empty vector, that spares many 
checks in the using code
 maColorSteps.emplace_back(0.0, rStartColor);
 
@@ -61,7 +61,7 @@ namespace drawinglayer::attribute
 for(const auto& candidate : *pColorSteps)
 {
 // only allow ]0.0 .. 1.0[ as offset values, 
*excluding* 0.0 and 1.0
-// explicitely - these are reserved for start/end color
+// explicitly - these are reserved for start/end color
 if(basegfx::fTools::more(candidate.getOffset(), 0.0) 
&& basegfx::fTools::less(candidate.getOffset(), 1.0))
 {
 // ignore same offsets, independent from color (so 
1st one wins)


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

2023-02-12 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/attribute/fillgradientattribute.cxx |   97 +---
 drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx |4 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx  |   13 -
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   18 +-
 drawinglayer/source/processor3d/defaultprocessor3d.cxx  |4 
 drawinglayer/source/tools/primitive2dxmldump.cxx|   18 +-
 drawinglayer/source/tools/wmfemfhelper.cxx  |   15 -
 include/drawinglayer/attribute/fillgradientattribute.hxx|   89 ++-
 svx/source/sdr/attribute/sdrallfillattributeshelper.cxx |   10 -
 svx/source/sdr/primitive2d/sdrattributecreator.cxx  |1 
 10 files changed, 215 insertions(+), 54 deletions(-)

New commits:
commit 43de98fb59ef3cd1c6eabd3174d57634b7d501a9
Author: Armin Le Grand (allotropia) 
AuthorDate: Fri Feb 10 11:36:15 2023 +0100
Commit: Armin Le Grand 
CommitDate: Sun Feb 12 10:54:06 2023 +

MCGR: Add/Provide GradientSteps to FillGradientAttribute

MCGR stands for MultiColorGRadient. This change allows/
prepares adding multiple color steps to gradient rendering.

This is preparation work to allow rendering MCGRs in the
future. All places are adapted in a way that currently
no change of behaviour will happen. It will be the base
to get MCGR rendering/decompose for Primitives and our
internal/existing gradients working.

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

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index b8b06e20bbbf..3d13c4050670 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -18,8 +18,6 @@
  */
 
 #include 
-#include 
-
 
 namespace drawinglayer::attribute
 {
@@ -31,8 +29,7 @@ namespace drawinglayer::attribute
 double  mfOffsetX;
 double  mfOffsetY;
 double  mfAngle;
-basegfx::BColor maStartColor;
-basegfx::BColor maEndColor;
+FillGradientAttribute::ColorSteps   maColorSteps;
 GradientStyle   meStyle;
 sal_uInt16  mnSteps;
 
@@ -44,16 +41,62 @@ namespace drawinglayer::attribute
 double fAngle,
 const basegfx::BColor& rStartColor,
 const basegfx::BColor& rEndColor,
+const FillGradientAttribute::ColorSteps* pColorSteps,
 sal_uInt16 nSteps)
 :   mfBorder(fBorder),
 mfOffsetX(fOffsetX),
 mfOffsetY(fOffsetY),
 mfAngle(fAngle),
-maStartColor(rStartColor),
-maEndColor(rEndColor),
+maColorSteps(),
 meStyle(eStyle),
 mnSteps(nSteps)
 {
+// always add start color to guarentee a color at all. It's 
also just safer
+// to have one and not an empty vector, that spares many 
checks in the using code
+maColorSteps.emplace_back(0.0, rStartColor);
+
+// if we have ColorSteps, integrate these
+if(nullptr != pColorSteps)
+{
+for(const auto& candidate : *pColorSteps)
+{
+// only allow ]0.0 .. 1.0[ as offset values, 
*excluding* 0.0 and 1.0
+// explicitely - these are reserved for start/end color
+if(basegfx::fTools::more(candidate.getOffset(), 0.0) 
&& basegfx::fTools::less(candidate.getOffset(), 1.0))
+{
+// ignore same offsets, independent from color (so 
1st one wins)
+// having two or more same offsets is an error 
(may assert evtl.)
+bool bAccept(true);
+
+for(const auto& compare : maColorSteps)
+{
+if(basegfx::fTools::equal(compare.getOffset(), 
candidate.getOffset()))
+{
+bAccept = false;
+break;
+}
+}
+
+if(bAccept)
+{
+maColorSteps.push_back(candidate);
+}
+}
+}
+
+// sort by offset when colors were added
+

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

2023-01-25 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |   85 ++---
 1 file changed, 60 insertions(+), 25 deletions(-)

New commits:
commit 9d60497954ed25bd802e66b5de0f375b301c79eb
Author: Caolán McNamara 
AuthorDate: Wed Jan 25 15:35:43 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Jan 25 19:24:18 2023 +

tdf#153092 text appears missing with font sizes < 1

where the size is scaled up, so restore use of scaling up when necessary.
But continue to use unscaled supplied values when provided integer sizes
to avoid scaling down.

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

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 8bd9abadf15c..4563d30c518f 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -160,10 +160,24 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 rTextCandidate.getTextTransform().decompose(aFontSize, 
aTextTranslate, fIgnoreRotate,
 fIgnoreShearX);
 
+// tdf#153092 Ideally we don't have to scale the font and dxarray, 
but we might have
+// to nevertheless if dealing with non integer sizes
+const bool bScaleFont(aFontSize.getY() != 
std::round(aFontSize.getY()));
+vcl::Font aFont;
+
 // Get the VCL font
-vcl::Font aFont(primitive2d::getVclFontFromFontAttribute(
-rTextCandidate.getFontAttribute(), aFontSize.getX(), 
aFontSize.getY(), fRotate,
-rTextCandidate.getLocale()));
+if (!bScaleFont)
+{
+aFont = primitive2d::getVclFontFromFontAttribute(
+rTextCandidate.getFontAttribute(), aFontSize.getX(), 
aFontSize.getY(), fRotate,
+rTextCandidate.getLocale());
+}
+else
+{
+aFont = primitive2d::getVclFontFromFontAttribute(
+rTextCandidate.getFontAttribute(), aFontScaling.getX(), 
aFontScaling.getY(),
+fRotate, rTextCandidate.getLocale());
+}
 
 // Don't draw fonts without height
 if (aFont.GetFontHeight() <= 0)
@@ -287,9 +301,17 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 
 if (!rTextCandidate.getDXArray().empty())
 {
+double fPixelVectorFactor(1.0);
+if (bScaleFont)
+{
+const basegfx::B2DVector 
aPixelVector(maCurrentTransformation
+  * 
basegfx::B2DVector(1.0, 0.0));
+fPixelVectorFactor = aPixelVector.getLength();
+}
+
 aDXArray.reserve(rTextCandidate.getDXArray().size());
 for (auto const& elem : rTextCandidate.getDXArray())
-aDXArray.push_back(basegfx::fround(elem));
+aDXArray.push_back(basegfx::fround(elem * 
fPixelVectorFactor));
 }
 
 // set parameters and paint text snippet
@@ -339,28 +361,41 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 }
 }
 
-basegfx::B2DHomMatrix aCombinedTransform(
-getTransformFromMapMode(mpOutputDevice->GetMapMode()) * 
maCurrentTransformation);
-
-basegfx::B2DVector aCurrentScaling, aCurrentTranslate;
-double fCurrentRotate;
-aCombinedTransform.decompose(aCurrentScaling, aCurrentTranslate, 
fCurrentRotate,
- fIgnoreShearX);
-
-const Point aOrigin(basegfx::fround(aCurrentTranslate.getX() / 
aCurrentScaling.getX()),
-basegfx::fround(aCurrentTranslate.getY() / 
aCurrentScaling.getY()));
-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)
+Point aStartPoint;
+bool bChangeMapMode(false);
+if (!bScaleFont)
+{
+basegfx::B2DHomMatrix aCombinedTransform(
+getTransformFromMapMode(mpOutputDevice->GetMapMode())
+* maCurrentTransformation);
+
+basegfx::B2DVector aCurrentScaling, 

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

2023-01-21 Thread Armin Le Grand (Allotropia) (via logerrit)
 drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx  |   24 +
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx   |  281 +-
 include/basegfx/range/b2drange.hxx|2 
 include/drawinglayer/processor2d/SDPRProcessor2dTools.hxx |   25 +
 include/drawinglayer/processor2d/d2dpixelprocessor2d.hxx  |3 
 5 files changed, 166 insertions(+), 169 deletions(-)

New commits:
commit 6b6d1dc7bc402d1d966e506b91729c1c1cafb8d1
Author: Armin Le Grand (Allotropia) 
AuthorDate: Fri Jan 20 17:43:11 2023 +0100
Commit: Armin Le Grand 
CommitDate: Sat Jan 21 11:23:53 2023 +

SDPR: Unified some stuff & moved to tooling

Added and unified usage of a helper to create primitive
sub content easily, also for visibility checking of
primitives. Some smaller cleanups, too.

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

diff --git a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx 
b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
index 981e52dc55c4..4789cc30cfdd 100644
--- a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
+++ b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
@@ -179,7 +179,7 @@ bool prepareBitmapForDirectRender(
 if (!rDiscreteViewPort.isEmpty())
 {
 // calculate discrete covered pixel area
-basegfx::B2DRange aDiscreteRange(0.0, 0.0, 1.0, 1.0);
+basegfx::B2DRange aDiscreteRange(basegfx::B2DRange::getUnitB2DRange());
 aDiscreteRange.transform(aLocalTransform);
 
 if (!rDiscreteViewPort.overlaps(rDiscreteViewPort))
@@ -273,6 +273,28 @@ bool prepareBitmapForDirectRender(
 // signal to render it
 return true;
 }
+
+void calculateDiscreteVisibleRange(
+basegfx::B2DRange& rDiscreteVisibleRange, const basegfx::B2DRange& 
rContentRange,
+const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
+{
+if (rContentRange.isEmpty())
+{
+// no content, done
+rDiscreteVisibleRange.reset();
+return;
+}
+
+basegfx::B2DRange aDiscreteRange(rContentRange);
+
aDiscreteRange.transform(rViewInformation2D.getObjectToViewTransformation());
+const basegfx::B2DRange& 
rDiscreteViewPort(rViewInformation2D.getDiscreteViewport());
+rDiscreteVisibleRange = aDiscreteRange;
+
+if (!rDiscreteViewPort.isEmpty())
+{
+rDiscreteVisibleRange.intersect(rDiscreteViewPort);
+}
+}
 } // end of namespace
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index f688dace1a03..0670ad2febd8 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -542,7 +542,7 @@ public:
 // creating helper-ID2D1Bitmap's for a given ID2D1RenderTarget
 D2DBitmapPixelProcessor2D(const drawinglayer::geometry::ViewInformation2D& 
rViewInformation,
   sal_uInt32 nWidth, sal_uInt32 nHeight,
-  sal::systools::COMReference& 
rParent)
+  const 
sal::systools::COMReference& rParent)
 : drawinglayer::processor2d::D2DPixelProcessor2D(rViewInformation)
 , mpBitmapRenderTarget()
 {
@@ -610,6 +610,65 @@ public:
 return pResult;
 }
 };
+
+bool createBitmapSubContent(sal::systools::COMReference& rResult,
+basegfx::B2DRange& rDiscreteVisibleRange,
+const 
drawinglayer::primitive2d::Primitive2DContainer& rContent,
+const drawinglayer::geometry::ViewInformation2D& 
rViewInformation2D,
+const 
sal::systools::COMReference& rRenderTarget)
+{
+if (rContent.empty() || !rRenderTarget)
+{
+// no content or no render target, done
+return false;
+}
+
+drawinglayer::processor2d::calculateDiscreteVisibleRange(
+rDiscreteVisibleRange, rContent.getB2DRange(rViewInformation2D), 
rViewInformation2D);
+
+if (rDiscreteVisibleRange.isEmpty())
+{
+// not visible, done
+return false;
+}
+
+// Use a temporary second instance of a D2DBitmapPixelProcessor2D with 
adapted
+// ViewInformation2D, it will create the needed ID2D1BitmapRenderTarget
+// locally and Clear() it.
+drawinglayer::geometry::ViewInformation2D 
aAdaptedViewInformation2D(rViewInformation2D);
+const double fTargetWidth(ceil(rDiscreteVisibleRange.getWidth()));
+const double fTargetHeight(ceil(rDiscreteVisibleRange.getHeight()));
+
+{
+// create adapted ViewTransform, needs to be offset in discrete 
coordinates,
+// so multiply from left
+basegfx::B2DHomMatrix aAdapted(
+

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

2023-01-18 Thread Armin Le Grand (Allotropia) (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx  |  125 +--
 include/drawinglayer/processor2d/d2dpixelprocessor2d.hxx |2 
 2 files changed, 115 insertions(+), 12 deletions(-)

New commits:
commit 53d927cd674d85092f40d1195693ddd8d78d318e
Author: Armin Le Grand (Allotropia) 
AuthorDate: Wed Jan 18 12:56:48 2023 +0100
Commit: Armin Le Grand 
CommitDate: Wed Jan 18 15:03:57 2023 +

SDPR: Add support for InvertPrimitive2D

We urgently should get rid of XOR paint, modern
graphic systems allow no read access to the pixel
targets, but that's naturally a precondition for
XOR.
While we can do that for the office's
visualization, we can in principle *not* fully
avoid getting stuff that needs/defines XOR paint,
e.g. EMF/WMF imports, so we *have* to support
it (for now - sigh)...

This makes this renderer complete from the minimal
to-be-supported primitives, too.

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 21a441783ca6..f688dace1a03 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -903,8 +904,7 @@ sal::systools::COMReference 
D2DPixelProcessor2D::implCreateAlpha_Di
 return pRetval;
 }
 
-// Release early, was only a test and I saw comments in docu 
thatQueryInterface
-// does already increase that refcount
+// Release early
 pID2D1DeviceContext.clear();
 
 // I had a former version (call it 'a') where I directly painted to a
@@ -1142,12 +1142,12 @@ void 
D2DPixelProcessor2D::processTransparencePrimitive2D(
 if (!rDiscreteViewPort.isEmpty())
 {
 aVisibleRange.intersect(rDiscreteViewPort);
+}
 
-if (aVisibleRange.isEmpty())
-{
-// not visible, done
-return;
-}
+if (aVisibleRange.isEmpty())
+{
+// not visible, done
+return;
 }
 
 // try to create directly, this needs the current mpRT to be a 
ID2D1DeviceContext/d2d1_1
@@ -1919,6 +1919,104 @@ void D2DPixelProcessor2D::processFillGraphicPrimitive2D(
 increaseError();
 }
 
+void D2DPixelProcessor2D::processInvertPrimitive2D(
+const primitive2d::InvertPrimitive2D& rInvertPrimitive2D)
+{
+if (rInvertPrimitive2D.getChildren().empty())
+{
+// no content, done
+return;
+}
+
+// calculate visible range, create only for that range
+basegfx::B2DRange aDiscreteRange(
+rInvertPrimitive2D.getChildren().getB2DRange(getViewInformation2D()));
+
aDiscreteRange.transform(getViewInformation2D().getObjectToViewTransformation());
+const basegfx::B2DRange& 
rDiscreteViewPort(getViewInformation2D().getDiscreteViewport());
+basegfx::B2DRange aVisibleRange(aDiscreteRange);
+
+if (!rDiscreteViewPort.isEmpty())
+{
+aVisibleRange.intersect(rDiscreteViewPort);
+}
+
+if (aVisibleRange.isEmpty())
+{
+// not visible, done
+return;
+}
+
+// Try if we can use ID2D1DeviceContext/d2d1_1 by querying for interface.
+// Only with ID2D1DeviceContext we can use ::DrawImage which supports
+// D2D1_COMPOSITE_MODE_XOR
+sal::systools::COMReference pID2D1DeviceContext;
+getRenderTarget()->QueryInterface(__uuidof(ID2D1DeviceContext),
+  
reinterpret_cast());
+
+if (!pID2D1DeviceContext)
+{
+// TODO: We have *no* ID2D1DeviceContext and cannot use 
D2D1_COMPOSITE_MODE_XOR,
+// so there is currently no (simple?) way to solve this, there is no 
'Invert' method.
+// It may be possible to convert to a WICBitmap (gets read access) and 
do the invert
+// there, but that needs experimenting and is probably not performant 
- but doable.
+increaseError();
+return;
+}
+
+// Use a temporary second instance of a D2DBitmapPixelProcessor2D with 
adapted
+// ViewInformation2D, it will create the needed ID2D1BitmapRenderTarget
+// locally and Clear() it (see class def above).
+// That way it is not necessary to patch/relocate all the local variables 
(safer)
+// and the renderer has no real overhead itself
+geometry::ViewInformation2D 
aAdaptedViewInformation2D(getViewInformation2D());
+const double fTargetWidth(ceil(aVisibleRange.getWidth()));
+const double fTargetHeight(ceil(aVisibleRange.getHeight()));
+
+{
+// create adapted ViewTransform, needs to be offset in discrete 
coordinates,
+// so multiply from left
+basegfx::B2DHomMatrix 

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

2023-01-17 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx  |2 +-
 include/drawinglayer/processor2d/SDPRProcessor2dTools.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit b63afb3c74d4285a7d46917354eafc0087a73f8f
Author: Stephan Bergmann 
AuthorDate: Wed Jan 18 07:54:00 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Jan 18 07:45:51 2023 +

Fix typo

...which happened to go largely unnoticed (the would-be additional 
overload, as
seen when including drawinglayer/processor2d/SDPRProcessor2dTools.hxx first
thing in drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx, was just
never defined nor used), but caused

> drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx(140,6): error: 
externally available entity 'prepareBitmapForDirectRender' is not previously 
declared in an included file (if it is only used in this translation unit, make 
it static; otherwise, provide a declaration of it in an included file) 
[loplugin:external]
> bool prepareBitmapForDirectRender(
> ~^

with clang-cl

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

diff --git a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx 
b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
index 01abd9ff9af1..981e52dc55c4 100644
--- a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
+++ b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
@@ -139,7 +139,7 @@ void takeCareOfOffsetXY(
 
 bool prepareBitmapForDirectRender(
 const drawinglayer::primitive2d::FillGraphicPrimitive2D& 
rFillGraphicPrimitive2D,
-const geometry::ViewInformation2D& rViewInformation2D, BitmapEx& rTarget,
+const drawinglayer::geometry::ViewInformation2D& rViewInformation2D, 
BitmapEx& rTarget,
 basegfx::B2DRange& rFillUnitRange, double fBigDiscreteArea)
 {
 const attribute::FillGraphicAttribute& rFillGraphicAttribute(
diff --git a/include/drawinglayer/processor2d/SDPRProcessor2dTools.hxx 
b/include/drawinglayer/processor2d/SDPRProcessor2dTools.hxx
index 4b8b6c6c4347..e7bdbceffcd2 100644
--- a/include/drawinglayer/processor2d/SDPRProcessor2dTools.hxx
+++ b/include/drawinglayer/processor2d/SDPRProcessor2dTools.hxx
@@ -26,7 +26,7 @@ namespace drawinglayer::primitive2d
 class FillGraphicPrimitive2D;
 }
 
-namespace geometry
+namespace drawinglayer::geometry
 {
 class ViewInformation2D;
 }
@@ -82,7 +82,7 @@ namespace drawinglayer::processor2d
 */
 bool prepareBitmapForDirectRender(
 const drawinglayer::primitive2d::FillGraphicPrimitive2D& 
rFillGraphicPrimitive2D,
-const geometry::ViewInformation2D& rViewInformation2D, BitmapEx& rTarget,
+const drawinglayer::geometry::ViewInformation2D& rViewInformation2D, 
BitmapEx& rTarget,
 basegfx::B2DRange& rFillUnitRange, double fBigDiscreteArea = 300.0 * 
300.0);
 
 /** helper to react/process if OffsetX/OffsetY of the FillGraphicAttribute is 
used.


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

2023-01-17 Thread Armin Le Grand (Allotropia) (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |   41 
 1 file changed, 33 insertions(+), 8 deletions(-)

New commits:
commit 6c8b6fa6c6d4a1a20d8ebaf36b16c1d20cf109e0
Author: Armin Le Grand (Allotropia) 
AuthorDate: Tue Jan 17 12:13:26 2023 +0100
Commit: Armin Le Grand 
CommitDate: Tue Jan 17 14:53:40 2023 +

SDPR: use correct Viewport for sub renderer

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index e93e1375bc07..21a441783ca6 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -575,6 +575,20 @@ public:
 
 if (hasRenderTarget())
 {
+// set Viewort if none was given. We have a fixed pixel target, s 
we know the
+// exact Viewport to work on
+if (getViewInformation2D().getViewport().isEmpty())
+{
+drawinglayer::geometry::ViewInformation2D 
aViewInformation(getViewInformation2D());
+basegfx::B2DRange aViewport(0.0, 0.0, nWidth, nHeight);
+basegfx::B2DHomMatrix 
aInvViewTransform(aViewInformation.getViewTransformation());
+
+aInvViewTransform.invert();
+aViewport.transform(aInvViewTransform);
+aViewInformation.setViewport(aViewport);
+updateViewInformation(aViewInformation);
+}
+
 // clear as render preparation
 getRenderTarget()->BeginDraw();
 getRenderTarget()->Clear(D2D1::ColorF(0.0f, 0.0f, 0.0f, 0.0f));
@@ -936,14 +950,25 @@ sal::systools::COMReference 
D2DPixelProcessor2D::implCreateAlpha_Di
 // locally and Clear() it (see class def above).
 // That way it is not necessary to patch/relocate all the local variables 
(safer)
 // and the renderer has no real overhead itself
-const basegfx::B2DHomMatrix 
aEmbedTransform(basegfx::utils::createTranslateB2DHomMatrix(
--rVisibleRange.getMinX(), -rVisibleRange.getMinY()));
-geometry::ViewInformation2D aViewInformation2D(getViewInformation2D());
-aViewInformation2D.setViewTransformation(aEmbedTransform
- * 
getViewInformation2D().getViewTransformation());
-D2DBitmapPixelProcessor2D aSubContentRenderer(
-aViewInformation2D, ceil(rVisibleRange.getWidth()), 
ceil(rVisibleRange.getHeight()),
-getRenderTarget());
+geometry::ViewInformation2D 
aAdaptedViewInformation2D(getViewInformation2D());
+const double fTargetWidth(ceil(rVisibleRange.getWidth()));
+const double fTargetHeight(ceil(rVisibleRange.getHeight()));
+
+{
+// create adapted ViewTransform, needs to be offset in discrete 
coordinates,
+// so multiply from left
+basegfx::B2DHomMatrix 
aAdapted(basegfx::utils::createTranslateB2DHomMatrix(
+   -rVisibleRange.getMinX(), 
-rVisibleRange.getMinY())
+   * 
getViewInformation2D().getViewTransformation());
+aAdaptedViewInformation2D.setViewTransformation(aAdapted);
+
+// reset Viewport (world coordinates), so the helper renderer will 
create it's
+// own based on it's given internal discrete size
+aAdaptedViewInformation2D.setViewport(basegfx::B2DRange());
+}
+
+D2DBitmapPixelProcessor2D aSubContentRenderer(aAdaptedViewInformation2D, 
fTargetWidth,
+  fTargetHeight, 
getRenderTarget());
 
 if (!aSubContentRenderer.valid())
 {


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

2023-01-14 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |2 +-
 include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 8e8353c717629e049aa15cda86bcd9a3ea205e84
Author: Andrea Gelmini 
AuthorDate: Sat Jan 14 18:48:59 2023 +0100
Commit: Julien Nabet 
CommitDate: Sat Jan 14 22:46:09 2023 +

Fix typos and exec bits

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

diff --git a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx 
b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
old mode 100755
new mode 100644
diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 4f7632ece672..e93e1375bc07 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -1790,7 +1790,7 @@ void D2DPixelProcessor2D::processFillGraphicPrimitive2D(
 if (aPreparedBitmap.IsEmpty())
 {
 // output needed and Bitmap data empty, so no bitmap data based
-// tiled rendering is suggested. Use fallback for paint (decompositon)
+// tiled rendering is suggested. Use fallback for paint (decomposition)
 process(rFillGraphicPrimitive2D);
 return;
 }
diff --git a/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx 
b/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx
index 899851adc84e..d119c8f9c2b9 100644
--- a/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/fillgraphicprimitive2d.hxx
@@ -72,7 +72,7 @@ namespace drawinglayer::primitive2d
 /// local decomposition.
 virtual void create2DDecomposition(Primitive2DContainer& 
rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
 
-// allow this single acessor to change it to set buggered data
+// allow this single accessor to change it to set buggered data
 friend void drawinglayer::processor2d::setOffsetXYCreatedBitmap(
 drawinglayer::primitive2d::FillGraphicPrimitive2D&,
 const BitmapEx&);


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

2023-01-14 Thread Thorsten Behrens (via logerrit)
 drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx |1 +
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx  |1 +
 2 files changed, 2 insertions(+)

New commits:
commit 47ff51eabb58c7aca82968dc31c0ca54e3da2661
Author: Thorsten Behrens 
AuthorDate: Sat Jan 14 16:13:07 2023 +0100
Commit: Thorsten Behrens 
CommitDate: Sat Jan 14 16:00:31 2023 +

Fix non-PCH build

Change-Id: I70c82cece35585b7021c8adef835cc76112c68a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145512
Tested-by: Thorsten Behrens 
Reviewed-by: Thorsten Behrens 

diff --git a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx 
b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
index 6133e7a99936..01abd9ff9af1 100755
--- a/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
+++ b/drawinglayer/source/processor2d/SDPRProcessor2dTools.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #ifdef DBG_UTIL
diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index cedf276e0c3c..4f7632ece672 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 


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

2023-01-14 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/vclprocessor2d.cxx |5 +++-
 sw/qa/extras/layout/layout2.cxx|   23 +
 2 files changed, 10 insertions(+), 18 deletions(-)

New commits:
commit b008831a5545e5a777d77547ef96b9798d795f30
Author: Caolán McNamara 
AuthorDate: Fri Jan 13 17:00:40 2023 +
Commit: Caolán McNamara 
CommitDate: Sat Jan 14 10:54:22 2023 +

tdf#152990 set the font after the MapMode is (potentially) set

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

diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index bd92921396ae..8bd9abadf15c 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -306,7 +306,6 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 mpOutputDevice->SetLayoutMode(nRTLLayoutMode);
 }
 
-mpOutputDevice->SetFont(aFont);
 mpOutputDevice->SetTextColor(Color(aRGBFontColor));
 
 OUString aText(rTextCandidate.getText());
@@ -364,6 +363,10 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
 mpOutputDevice->SetMapMode(aMapMode);
 }
 
+// tdf#152990 set the font after the MapMode is (potentially) set 
so canvas uses the desired
+// font size
+mpOutputDevice->SetFont(aFont);
+
 if (!aDXArray.empty())
 {
 const SalLayoutGlyphs* pGlyphs = 
SalLayoutGlyphsCache::self()->GetLayoutGlyphs(
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index e8bf08dee037..cb7afd519a54 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -1341,19 +1341,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf126244)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
 CPPUNIT_ASSERT(pXmlDoc);
 // Test the first level of vertical category axis labels orientation. The 
first level orientation should be horizontal.
-assertXPath(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[1]", "orientation",
-"0");
+assertXPath(pXmlDoc, "(//font)[1]", "orientation", "0");
 // Test the second level of vertical category axis labels orientation. The 
second level orientation should be vertical.
-sal_Int32 nRotation
-= getXPath(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[5]",
-   "orientation")
-  .toInt32();
+sal_Int32 nRotation = getXPath(pXmlDoc, "(//font)[5]", 
"orientation").toInt32();
 CPPUNIT_ASSERT(nRotation >= 899);
 CPPUNIT_ASSERT(nRotation <= 900);
 // Test the third level of vertical category axis labels orientation. The 
third level orientation should be vertical.
-nRotation = getXPath(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/push[4]/push[1]/font[7]",
- "orientation")
-.toInt32();
+nRotation = getXPath(pXmlDoc, "(//font)[7]", "orientation").toInt32();
 CPPUNIT_ASSERT(nRotation >= 899);
 CPPUNIT_ASSERT(nRotation <= 900);
 }
@@ -1370,18 +1364,13 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf127304)
 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
 CPPUNIT_ASSERT(pXmlDoc);
 // Test the first level of horizontal category axis labels orientation. 
The first level orientation should be vertical.
-sal_Int32 nRotation
-= getXPath(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[1]",
-   "orientation")
-  .toInt32();
+sal_Int32 nRotation = getXPath(pXmlDoc, "(//font)[1]", 
"orientation").toInt32();
 CPPUNIT_ASSERT(nRotation >= 899);
 CPPUNIT_ASSERT(nRotation <= 900);
 // Test the second level of horizontal category axis labels orientation. 
The second level orientation should be horizontal.
-assertXPath(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[5]", "orientation",
-"0");
+assertXPath(pXmlDoc, "(//font)[5]", "orientation", "0");
 // Test the third level of horizontal category axis labels orientation. 
The third level orientation should be horizontal.
-assertXPath(pXmlDoc, 
"/metafile/push[1]/push[1]/push[1]/push[3]/push[1]/font[7]", "orientation",
-"0");
+assertXPath(pXmlDoc, "(//font)[7]", "orientation", "0");
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testHorizontal_multilevel)


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

2023-01-12 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |6 --
 1 file changed, 6 deletions(-)

New commits:
commit 0727e4ca62f40a32926a716fd3fe62343cc76b83
Author: Stephan Bergmann 
AuthorDate: Thu Jan 12 08:31:48 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Jan 12 09:51:44 2023 +

loplugin:unnecessaryoverride (clang-cl)

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 35cc011385aa..2f3d6e25dced 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -72,8 +72,6 @@ public:
 mpD2DFactory.clear();
 }
 
-~ID2D1GlobalFactoryProvider() {}
-
 sal::systools::COMReference& getID2D1Factory() { return 
mpD2DFactory; }
 };
 
@@ -89,8 +87,6 @@ public:
 {
 }
 
-~ID2D1GlobalRenderTargetProvider() {}
-
 sal::systools::COMReference& getID2D1DCRenderTarget()
 {
 if (!mpID2D1DCRenderTarget && 
aID2D1GlobalFactoryProvider.getID2D1Factory())
@@ -367,8 +363,6 @@ public:
 {
 }
 
-~SystemDependentData_ID2D1Bitmap() {}
-
 const sal::systools::COMReference& getID2D1Bitmap() const { 
return mpD2DBitmap; }
 const std::shared_ptr& getAssociatedAlpha() const { return 
maAssociatedAlpha; }
 


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

2023-01-06 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 2eefb695c0bfd00abd22e17e64ab2a1692fe2af4
Author: Andrea Gelmini 
AuthorDate: Fri Jan 6 17:22:05 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Jan 6 17:09:54 2023 +

Fix typos

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 04c6b400039b..3bced719902c 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -1127,7 +1127,7 @@ void D2DPixelProcessor2D::processTransparencePrimitive2D(
 }
 
 // try to create directly, this needs the current mpRT to be a 
ID2D1DeviceContext/d2d1_1
-// what is not guarenteed but usually works for more modern windows (after 
7)
+// what is not guaranteed but usually works for more modern windows (after 
7)
 sal::systools::COMReference pAlphaBitmap(
 implCreateAlpha_Direct(rTransCandidate, aVisibleRange));
 D2D1_MATRIX_3X2_F aMaskScale(D2D1::Matrix3x2F::Identity());
@@ -1818,10 +1818,10 @@ void D2DPixelProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimitiv
 // Embedding/groups that *have* to be processed
 //
 // These represent qualifiers for freely defined content, e.g. making
-// any combinatiopn of priitives freely transformed or transparent
+// any combination of primitives freely transformed or transparent
 // NOTE: PRIMITIVE2D_ID_MODIFIEDCOLORPRIMITIVE2D and
 //   PRIMITIVE2D_ID_TRANSFORMPRIMITIVE2D are pretty much default-
-//   implementations that cand and are re-used in all processors.
+//   implementations that can and are re-used in all processors.
 // So - with these and PRIMITIVE2D_ID_INVERTPRIMITIVE2D marked to
 // be removed in the future - just three really to be implemented
 // locally specifically
@@ -1892,14 +1892,14 @@ void D2DPixelProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimitiv
 case PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D:
 {
 // fat and stroked lines - much better doable locally, would 
decompose
-// to the full line geometry creation (tesselation)
+// to the full line geometry creation (tessellation)
 processPolygonStrokePrimitive2D(
 static_cast(rCandidate));
 break;
 }
 case PRIMITIVE2D_ID_LINERECTANGLEPRIMITIVE2D:
 {
-// simple primitve to support future fast callbacks from 
OutputDevice
+// simple primitive to support future fast callbacks from 
OutputDevice
 // (see 'Example POC' in Gerrit), decomposes to polygon primitive
 processLineRectanglePrimitive2D(
 static_cast(rCandidate));
@@ -1907,7 +1907,7 @@ void D2DPixelProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimitiv
 }
 case PRIMITIVE2D_ID_FILLEDRECTANGLEPRIMITIVE2D:
 {
-// simple primitve to support future fast callbacks from 
OutputDevice
+// simple primitive to support future fast callbacks from 
OutputDevice
 // (see 'Example POC' in Gerrit), decomposes to filled polygon 
primitive
 processFilledRectanglePrimitive2D(
 static_cast(rCandidate));
@@ -1915,7 +1915,7 @@ void D2DPixelProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimitiv
 }
 case PRIMITIVE2D_ID_SINGLELINEPRIMITIVE2D:
 {
-// simple primitve to support future fast callbacks from 
OutputDevice
+// simple primitive to support future fast callbacks from 
OutputDevice
 // (see 'Example POC' in Gerrit), decomposes to polygon primitive
 processSingleLinePrimitive2D(
 static_cast(rCandidate));


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

2023-01-06 Thread Armin Le Grand (Allotropia) (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx  |  596 +++
 include/drawinglayer/processor2d/d2dpixelprocessor2d.hxx |   21 
 2 files changed, 320 insertions(+), 297 deletions(-)

New commits:
commit 7e07225a1b48f3f987a818213256d3cbb9266d87
Author: Armin Le Grand (Allotropia) 
AuthorDate: Fri Jan 6 12:16:10 2023 +0100
Commit: Armin Le Grand 
CommitDate: Fri Jan 6 15:24:39 2023 +

SDPR: Overhauled D2DRenderer to use sal::systools::COMReference

All stuff used from MS with names starting with ID2D1* is COM
API stuff, so referenced and interface-based. I thought about
making this more safe since a while (shared/unique_ptr, ...)
but found no good way to do it.
Also did not want to use CComPtr from MS and expand the devenv
we need on win, so was short before doing an own small smartptr
class. Luckily I asked sberg and he pointed me to the already
existing sal::systools::COMReference which exactly does what
I need here - thanks!
Unluckily I now had to change a lot of code - sigh. I wish
I had known earlier :-/
This change contains the renderer completely adapted to using
that much safer and better ressource control.
Plus I added (even more) comments to try to make more clear
in many plasces what's going on, what is done and why.

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 2ed7ea526959..04c6b400039b 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -56,51 +56,44 @@ using namespace com::sun::star;
 
 namespace
 {
-class ID2D1FactoryProvider
+class ID2D1GlobalFactoryProvider
 {
-ID2D1Factory* mpD2DFactory;
+sal::systools::COMReference mpD2DFactory;
 
 public:
-ID2D1FactoryProvider()
+ID2D1GlobalFactoryProvider()
 : mpD2DFactory(nullptr)
 {
-HRESULT hr = D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, 
__uuidof(ID2D1Factory),
-   nullptr, 
reinterpret_cast());
+const HRESULT hr(D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED,
+   __uuidof(ID2D1Factory), nullptr,
+   
reinterpret_cast()));
 
 if (!SUCCEEDED(hr))
-mpD2DFactory = nullptr;
+mpD2DFactory.clear();
 }
 
-~ID2D1FactoryProvider()
-{
-if (mpD2DFactory)
-mpD2DFactory->Release();
-}
+~ID2D1GlobalFactoryProvider() {}
 
-ID2D1Factory* getID2D1Factory() const { return mpD2DFactory; }
+sal::systools::COMReference& getID2D1Factory() { return 
mpD2DFactory; }
 };
 
-ID2D1FactoryProvider aID2D1FactoryProvider;
+ID2D1GlobalFactoryProvider aID2D1GlobalFactoryProvider;
 
 class ID2D1GlobalRenderTargetProvider
 {
-ID2D1DCRenderTarget* mpID2D1DCRenderTarget;
+sal::systools::COMReference mpID2D1DCRenderTarget;
 
 public:
 ID2D1GlobalRenderTargetProvider()
-: mpID2D1DCRenderTarget(nullptr)
+: mpID2D1DCRenderTarget()
 {
 }
 
-~ID2D1GlobalRenderTargetProvider()
-{
-if (mpID2D1DCRenderTarget)
-mpID2D1DCRenderTarget->Release();
-}
+~ID2D1GlobalRenderTargetProvider() {}
 
-ID2D1DCRenderTarget* getID2D1DCRenderTarget() const
+sal::systools::COMReference& getID2D1DCRenderTarget()
 {
-if (nullptr == mpID2D1DCRenderTarget && 
aID2D1FactoryProvider.getID2D1Factory())
+if (!mpID2D1DCRenderTarget && 
aID2D1GlobalFactoryProvider.getID2D1Factory())
 {
 const D2D1_RENDER_TARGET_PROPERTIES 
aRTProps(D2D1::RenderTargetProperties(
 D2D1_RENDER_TARGET_TYPE_DEFAULT,
@@ -108,9 +101,8 @@ public:
   D2D1_ALPHA_MODE_IGNORE), 
//D2D1_ALPHA_MODE_PREMULTIPLIED),
 0, 0, D2D1_RENDER_TARGET_USAGE_NONE, 
D2D1_FEATURE_LEVEL_DEFAULT));
 
-const HRESULT 
hr(aID2D1FactoryProvider.getID2D1Factory()->CreateDCRenderTarget(
-,
-
&(const_cast(this)->mpID2D1DCRenderTarget)));
+const HRESULT 
hr(aID2D1GlobalFactoryProvider.getID2D1Factory()->CreateDCRenderTarget(
+, ));
 
 // interestingly this ID2D1DCRenderTarget already works and can 
hold
 // created ID2D1Bitmap(s) in RenderTarget-specific form, *without*
@@ -119,7 +111,7 @@ public:
 // to have a HDC that is valid during LO's lifetime.
 
 if (!SUCCEEDED(hr))
-
const_cast(this)->mpID2D1DCRenderTarget = 
nullptr;
+mpID2D1DCRenderTarget.clear();
 }
 
 return mpID2D1DCRenderTarget;
@@ -131,24 +123,20 @@ 

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

2023-01-05 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 8538fec8e87bf6aa08a4b4e192d7d97dc7faf482
Author: Andrea Gelmini 
AuthorDate: Thu Jan 5 23:25:03 2023 +0100
Commit: Julien Nabet 
CommitDate: Fri Jan 6 05:50:48 2023 +

Removed executable permission on source file

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
old mode 100755
new mode 100644


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

2023-01-05 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx  |   26 
+-
 include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx |2 
 include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx  |2 
 3 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 0d6dcc749f2dafe6a66f43524bb0bfe7491546ad
Author: Andrea Gelmini 
AuthorDate: Thu Dec 22 09:40:00 2022 +0100
Commit: Julien Nabet 
CommitDate: Thu Jan 5 18:07:41 2023 +

Fix typos

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
old mode 100644
new mode 100755
index 5de189f16244..2ed7ea526959
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -115,8 +115,8 @@ public:
 // interestingly this ID2D1DCRenderTarget already works and can 
hold
 // created ID2D1Bitmap(s) in RenderTarget-specific form, *without*
 // any call to "BindDC", thus *without* the need of a real HDC - 
nice :-)
-// When that would be needed, Application::GetDefaultDevice() 
would do
-// to have a HDC that is valid during LO livetime.
+// When that would be needed, Application::GetDefaultDevice() 
would need
+// to have a HDC that is valid during LO's lifetime.
 
 if (!SUCCEEDED(hr))
 
const_cast(this)->mpID2D1DCRenderTarget = 
nullptr;
@@ -455,7 +455,7 @@ ID2D1Bitmap* createB2DBitmap(const BitmapEx& rBitmapEx)
 
 // use GlobalRenderTraget to allow usage combined with
 // the Direct2D CreateSharedBitmap-mechanism. This is needed
-// since ID2D1Bitmap is a ID2D1RenderTarget-dependent ressource
+// since ID2D1Bitmap is a ID2D1RenderTarget-dependent resource
 // and thus - in principle - would have to be re-created for
 // *each* new ID2D1RenderTarget, that means for *each* new
 // target HDC, resp. OutputDevice
@@ -545,14 +545,14 @@ ID2D1Bitmap* getOrCreateB2DBitmap(ID2D1RenderTarget& rRT, 
const BitmapEx& rBitma
 }
 
 // This is a simple local derivation of D2DPixelProcessor2D to be used
-// when sub-content needs to be rendered to pixls. Hand over the adapted
+// when sub-content needs to be rendered to pixels. Hand over the adapted
 // ViewInformation2D, a pixel size and the parent RenderTarget. It will
 // locally create and use a ID2D1BitmapRenderTarget to render the stuff
 // (you need to call process() with the primitives to be painted of
-// course). Then use the local helper getID2D1Bitmap() to acces the
+// course). Then use the local helper getID2D1Bitmap() to access the
 // ID2D1Bitmap which was the target of that operation.
 // The class does not need to call mpBitmapRenderTarget->Release() since
-// mpRT of parent is set to it and that calls Release() already itn it's
+// mpRT of parent is set to it and that calls Release() already in its
 // destructor, so no destructor needed here.
 class D2DBitmapPixelProcessor2D final : public 
drawinglayer::processor2d::D2DPixelProcessor2D
 {
@@ -900,7 +900,7 @@ ID2D1Bitmap* D2DPixelProcessor2D::implCreateAlpha_Direct(
 const basegfx::B2DRange& rVisibleRange)
 {
 // Try if we can use ID2D1DeviceContext/d2d1_1 by querying for interface.
-// ony then can we use ID2D1Effect/CLSID_D2D1LuminanceToAlpha and it makes
+// Only then can we use ID2D1Effect/CLSID_D2D1LuminanceToAlpha and it makes
 // sense to try to do it this way in this implementation
 ID2D1DeviceContext* pID2D1DeviceContext(nullptr);
 getRenderTarget().QueryInterface(__uuidof(ID2D1DeviceContext),
@@ -925,7 +925,7 @@ ID2D1Bitmap* D2DPixelProcessor2D::implCreateAlpha_Direct(
 // of it when true by setting used colors to their LuminanceToAlpha values,
 // so another necessity similar and besides a possible ColorModifierStack.
 // That worked okay, since for now this is not complex to do since only
-// gradients (decomnposed to Polygons) get rendered for now when a
+// gradients (decomposed to Polygons) get rendered for now when a
 // TransparencePrimitive2D is processed, so it would work as long as only
 // polygons are treated correctly.
 // But the definition of TransparencePrimitive2D is (see include\
@@ -1006,7 +1006,7 @@ ID2D1Bitmap* D2DPixelProcessor2D::implCreateAlpha_Direct(
 
 if (pID2D1DeviceContext)
 {
-// crete the effect
+// create the effect
 ID2D1Effect* pLuminanceToAlpha(nullptr);
 pID2D1DeviceContext->CreateEffect(CLSID_D2D1LuminanceToAlpha, 
);
 
@@ -1149,8 +1149,8 @@ void D2DPixelProcessor2D::processTransparencePrimitive2D(
 return;
 }
 
-// try to create directly, this needs the curent 

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

2023-01-04 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/cairopixelprocessor2d.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit c938767fc2b3a7334eff1bb192c2f2403c3f9ee8
Author: Caolán McNamara 
AuthorDate: Tue Jan 3 18:55:29 2023 +
Commit: Caolán McNamara 
CommitDate: Wed Jan 4 14:10:41 2023 +

SDPR: sync with "Corrected some transformations in Direct2D renderer"

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

diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index 24cc193ab93f..df9147d6eb56 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -363,10 +363,12 @@ void CairoPixelProcessor2D::processBitmapPrimitive2D(
 // color gets completely replaced, get it
 const basegfx::BColor aModifiedColor(
 maBColorModifierStack.getModifiedColor(basegfx::BColor()));
+
+// use unit geometry as fallback object geometry. Do *not*
+// transform, the below used method will use the already
+// correctly initialized local ViewInformation
 basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon());
-aPolygon.transform(aLocalTransform);
 
-// shortcut with local temporary instance
 rtl::Reference xTemp(
 new 
primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon),
  aModifiedColor));


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

2023-01-03 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 2a4d722c5c8d416bcacb9befd939709f1736b83c
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Jan 3 15:02:54 2023 +0100
Commit: Armin Le Grand 
CommitDate: Tue Jan 3 15:17:03 2023 +

SDPR: Corrected some transformations in Direct2D renderer

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index b830f2c7a3e6..5de189f16244 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -860,8 +860,11 @@ void D2DPixelProcessor2D::processBitmapPrimitive2D(
 // color gets completely replaced, get it
 const basegfx::BColor aModifiedColor(
 maBColorModifierStack.getModifiedColor(basegfx::BColor()));
+
+// use unit geometry as fallback object geometry. Do *not*
+// transform, the below used method will use the already
+// correctly initialized local ViewInformation
 basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon());
-aPolygon.transform(aLocalTransform);
 
 rtl::Reference aTemp(
 new 
primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon),
@@ -1178,7 +1181,8 @@ void D2DPixelProcessor2D::processTransparencePrimitive2D(
 // apply MaskScale to Brush, maybe used if 
implCreateAlpha_B2DBitmap was needed
 pBitmapBrush->SetTransform(aMaskScale);
 
-// need to set transform offset for Layer initialization
+// need to set transform offset for Layer initialization, we work
+// in discrete device coordinates
 getRenderTarget().SetTransform(D2D1::Matrix3x2F::Translation(
 floor(aVisibleRange.getMinX()), 
floor(aVisibleRange.getMinY(;
 
@@ -1248,6 +1252,10 @@ void 
D2DPixelProcessor2D::processUnifiedTransparencePrimitive2D(
 
 if (SUCCEEDED(hr))
 {
+// need to set correct transform for Layer initialization, we work
+// in discrete device coordinates
+getRenderTarget().SetTransform(D2D1::Matrix3x2F::Identity());
+
 getRenderTarget().PushLayer(
 D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr, 
D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
   D2D1::IdentityMatrix(),
@@ -1305,6 +1313,10 @@ void D2DPixelProcessor2D::processMaskPrimitive2DPixel(
 
 if (SUCCEEDED(hr))
 {
+// need to set correct transform for Layer initialization, we 
work
+// in discrete device coordinates
+getRenderTarget().SetTransform(D2D1::Matrix3x2F::Identity());
+
 getRenderTarget().PushLayer(
 D2D1::LayerParameters(D2D1::InfiniteRect(), 
pTransformedMaskGeometry), pLayer);
 process(rMaskCandidate.getChildren());


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

2022-12-29 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/cairopixelprocessor2d.cxx |3 +--
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx   |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit eeaee6726c803cf18c84cd90fca381eb11e9d21f
Author: Caolán McNamara 
AuthorDate: Thu Dec 29 12:03:17 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 29 13:08:43 2022 +

cid#1518242 Logically dead code

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

diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index 9235bc095c81..24cc193ab93f 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -175,8 +175,7 @@ std::vector createBitmapData(const BitmapEx& 
rBitmapEx)
 {
 Bitmap aSrcAlpha(rBitmapEx.GetAlpha().GetBitmap());
 Bitmap::ScopedReadAccess 
pReadAccess(const_cast(rBitmapEx.GetBitmap()));
-Bitmap::ScopedReadAccess pAlphaReadAccess(bAlpha ? 
aSrcAlpha.AcquireReadAccess() : nullptr,
-  aSrcAlpha);
+Bitmap::ScopedReadAccess 
pAlphaReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha);
 const tools::Long nHeight(pReadAccess->Height());
 const tools::Long nWidth(pReadAccess->Width());
 
diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 794f0dee5b68..b830f2c7a3e6 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -418,8 +418,7 @@ ID2D1Bitmap* createB2DBitmap(const BitmapEx& rBitmapEx)
 {
 Bitmap aSrcAlpha(rBitmapEx.GetAlpha().GetBitmap());
 Bitmap::ScopedReadAccess 
pReadAccess(const_cast(rBitmapEx.GetBitmap()));
-Bitmap::ScopedReadAccess pAlphaReadAccess(bAlpha ? 
aSrcAlpha.AcquireReadAccess() : nullptr,
-  aSrcAlpha);
+Bitmap::ScopedReadAccess 
pAlphaReadAccess(aSrcAlpha.AcquireReadAccess(), aSrcAlpha);
 const tools::Long nHeight(pReadAccess->Height());
 const tools::Long nWidth(pReadAccess->Width());
 


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

2022-12-22 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |   19 +---
 1 file changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 1c17356958b07aa7e202d3f9242c807c5dc447ac
Author: Stephan Bergmann 
AuthorDate: Thu Dec 22 09:43:53 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 22 12:10:38 2022 +

-Wc++11-narrowing (clang-cl)

("non-constant-expression cannot be narrowed from type 'double' to 'FLOAT' 
(aka
'float') in initializer list")

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 5604e05b3037..794f0dee5b68 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -1352,7 +1352,7 @@ void D2DPixelProcessor2D::processPointArrayPrimitive2D(
 getViewInformation2D().getObjectToViewTransformation() * pos);
 const double fX(ceil(aDiscretePos.getX()));
 const double fY(ceil(aDiscretePos.getY()));
-const D2D1_RECT_F rect = { fX, fY, fX, fY };
+const D2D1_RECT_F rect = { FLOAT(fX), FLOAT(fY), FLOAT(fX), 
FLOAT(fY) };
 
 getRenderTarget().DrawRectangle(, pColorBrush);
 }
@@ -1399,7 +1399,8 @@ void D2DPixelProcessor2D::processMarkerArrayPrimitive2D(
 getViewInformation2D().getObjectToViewTransformation() * pos);
 const double fX(ceil(aDiscretePos.getX()));
 const double fY(ceil(aDiscretePos.getY()));
-const D2D1_RECT_F rect = { fX - nMiX, fY - nMiY, fX + nPlX, fY + 
nPlY };
+const D2D1_RECT_F rect
+= { FLOAT(fX - nMiX), FLOAT(fY - nMiY), FLOAT(fX + nPlX), 
FLOAT(fY + nPlY) };
 
 getRenderTarget().DrawBitmap(pD2DBitmap, );
 }
@@ -1697,8 +1698,8 @@ void D2DPixelProcessor2D::processLineRectanglePrimitive2D(
 aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), 
aLocalTransform.d(),
 aLocalTransform.e() + fAAOffset, aLocalTransform.f() + fAAOffset));
 const basegfx::B2DRange& 
rRange(rLineRectanglePrimitive2D.getB2DRange());
-const D2D1_RECT_F rect
-= { rRange.getMinX(), rRange.getMinY(), rRange.getMaxX(), 
rRange.getMaxY() };
+const D2D1_RECT_F rect = { FLOAT(rRange.getMinX()), 
FLOAT(rRange.getMinY()),
+   FLOAT(rRange.getMaxX()), 
FLOAT(rRange.getMaxY()) };
 const double fDiscreteLineWidth(
 (getViewInformation2D().getInverseObjectToViewTransformation()
  * basegfx::B2DVector(1.44, 0.0))
@@ -1737,8 +1738,8 @@ void 
D2DPixelProcessor2D::processFilledRectanglePrimitive2D(
 aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), 
aLocalTransform.d(),
 aLocalTransform.e() + fAAOffset, aLocalTransform.f() + fAAOffset));
 const basegfx::B2DRange& 
rRange(rFilledRectanglePrimitive2D.getB2DRange());
-const D2D1_RECT_F rect
-= { rRange.getMinX(), rRange.getMinY(), rRange.getMaxX(), 
rRange.getMaxY() };
+const D2D1_RECT_F rect = { FLOAT(rRange.getMinX()), 
FLOAT(rRange.getMinY()),
+   FLOAT(rRange.getMaxX()), 
FLOAT(rRange.getMaxY()) };
 
 getRenderTarget().FillRectangle(, pColorBrush);
 bDone = true;
@@ -1767,8 +1768,10 @@ void D2DPixelProcessor2D::processSingleLinePrimitive2D(
 const basegfx::B2DPoint aEnd(aLocalTransform * 
rSingleLinePrimitive2D.getEnd());
 
 getRenderTarget().SetTransform(D2D1::Matrix3x2F::Identity());
-const D2D1_POINT_2F aD2D1Start = { aStart.getX() + fAAOffset, 
aStart.getY() + fAAOffset };
-const D2D1_POINT_2F aD2D1End = { aEnd.getX() + fAAOffset, aEnd.getY() 
+ fAAOffset };
+const D2D1_POINT_2F aD2D1Start
+= { FLOAT(aStart.getX() + fAAOffset), FLOAT(aStart.getY() + 
fAAOffset) };
+const D2D1_POINT_2F aD2D1End
+= { FLOAT(aEnd.getX() + fAAOffset), FLOAT(aEnd.getY() + fAAOffset) 
};
 
 getRenderTarget().DrawLine(aD2D1Start, aD2D1End, pColorBrush, 1.44f);
 bDone = true;


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

2022-12-22 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |   17 
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit b844605b101bd752c8a0c07117b5d3faf2b2aebb
Author: Stephan Bergmann 
AuthorDate: Thu Dec 22 09:46:58 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 22 10:57:48 2022 +

loplugin:redundantstatic (clang-cl)

("salhelper::SimpleReferenceObject subclass being directly stack managed, 
should
be managed via rtl::Reference, const 
primitive2d::PolyPolygonColorPrimitive2D")

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 64c458dbb651..5604e05b3037 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -864,11 +864,11 @@ void D2DPixelProcessor2D::processBitmapPrimitive2D(
 basegfx::B2DPolygon aPolygon(basegfx::utils::createUnitPolygon());
 aPolygon.transform(aLocalTransform);
 
-// shortcut with local temporary instance
-const primitive2d::PolyPolygonColorPrimitive2D 
aTemp(basegfx::B2DPolyPolygon(aPolygon),
- 
aModifiedColor);
+rtl::Reference aTemp(
+new 
primitive2d::PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon),
+ aModifiedColor));
 
-processPolyPolygonColorPrimitive2D(aTemp);
+processPolyPolygonColorPrimitive2D(*aTemp);
 return;
 }
 }
@@ -1507,10 +1507,11 @@ void 
D2DPixelProcessor2D::processPolygonStrokePrimitive2D(
 const attribute::LineAttribute aRed(
 basegfx::BColor(1.0, 0.0, 0.0), rLineAttribute.getWidth(), 
rLineAttribute.getLineJoin(),
 rLineAttribute.getLineCap(), 
rLineAttribute.getMiterMinimumAngle());
-const primitive2d::PolygonStrokePrimitive2D aCopy(
-rPolygonStrokeCandidate.getB2DPolygon(), aRed,
-rPolygonStrokeCandidate.getStrokeAttribute());
-process(aCopy);
+rtl::Reference aCopy(
+new primitive2d::PolygonStrokePrimitive2D(
+rPolygonStrokeCandidate.getB2DPolygon(), aRed,
+rPolygonStrokeCandidate.getStrokeAttribute()));
+process(*aCopy);
 }
 
 bool bDone(false);


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

2022-12-22 Thread Stephan Bergmann (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit e8996124b443d416eafedc68dc25a5ec66dd84db
Author: Stephan Bergmann 
AuthorDate: Thu Dec 22 09:46:18 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 22 10:44:52 2022 +

loplugin:redundantstatic (clang-cl)

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index bc9b81daddec..64c458dbb651 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -80,7 +80,7 @@ public:
 ID2D1Factory* getID2D1Factory() const { return mpD2DFactory; }
 };
 
-static ID2D1FactoryProvider aID2D1FactoryProvider;
+ID2D1FactoryProvider aID2D1FactoryProvider;
 
 class ID2D1GlobalRenderTargetProvider
 {
@@ -126,7 +126,7 @@ public:
 }
 };
 
-static ID2D1GlobalRenderTargetProvider aID2D1GlobalRenderTargetProvider;
+ID2D1GlobalRenderTargetProvider aID2D1GlobalRenderTargetProvider;
 
 class SystemDependentData_ID2D1PathGeometry : public 
basegfx::SystemDependentData
 {


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

2022-12-22 Thread Andrea Gelmini (via logerrit)
 drawinglayer/source/processor2d/cairopixelprocessor2d.cxx |2 +-
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 070d655e3fc127da3f2428b3f85f751ce9b8bdd1
Author: Andrea Gelmini 
AuthorDate: Thu Dec 22 09:27:45 2022 +0100
Commit: Julien Nabet 
CommitDate: Thu Dec 22 08:29:58 2022 +

Fix typo

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

diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index 83edd51be0b3..278b55f86723 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -221,7 +221,7 @@ void 
CairoPixelProcessor2D::processPolygonHairlinePrimitive2D(
 // TODO: Unfortunately Direct2D paint of one pixel wide lines does not
 // correctly and completely blend 100% over the background. Experimenting
 // shows that a value around/slightly below 2.0 is needed which hints that
-// alpha bleding the half-shifted lines (see fAAOffset above) is involved.
+// alpha blending the half-shifted lines (see fAAOffset above) is involved.
 // To get correct blending I try to use just wider hairlines for now. This
 // may need to be improved - or balanced (trying sqrt(2) now...)
 cairo_set_line_width(mpRT, 1.44f);
diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index 6edce17ee5ed..13224cd972b6 100644
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -756,7 +756,7 @@ void D2DPixelProcessor2D::processPolygonHairlinePrimitive2D(
 // TODO: Unfortunately Direct2D paint of one pixel wide lines 
does not
 // correctly and completely blend 100% over the background. 
Experimenting
 // shows that a value around/slightly below 2.0 is needed 
which hints that
-// alpha bleding the half-shifted lines (see fAAOffset above) 
is involved.
+// alpha blending the half-shifted lines (see fAAOffset above) 
is involved.
 // To get correct blending I try to use just wider hairlines 
for now. This
 // may need to be improved - or balanced (trying sqrt(2) 
now...)
 getRenderTarget().DrawGeometry(pTransformedGeometry, 
pColorBrush, 1.44f);


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

2022-12-21 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/processor2d/cairopixelprocessor2d.cxx  |  122 -
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx|7 
 include/drawinglayer/processor2d/cairopixelprocessor2d.hxx |   24 --
 3 files changed, 131 insertions(+), 22 deletions(-)

New commits:
commit f2e8422f2fc5753745ef272c621b24b0614c0ec7
Author: Caolán McNamara 
AuthorDate: Wed Dec 21 17:18:37 2022 +
Commit: Caolán McNamara 
CommitDate: Wed Dec 21 20:18:30 2022 +

sync with latest additions to d2dpixelprocessor2d

commit 7d948d5c7edbbfd29a77b97a5101aa43917e5ec2
Date:   Tue Dec 20 18:42:42 2022 +0100

SDPR: Add handling/direct rendering of some simple Primitives

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

diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index 4b79ff89592d..83edd51be0b3 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -493,9 +493,9 @@ void CairoPixelProcessor2D::processPolygonStrokePrimitive2D(
 const basegfx::B2DHomMatrix& rObjectToView(
 getViewInformation2D().getObjectToViewTransformation());
 const double fDiscreteLineWidth(
-bHairline ? 1.0
-  : ceil((rObjectToView * 
basegfx::B2DVector(rLineAttribute.getWidth(), 0.0))
- .getLength()));
+bHairline
+? 1.0
+: (rObjectToView * basegfx::B2DVector(rLineAttribute.getWidth(), 
0.0)).getLength());
 
 // Here for every combination which the system-specific implementation is 
not
 // capable of visualizing, use the (for decomposable Primitives always 
possible)
@@ -615,6 +615,104 @@ void 
CairoPixelProcessor2D::processPolygonStrokePrimitive2D(
 cairo_restore(mpRT);
 }
 
+void CairoPixelProcessor2D::processLineRectanglePrimitive2D(
+const primitive2d::LineRectanglePrimitive2D& rLineRectanglePrimitive2D)
+{
+if (rLineRectanglePrimitive2D.getB2DRange().isEmpty())
+{
+// no geometry, done
+return;
+}
+
+cairo_save(mpRT);
+
+cairo_matrix_t aMatrix;
+const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 
0.0);
+const basegfx::B2DHomMatrix& rObjectToView(
+getViewInformation2D().getObjectToViewTransformation());
+cairo_matrix_init(, rObjectToView.a(), rObjectToView.b(), 
rObjectToView.c(),
+  rObjectToView.d(), rObjectToView.e() + fAAOffset,
+  rObjectToView.f() + fAAOffset);
+
+// set linear transformation
+cairo_set_matrix(mpRT, );
+
+const basegfx::BColor aHairlineColor(
+
maBColorModifierStack.getModifiedColor(rLineRectanglePrimitive2D.getBColor()));
+cairo_set_source_rgb(mpRT, aHairlineColor.getRed(), 
aHairlineColor.getGreen(),
+ aHairlineColor.getBlue());
+
+const double 
fDiscreteLineWidth((getViewInformation2D().getInverseObjectToViewTransformation()
+ * basegfx::B2DVector(1.44, 0.0))
+.getLength());
+cairo_set_line_width(mpRT, fDiscreteLineWidth);
+
+const basegfx::B2DRange& rRange(rLineRectanglePrimitive2D.getB2DRange());
+cairo_rectangle(mpRT, rRange.getMinX(), rRange.getMinY(), 
rRange.getWidth(),
+rRange.getHeight());
+cairo_stroke(mpRT);
+
+cairo_restore(mpRT);
+}
+
+void CairoPixelProcessor2D::processFilledRectanglePrimitive2D(
+const primitive2d::FilledRectanglePrimitive2D& rFilledRectanglePrimitive2D)
+{
+if (rFilledRectanglePrimitive2D.getB2DRange().isEmpty())
+{
+// no geometry, done
+return;
+}
+
+cairo_save(mpRT);
+
+cairo_matrix_t aMatrix;
+const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 0.5 : 
0.0);
+const basegfx::B2DHomMatrix& rObjectToView(
+getViewInformation2D().getObjectToViewTransformation());
+cairo_matrix_init(, rObjectToView.a(), rObjectToView.b(), 
rObjectToView.c(),
+  rObjectToView.d(), rObjectToView.e() + fAAOffset,
+  rObjectToView.f() + fAAOffset);
+
+// set linear transformation
+cairo_set_matrix(mpRT, );
+
+const basegfx::BColor aFillColor(
+
maBColorModifierStack.getModifiedColor(rFilledRectanglePrimitive2D.getBColor()));
+cairo_set_source_rgb(mpRT, aFillColor.getRed(), aFillColor.getGreen(), 
aFillColor.getBlue());
+
+const basegfx::B2DRange& rRange(rFilledRectanglePrimitive2D.getB2DRange());
+cairo_rectangle(mpRT, rRange.getMinX(), rRange.getMinY(), 
rRange.getWidth(),
+rRange.getHeight());
+cairo_fill(mpRT);
+
+cairo_restore(mpRT);
+}
+
+void 

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

2022-12-20 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx  |  133 ++-
 include/drawinglayer/processor2d/d2dpixelprocessor2d.hxx |9 +
 2 files changed, 138 insertions(+), 4 deletions(-)

New commits:
commit 7d948d5c7edbbfd29a77b97a5101aa43917e5ec2
Author: Armin Le Grand (allotropia) 
AuthorDate: Tue Dec 20 18:42:42 2022 +0100
Commit: Armin Le Grand 
CommitDate: Tue Dec 20 19:45:56 2022 +

SDPR: Add handling/direct rendering of some simple Primitives

(SDPR == SystemDependentPrimitiveRenderer)
Make D2DPixelProcessor2D directly render the added simple
Primitives
  LineRectanglePrimitive2D
  FilledRectanglePrimitive2D
  SingleLinePrimitive2D
to use less ressources & get faster since no conversion to
Polygons is done. These are Primitives that *may* be handled
directly, but do not have to - I checked that the decomposes
do work before adding direct handling.

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
old mode 100755
new mode 100644
index 9e76cfa461a3..e2657d9cf677
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -1476,10 +1476,10 @@ void 
D2DPixelProcessor2D::processPolygonStrokePrimitive2D(
 const basegfx::B2DHomMatrix& rObjectToView(
 getViewInformation2D().getObjectToViewTransformation());
 const double fDiscreteLineWidth(
-bHairline ? 1.0
-  : ceil(basegfx::B2DVector(rObjectToView
-* 
basegfx::B2DVector(rLineAttribute.getWidth(), 0.0))
- .getLength()));
+bHairline
+? 1.0
+: basegfx::B2DVector(rObjectToView * 
basegfx::B2DVector(rLineAttribute.getWidth(), 0.0))
+  .getLength());
 
 // Here for every combination which the system-specific implementation is 
not
 // capable of visualizing, use the (for decomposable Primitives always 
possible)
@@ -1672,6 +1672,113 @@ void 
D2DPixelProcessor2D::processPolygonStrokePrimitive2D(
 }
 }
 
+void D2DPixelProcessor2D::processLineRectanglePrimitive2D(
+const primitive2d::LineRectanglePrimitive2D& rLineRectanglePrimitive2D)
+{
+if (rLineRectanglePrimitive2D.getB2DRange().isEmpty())
+{
+// no geometry, done
+return;
+}
+
+const basegfx::BColor aHairlineColor(
+
maBColorModifierStack.getModifiedColor(rLineRectanglePrimitive2D.getBColor()));
+const D2D1::ColorF aD2DColor(aHairlineColor.getRed(), 
aHairlineColor.getGreen(),
+ aHairlineColor.getBlue());
+ID2D1SolidColorBrush* pColorBrush(nullptr);
+HRESULT hr(getRenderTarget().CreateSolidColorBrush(aD2DColor, 
));
+bool bDone(false);
+
+if (SUCCEEDED(hr))
+{
+const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 
0.5 : 0.0);
+const basegfx::B2DHomMatrix aLocalTransform(
+getViewInformation2D().getObjectToViewTransformation());
+getRenderTarget().SetTransform(D2D1::Matrix3x2F(
+aLocalTransform.a(), aLocalTransform.b(), aLocalTransform.c(), 
aLocalTransform.d(),
+aLocalTransform.e() + fAAOffset, aLocalTransform.f() + fAAOffset));
+const basegfx::B2DRange& 
rRange(rLineRectanglePrimitive2D.getB2DRange());
+const D2D1_RECT_F rect
+= { rRange.getMinX(), rRange.getMinY(), rRange.getMaxX(), 
rRange.getMaxY() };
+const double fDiscreteLineWidth(
+
basegfx::B2DVector(getViewInformation2D().getInverseObjectToViewTransformation()
+   * basegfx::B2DVector(1.44, 0.0))
+.getLength());
+
+getRenderTarget().DrawRectangle(, pColorBrush, 
fDiscreteLineWidth);
+bDone = true;
+}
+
+if (!bDone)
+increaseError();
+}
+
+void D2DPixelProcessor2D::processFilledRectanglePrimitive2D(
+const primitive2d::FilledRectanglePrimitive2D& rFilledRectanglePrimitive2D)
+{
+if (rFilledRectanglePrimitive2D.getB2DRange().isEmpty())
+{
+// no geometry, done
+return;
+}
+
+const basegfx::BColor aFillColor(
+
maBColorModifierStack.getModifiedColor(rFilledRectanglePrimitive2D.getBColor()));
+const D2D1::ColorF aD2DColor(aFillColor.getRed(), aFillColor.getGreen(), 
aFillColor.getBlue());
+ID2D1SolidColorBrush* pColorBrush(nullptr);
+HRESULT hr(getRenderTarget().CreateSolidColorBrush(aD2DColor, 
));
+bool bDone(false);
+
+if (SUCCEEDED(hr))
+{
+const double fAAOffset(getViewInformation2D().getUseAntiAliasing() ? 
0.5 : 0.0);
+const basegfx::B2DHomMatrix aLocalTransform(
+

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

2022-12-20 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx |   21 
 1 file changed, 17 insertions(+), 4 deletions(-)

New commits:
commit 45ece6e7fc4a1736dc5bbc5bd9b74b839ec81253
Author: Mike Kaganski 
AuthorDate: Tue Dec 20 16:25:51 2022 +
Commit: Mike Kaganski 
CommitDate: Tue Dec 20 17:13:44 2022 +

Fix no-pch build

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

diff --git a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
index fc8f31bc285a..9e76cfa461a3 100755
--- a/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/d2dpixelprocessor2d.cxx
@@ -17,6 +17,14 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+
+// win-specific
+#include 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -28,16 +36,21 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
-
-// win-specific
-#include 
-#include 
+#include 
 
 using namespace com::sun::star;
 


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

2022-12-20 Thread Armin Le Grand (allotropia) (via logerrit)
 drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx|   49 +++
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx |  148 
+-
 include/drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx   |   39 ++
 include/drawinglayer/primitive2d/PolygonHairlinePrimitive2D.hxx|   82 +
 include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx |3 
 5 files changed, 309 insertions(+), 12 deletions(-)

New commits:
commit fe589d8e5465320f49feeb41d493f84e630bced3
Author: Armin Le Grand (allotropia) 
AuthorDate: Mon Dec 19 19:15:52 2022 +0100
Commit: Armin Le Grand 
CommitDate: Tue Dec 20 12:25:28 2022 +

Added two simple tooling Primitives for easy/common cases

Added three simple tooling Primitives:

(1) SingleLinePrimitive2D:
Just a Line from Point A to B with a BColor, decomposes
to a PolygonHairlinePrimitive2D (and to a PointArrayPrimitive2D
if only a single point aka A == B)

(2) LineRectanglePrimitive2D:
(3) FilledRectanglePrimitive2D:
Rectangles that support fill or line, gets decomposed
to maybe PolyPolygonColorPrimitive2D (if filled) and a
PolygonHairlinePrimitive2D (if line) or nothing if the
B2DRange is empty

NOTE: If using these despite being hor/ver aligned due to
their nature as B2DRange(s) (aka 'non rotated/sheared')
these may have to be transformed if the current
transformation context you are working in is rotated
or sheared, so *ensure* to handle these correctly if
you do handle them yourself. This is not needed with
the Polygon-based ones - that's why these are - and
stay - the common case(s).

Both are hairline primitives themselves, so are potentially
*view-dependent* (see comment in *.cxx and *.hxx). They will be
useful as very simple primitives for small renderers, e.g. to
avoid conversion from rectangles or just lines to polygons.

The more general Primitives are always the polygon-based ones,
so these new ones get decomposed to these (decomposition direction,
complex -> simpler). This assures that a processor/renderer has
minimally to support the polygon-based ones, but *can* use these
simple tooling ones directly if he wants to.

This will come in handy for future System-Dependent PrimitiveRenderers,
which I am currently working on one to offer as example - this leads
to identifying helpful upstream things that will come in handy in that
regard - like these ones.

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

diff --git a/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx 
b/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
index ff5578104374..6c7cf4bb365a 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonColorPrimitive2D.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -61,6 +62,54 @@ sal_uInt32 PolyPolygonColorPrimitive2D::getPrimitive2DID() 
const
 return PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D;
 }
 
+FilledRectanglePrimitive2D::FilledRectanglePrimitive2D(const 
basegfx::B2DRange& rB2DRange,
+   const basegfx::BColor& 
rBColor)
+: BasePrimitive2D()
+, maB2DRange(rB2DRange)
+, maBColor(rBColor)
+{
+}
+
+bool FilledRectanglePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) 
const
+{
+if (BasePrimitive2D::operator==(rPrimitive))
+{
+const FilledRectanglePrimitive2D& rCompare(
+static_cast(rPrimitive));
+
+return (getB2DRange() == rCompare.getB2DRange() && getBColor() == 
rCompare.getBColor());
+}
+
+return false;
+}
+
+basegfx::B2DRange FilledRectanglePrimitive2D::getB2DRange(
+const geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+return getB2DRange();
+}
+
+sal_uInt32 FilledRectanglePrimitive2D::getPrimitive2DID() const
+{
+return PRIMITIVE2D_ID_FILLEDRECTANGLEPRIMITIVE2D;
+}
+
+void FilledRectanglePrimitive2D::get2DDecomposition(
+Primitive2DDecompositionVisitor& rVisitor,
+const geometry::ViewInformation2D& /*rViewInformation*/) const
+{
+if (getB2DRange().isEmpty())
+{
+// no geometry, done
+return;
+}
+
+const basegfx::B2DPolygon 
aPolygon(basegfx::utils::createPolygonFromRect(getB2DRange()));
+Primitive2DContainer aSequence
+= { new PolyPolygonColorPrimitive2D(basegfx::B2DPolyPolygon(aPolygon), 
getBColor()) };
+rVisitor.visit(aSequence);
+}
+
 } // end drawinglayer::primitive2d namespace
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx 
b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
index 

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

2022-12-01 Thread Michael Stahl (via logerrit)
 drawinglayer/source/tools/primitive2dxmldump.cxx |   14 ++
 1 file changed, 14 insertions(+)

New commits:
commit d7e80e272a83f960b06521595bd494f2dc84038a
Author: Michael Stahl 
AuthorDate: Wed Nov 30 19:23:09 2022 +0100
Commit: Michael Stahl 
CommitDate: Thu Dec 1 19:31:44 2022 +0100

drawinglayer: add StructureTagPrimitive to XML dump

Turned out to be unnecessary but why not add it.

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

diff --git a/drawinglayer/source/tools/primitive2dxmldump.cxx 
b/drawinglayer/source/tools/primitive2dxmldump.cxx
index 176b1384dd86..74e95836fdf9 100644
--- a/drawinglayer/source/tools/primitive2dxmldump.cxx
+++ b/drawinglayer/source/tools/primitive2dxmldump.cxx
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -947,6 +948,19 @@ void Primitive2dXmlDump::decomposeAndWrite(
 }
 break;
 
+case PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D:
+{
+const StructureTagPrimitive2D& rStructureTagPrimitive2D
+= dynamic_cast(*pBasePrimitive);
+rWriter.startElement("structuretag");
+rWriter.attribute("structureelement",
+  
rStructureTagPrimitive2D.getStructureElement());
+
+decomposeAndWrite(rStructureTagPrimitive2D.getChildren(), 
rWriter);
+rWriter.endElement();
+}
+break;
+
 case PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D:
 {
 const SvgRadialGradientPrimitive2D& 
rSvgRadialGradientPrimitive2D


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

2022-12-01 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |5 +
 svx/source/table/viewcontactoftableobj.cxx |8 ++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx |   41 -
 3 files changed, 52 insertions(+), 2 deletions(-)

New commits:
commit 0bc96b8805f2cfa2278729a9f3e56a350ddd69ad
Author: Michael Stahl 
AuthorDate: Wed Nov 30 15:06:02 2022 +0100
Commit: Michael Stahl 
CommitDate: Thu Dec 1 17:01:42 2022 +0100

tdf#135192 drawinglayer,svx: PDF/UA export: also tag TH for SdrTableObj

There isn't really an indication of anything being a header row, but the
table template application has a flag to apply special formatting to the
first row, so let's use that as indication that it's a header row

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 393fbfee9cfc..3b3f27ba302c 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2460,6 +2460,11 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 default:
 break;
 }
+if (rTagElement == vcl::PDFWriter::TableHeader)
+{
+
mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Scope,
+  
vcl::PDFWriter::Column);
+}
 }
 // background object
 else
diff --git a/svx/source/table/viewcontactoftableobj.cxx 
b/svx/source/table/viewcontactoftableobj.cxx
index df271a3e2404..da11d1741789 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -354,9 +354,15 @@ namespace sdr::contact
 }
 if (pPage)
 {
+// heuristic: if there's a special formatting 
on
+// first row, assume that it's a header row
+auto const eType(
+   aCellPos.mnRow == 0 && 
rTableObj.getTableStyleSettings().mbUseFirstRow
+   ? vcl::PDFWriter::TableHeader
+   : vcl::PDFWriter::TableData);
 cell = 
drawinglayer::primitive2d::Primitive2DContainer {
 new 
drawinglayer::primitive2d::StructureTagPrimitive2D(
-vcl::PDFWriter::TableData,
+eType,
 pPage->IsMasterPage(),
 false,
 std::move(cell)) };
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx 
b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 8756dc9b5d77..ea8f83e6ba8f 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -3461,7 +3461,46 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf135192)
 auto pS3 = dynamic_cast<
 
vcl::filter::PDFNameElement*>(
 pObject3->Lookup("S"));
-if (pS3 && pS3->GetValue() 
== "TD")
+if (nTR == 0 && pS3 && 
pS3->GetValue() == "TH")
+{
+int nOTable(0);
+auto pAttrs = 
dynamic_cast<
+
vcl::filter::PDFArrayElement*>(
+
pObject3->Lookup("A"));
+CPPUNIT_ASSERT(pAttrs 
!= nullptr);
+for (const auto& 
rAttrRef :
+ 
pAttrs->GetElements())
+{
+auto pARef = 
dynamic_cast<
+
vcl::filter::PDFReferenceElement*>(
+rAttrRef);
+
CPPUNIT_ASSERT(pARef != nullptr);
+auto pAttr = 
pARef->LookupObject();
+  

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

2022-12-01 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/primitive2d/textlayoutdevice.cxx |2 +-
 editeng/source/items/svxfont.cxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2b1d0d7b3d8df805abefdb4b4a80f8f17d6924cc
Author: Caolán McNamara 
AuthorDate: Thu Dec 1 11:24:49 2022 +
Commit: Caolán McNamara 
CommitDate: Thu Dec 1 15:13:06 2022 +0100

OutputDevice::GetTextArray will always set the size of the vector anyway

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

diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx 
b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 78e0c23189ad..fcc9b401fa48 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -308,7 +308,7 @@ std::vector TextLayouterDevice::getTextArray(const 
OUString& rText, sal_
 if (nTextLength)
 {
 aRetval.reserve(nTextLength);
-std::vector aArray(nTextLength);
+std::vector aArray;
 mrDevice.GetTextArray(rText, , nIndex, nTextLength);
 aRetval.assign(aArray.begin(), aArray.end());
 }
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index 9911beec85b0..b6f9617a4c27 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -441,7 +441,7 @@ Size SvxFont::GetPhysTxtSize( const OutputDevice *pOut, 
const OUString ,
 if( IsFixKerning() && ( nLen > 1 ) )
 {
 auto nKern = GetFixKerning();
-std::vector aDXArray(nLen);
+std::vector aDXArray;
 GetTextArray(pOut, rTxt, , nIdx, nLen);
 tools::Long nOldValue = aDXArray[0];
 sal_Int32 nSpaceCount = 0;


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

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

New commits:
commit 082f0b250a04e16d608ce67e08e702874f390b15
Author: Armin Le Grand (allotropia) 
AuthorDate: Wed Nov 30 17:12:59 2022 +0100
Commit: Armin Le Grand 
CommitDate: Thu Dec 1 10:41:20 2022 +0100

Handle PolyPolygonGraphicPrimitive2D with used DefinitionRange correctly

If the range which defines the bitmap fill is defined and different from
the range of the defining geometry (e.g. used for FillStyle
UseSlideBackground) this cannot be expressed in a SvtGraphicFill data
package. Thus, just use decomposition here directly. See also
tdf#149754 in drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
and the comment there for more info.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index e771d2466b1d..393fbfee9cfc 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1789,6 +1789,16 @@ void 
VclMetafileProcessor2D::processPolyPolygonGraphicPrimitive2D(
 // need to handle PolyPolygonGraphicPrimitive2D here to support 
XPATHFILL_SEQ_BEGIN/XPATHFILL_SEQ_END
 basegfx::B2DPolyPolygon 
aLocalPolyPolygon(rBitmapCandidate.getB2DPolyPolygon());
 
+if (!rBitmapCandidate.getDefinitionRange().isEmpty()
+&& aLocalPolyPolygon.getB2DRange() != 
rBitmapCandidate.getDefinitionRange())
+{
+// The range which defines the bitmap fill is defined and different 
from the
+// range of the defining geometry (e.g. used for FillStyle 
UseSlideBackground).
+// This cannot be done calling vcl, thus use decomposition here 
directly
+process(rBitmapCandidate);
+return;
+}
+
 fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon);
 
 std::unique_ptr pSvtGraphicFill;


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

2022-11-25 Thread Michael Stahl (via logerrit)
 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx  |7 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |   89 ++-
 drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx   |5 
 drawinglayer/source/processor2d/vclprocessor2d.cxx   |   15 -
 drawinglayer/source/processor2d/vclprocessor2d.hxx   |   12 -
 include/drawinglayer/primitive2d/structuretagprimitive2d.hxx |1 
 6 files changed, 68 insertions(+), 61 deletions(-)

New commits:
commit 78681cd0829dcb6a73690e1a63ae3808d297677a
Author: Michael Stahl 
AuthorDate: Wed Nov 23 19:08:14 2022 +0100
Commit: Michael Stahl 
CommitDate: Fri Nov 25 11:47:13 2022 +0100

tdf#57423 drawinglayer: PDF/UA export: more Alt texts for SdrObjects

Currently /Alt texts are generated from ObjectInfoPrimitive2D, but this
is only evaluated in VclMetafileProcessor2D::processGraphicPrimitive2D()
so while it's created for every SdrObject, it's ignored in most cases.

There doesn't appear to be a reason why this is done in
processGraphicPrimitive2D() and not a more generic location, the special
conditions that are checked there don't have anything to do with Alt
texts, they effectively guard some optimisation done to bitmaps in
PageSyncData::PlaySyncPageAct().

There is another issue in that not every SdrObject gets a
StructureTagPrimitive2D, and even if there is a StructureTagPrimitive2D
it may be ignored if it's in the background.

The Alt text must only be produced if there is a structure element for
the same SdrObject, else it would end up on some unrelated structure
element.

Fix all this by moving processing to a new function which checks that
there is a current StructureTagPrimitive2D for a SdrObject in effect.

The only problem with this is that previously Writer images produced Alt
text, and now they don't - but Writer needs some fixing anyway.

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

diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx 
b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
index 01d09d8372d5..7e4de87ed64a 100644
--- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
@@ -59,6 +59,13 @@ namespace drawinglayer::primitive2d
 return PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D;
 }
 
+bool StructureTagPrimitive2D::isTaggedSdrObject() const
+{
+// note at the moment *all* StructureTagPrimitive2D are created for
+// SdrObjects - if that ever changes, need another condition here
+return !isBackground() || isImage();
+}
+
 } // end of namespace
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 09ee03bba126..e771d2466b1d 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -947,7 +948,7 @@ void VclMetafileProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimi
 }
 case PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D:
 {
-RenderObjectInfoPrimitive2D(
+processObjectInfoPrimitive2D(
 static_cast(rCandidate));
 break;
 }
@@ -960,6 +961,51 @@ void VclMetafileProcessor2D::processBasePrimitive2D(const 
primitive2d::BasePrimi
 }
 }
 
+void VclMetafileProcessor2D::processObjectInfoPrimitive2D(
+primitive2d::ObjectInfoPrimitive2D const& rObjectInfoPrimitive2D)
+{
+// currently StructureTagPrimitive2D is only used for SdrObjects - have to
+// avoid adding Alt text if the SdrObject is not actually tagged, as it
+// would then end up on an unrelated structure element.
+if (mpCurrentStructureTag && mpCurrentStructureTag->isTaggedSdrObject())
+{
+// Create image alternative description from ObjectInfoPrimitive2D info
+// for PDF export, for the currently active SdrObject's structure 
element
+if (mpPDFExtOutDevData->GetIsExportTaggedPDF())
+{
+OUString aAlternateDescription;
+
+if (!rObjectInfoPrimitive2D.getTitle().isEmpty())
+{
+aAlternateDescription += rObjectInfoPrimitive2D.getTitle();
+}
+
+if (!rObjectInfoPrimitive2D.getDesc().isEmpty())
+{
+if (!aAlternateDescription.isEmpty())
+{
+aAlternateDescription += " - ";
+}
+
+aAlternateDescription += 

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

2022-11-22 Thread Michael Stahl (via logerrit)
 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx  |4 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |   23 +
 include/drawinglayer/primitive2d/structuretagprimitive2d.hxx |6 
 include/svx/svdobj.hxx   |1 
 svx/source/sdr/contact/viewobjectcontact.cxx |   10 
 svx/source/svdraw/svdobj.cxx |5 
 sw/inc/dcontact.hxx  |1 
 sw/source/core/text/EnhancedPDFExportHelper.cxx  |   33 +-
 vcl/qa/cppunit/pdfexport/data/image-shape.fodt   |  141 +++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |   97 +++
 10 files changed, 309 insertions(+), 12 deletions(-)

New commits:
commit 6e5d59c2ca6969e9491f97cd7a00d094fc62cfb3
Author: Michael Stahl 
AuthorDate: Mon Nov 21 11:47:16 2022 +0100
Commit: Michael Stahl 
CommitDate: Tue Nov 22 13:05:07 2022 +0100

tdf#135638 drawinglayer,svx,sw: PDF/UA export: put SdrObjects on anchor

... frame in the structure tree.

The problem is that in sw, the anchored objects are painted
outside of the call to paint the page frame, which is what generates the
/Document structure element.

For Writer fly frames, this is handled via their SwFlyDrawObj painting,
where SwTaggedPDFHelper::CheckReopenTag() finds the anchor frame and
temporarily sets it as the structure parent, even if it's on a previous
page.

But all the SdrObjects on a page are painted by 2 calls to PaintLayer()
and there isn't a call back into Writer now.

Somehow this even causes a spurious line like "/Document<>BDC"
to be emitted outside any PDF object, which looks clearly wrong.

Try to extend the SdrObjUserCall to get a way to retrieve the anchor
frame's structure element index.

Another option would be to extend ViewObjectContactRedirector to return
the PDF Id in its subclass SwViewObjectContactRedirector, and it seems
possible since its only one caller is
ViewObjectContact::getPrimitive2DSequence(), but Armin adivses that the
ViewObjectContactRedirector might go away in the future so it's better
to use SdrObjUserCall.

It's annoying that the mapping is a static members of
SwEnhancedPDFExportHelper; possibly it could be in OutputDevice's
PDFExtOutDevData instead?

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

diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx 
b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
index c82b0088e29d..01d09d8372d5 100644
--- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
@@ -30,11 +30,13 @@ namespace drawinglayer::primitive2d
 const vcl::PDFWriter::StructElement& rStructureElement,
 bool bBackground,
 bool bIsImage,
-Primitive2DContainer&& aChildren)
+Primitive2DContainer&& aChildren,
+sal_Int32 const nAnchorStructureElementId)
 :   GroupPrimitive2D(std::move(aChildren)),
 maStructureElement(rStructureElement),
 mbBackground(bBackground),
 mbIsImage(bIsImage)
+,   m_nAnchorStructureElementId(nAnchorStructureElementId)
 {
 }
 
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 3af04ee0c335..09ee03bba126 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2364,12 +2364,27 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 // structured tag primitive
 const vcl::PDFWriter::StructElement& 
rTagElement(rStructureTagCandidate.getStructureElement());
 bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement));
+sal_Int32 nPreviousElement(-1);
 
 if (mpPDFExtOutDevData && bTagUsed)
 {
 // foreground object: tag as regular structure element
 if (!rStructureTagCandidate.isBackground())
 {
+if (rStructureTagCandidate.GetAnchorStructureElementId() != -1)
+{
+auto const nTemp = 
mpPDFExtOutDevData->GetCurrentStructureElement();
+bool const bSuccess = 
mpPDFExtOutDevData->SetCurrentStructureElement(
+rStructureTagCandidate.GetAnchorStructureElementId());
+if (bSuccess)
+{
+nPreviousElement = nTemp;
+}
+else
+{
+SAL_WARN("drawinglayer", "anchor structure element not 
found?");
+}
+}
 

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

2022-11-22 Thread Michael Stahl (via logerrit)
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   43 +
 1 file changed, 43 insertions(+)

New commits:
commit 3d5e3cb4c033cc7b03c18851d56ca529f025038b
Author: Michael Stahl 
AuthorDate: Thu Nov 17 20:47:36 2022 +0100
Commit: Michael Stahl 
CommitDate: Tue Nov 22 13:04:21 2022 +0100

tdf#135638 drawinglayer: PDF/UA export: add BBox to Figures

PAC3 complains: "Figure" element on a single page without bounding box

Also add Placement while at it.

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

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index eb5f32e0c678..3af04ee0c335 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2371,6 +2371,49 @@ void 
VclMetafileProcessor2D::processStructureTagPrimitive2D(
 if (!rStructureTagCandidate.isBackground())
 {
 mpPDFExtOutDevData->BeginStructureElement(rTagElement);
+switch (rTagElement)
+{
+case vcl::PDFWriter::H1:
+case vcl::PDFWriter::H2:
+case vcl::PDFWriter::H3:
+case vcl::PDFWriter::H4:
+case vcl::PDFWriter::H5:
+case vcl::PDFWriter::H6:
+case vcl::PDFWriter::Paragraph:
+case vcl::PDFWriter::Heading:
+case vcl::PDFWriter::Caption:
+case vcl::PDFWriter::BlockQuote:
+case vcl::PDFWriter::Table:
+case vcl::PDFWriter::TableRow:
+case vcl::PDFWriter::Formula:
+case vcl::PDFWriter::Figure:
+
mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement,
+  
vcl::PDFWriter::Block);
+break;
+case vcl::PDFWriter::TableData:
+case vcl::PDFWriter::TableHeader:
+
mpPDFExtOutDevData->SetStructureAttribute(vcl::PDFWriter::Placement,
+  
vcl::PDFWriter::Inline);
+break;
+default:
+break;
+}
+switch (rTagElement)
+{
+case vcl::PDFWriter::Table:
+case vcl::PDFWriter::Formula:
+case vcl::PDFWriter::Figure:
+{
+auto const 
range(rStructureTagCandidate.getB2DRange(getViewInformation2D()));
+tools::Rectangle const aLogicRect(
+basegfx::fround(range.getMinX()), 
basegfx::fround(range.getMinY()),
+basegfx::fround(range.getMaxX()), 
basegfx::fround(range.getMaxY()));
+mpPDFExtOutDevData->SetStructureBoundingBox(aLogicRect);
+break;
+}
+default:
+break;
+}
 }
 // background object
 else


  1   2   3   4   5   6   7   >