[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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 include/drawinglayer

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

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

Turn around usage of TextHierarchyEditPrimitive2D

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

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

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

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

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

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

Prepare createAlphaMask to produce mask and alpha as needed

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

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

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

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

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

Improved code for PolygonStrokePrimitive2D::getB2DRange

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

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

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

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

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

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

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

Make impBufferDevice faster again

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

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

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

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

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

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

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

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

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

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

Rework of ShadowPrimitive2D

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

 c2d1458723c66c2fd717a112f89f773226adc841
 707b0c328a282d993fa33b618083d20b6c521de6

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

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

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

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

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

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

fix limiting drawing of softedge effect (tdf#141981)

Apparently an empty viewport actually means everything should be drawn.

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

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


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

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

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

tdf#128150 Implement/add SlideBackgroundFill visualization

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

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

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

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

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

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

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

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

elide temporary vector in TextDecoratedPortionPrimitive2D

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

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


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

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

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

we can std::move the data out of TextBreakupHelper

and save some copying

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

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

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

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

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

simplify and improve maybeInvert

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

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

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

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

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

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

rename Primitive2DDecompositionVisitor methods

from "append" to "visit"

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

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

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

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

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

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

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

recursive_mutex -> mutex in BasePrimitive2DImplBase

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

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

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

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

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

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

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

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

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

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

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

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

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

reduce copying in BufferedDecompositionPrimitive2D

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

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


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

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

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

reduce cost of BasePrimitive2D (tdf#125892)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

tdf#101083 speed up SVG rendering with pattern fill

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

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

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

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

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

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

loplugin:unusedmethods

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

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

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

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

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

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

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

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


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

2021-07-30 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx |2 
 drawinglayer/source/geometry/viewinformation2d.cxx   |  284 ---
 drawinglayer/source/primitive2d/Tools.cxx|6 
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |4 
 drawinglayer/source/processor2d/baseprocessor2d.cxx  |4 
 include/drawinglayer/geometry/viewinformation2d.hxx  |   38 -
 svx/source/sdr/contact/objectcontact.cxx |2 
 svx/source/sdr/overlay/overlaymanager.cxx|2 
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |3 
 9 files changed, 141 insertions(+), 204 deletions(-)

New commits:
commit d5765ae2f9236c8ce32d61f05f46d9d76b991544
Author: Tomaž Vajngerl 
AuthorDate: Fri Jul 23 16:31:02 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Jul 31 06:35:49 2021 +0200

drawinglayer: extract Prop. Value conversion from ViewInformation2D

ViewInformation2D doesn't need to know anything about the Sequence
of PropertyValue that is used for parameters when constructing it
through UNO API. This can be done outside of ViewInfromation2D and
it doesn't need to be responsible for that internally inside the
ViewInformation2D. With this we get ViewInformation2D, which is much
simpler and isn't prone to YAGNI.

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

diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx 
b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
index 63b4ffd6986d..98ca81433f12 100644
--- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
+++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx
@@ -117,7 +117,7 @@ namespace drawinglayer::unorenderer
 MaximumQuadraticPixels = 50;
 }
 
-const geometry::ViewInformation2D 
aViewInformation2D(aViewInformationSequence);
+const auto aViewInformation2D = 
geometry::createViewInformation2D(aViewInformationSequence);
 const sal_uInt32 
nDiscreteWidth(basegfx::fround(o3tl::convert(fWidth, eRangeUnit, 
o3tl::Length::in) * DPI_X));
 const sal_uInt32 
nDiscreteHeight(basegfx::fround(o3tl::convert(fHeight, eRangeUnit, 
o3tl::Length::in) * DPI_Y));
 
diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx 
b/drawinglayer/source/geometry/viewinformation2d.cxx
index 5b276cf52a59..94def8eda93c 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -84,162 +84,24 @@ protected:
 // Viewport, VisualizedPage or ViewTime
 uno::Sequence mxExtendedInformation;
 
-void impInterpretPropertyValues(const uno::Sequence& 
rViewParameters)
-{
-if (!rViewParameters.hasElements())
-return;
-
-const sal_Int32 nCount(rViewParameters.getLength());
-sal_Int32 nExtendedInsert(0);
-
-// prepare extended information for filtering. Maximum size is nCount
-mxExtendedInformation.realloc(nCount);
-
-for (sal_Int32 a(0); a < nCount; a++)
-{
-const beans::PropertyValue& rProp = rViewParameters[a];
-
-if (rProp.Name == g_PropertyName_ReducedDisplayQuality)
-{
-// extra information; add to filtered information
-mxExtendedInformation[nExtendedInsert++] = rProp;
-
-// for performance reasons, also cache content locally
-bool bSalBool(false);
-rProp.Value >>= bSalBool;
-mbReducedDisplayQuality = bSalBool;
-}
-else if (rProp.Name == g_PropertyName_ObjectTransformation)
-{
-css::geometry::AffineMatrix2D aAffineMatrix2D;
-rProp.Value >>= aAffineMatrix2D;
-
basegfx::unotools::homMatrixFromAffineMatrix(maObjectTransformation,
- aAffineMatrix2D);
-}
-else if (rProp.Name == g_PropertyName_ViewTransformation)
-{
-css::geometry::AffineMatrix2D aAffineMatrix2D;
-rProp.Value >>= aAffineMatrix2D;
-
basegfx::unotools::homMatrixFromAffineMatrix(maViewTransformation, 
aAffineMatrix2D);
-}
-else if (rProp.Name == g_PropertyName_Viewport)
-{
-css::geometry::RealRectangle2D aViewport;
-rProp.Value >>= aViewport;
-maViewport = 
basegfx::unotools::b2DRectangleFromRealRectangle2D(aViewport);
-}
-else if (rProp.Name == g_PropertyName_Time)
-{
-rProp.Value >>= mfViewTime;
-}
-else if 

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

2021-07-30 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/geometry/viewinformation2d.cxx   |   51 +--
 drawinglayer/source/processor2d/contourextractor2d.cxx   |3 
 drawinglayer/source/processor2d/hittestprocessor2d.cxx   |3 
 drawinglayer/source/processor2d/linegeometryextractor2d.cxx  |3 
 drawinglayer/source/processor2d/textaspolygonextractor2d.cxx |3 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |6 -
 drawinglayer/source/processor2d/vclprocessor2d.cxx   |6 -
 include/drawinglayer/geometry/viewinformation2d.hxx  |   13 --
 sc/source/ui/view/output.cxx |3 
 svx/source/dialog/pagectrl.cxx   |3 
 svx/source/dialog/weldeditview.cxx   |3 
 svx/source/sdr/contact/objectcontactofobjlistpainter.cxx |3 
 svx/source/sdr/contact/objectcontactofpageview.cxx   |3 
 svx/source/sdr/contact/viewobjectcontactofpageobj.cxx|3 
 svx/source/sdr/overlay/overlaymanager.cxx|3 
 sw/source/core/doc/notxtfrm.cxx  |3 
 sw/source/core/layout/paintfrm.cxx   |6 -
 17 files changed, 25 insertions(+), 93 deletions(-)

New commits:
commit 13efd364c046b8064f03cb23bb232f42a892d601
Author: Tomaž Vajngerl 
AuthorDate: Thu Jul 22 18:06:30 2021 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Jul 31 06:23:54 2021 +0200

drawinglayer: remove extendedInformation from ViewInformation2D

We actually never use extended information when normally using
the ViewInformation2D. The exception here is when we construct it
from property values, where the unknown property values are then
stored into the extended information sequence and then later
reconstructed when we convert it back to a sequence of property
values. Just for that case we don't neeed to expose the extended
information to the outside and create it, as that is then a
implementation detail for the UNO use case.

I am also not convinced we need it when creating ViewInformation2D
with the sequence of property values - it certantly not expected
that we need to preserve the property values at all, but that is
something that needs to be checked.

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

diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx 
b/drawinglayer/source/geometry/viewinformation2d.cxx
index 5067a33f2f75..5b276cf52a59 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -221,51 +221,25 @@ public:
 ImpViewInformation2D(const basegfx::B2DHomMatrix& rObjectTransformation,
  const basegfx::B2DHomMatrix& rViewTransformation,
  const basegfx::B2DRange& rViewport,
- const uno::Reference& rxDrawPage, 
double fViewTime,
- const uno::Sequence& 
rExtendedParameters)
+ const uno::Reference& rxDrawPage, 
double fViewTime)
 : maObjectTransformation(rObjectTransformation)
 , maViewTransformation(rViewTransformation)
-, maObjectToViewTransformation()
-, maInverseObjectToViewTransformation()
 , maViewport(rViewport)
-, maDiscreteViewport()
 , mxVisualizedPage(rxDrawPage)
 , mfViewTime(fViewTime)
 , mbReducedDisplayQuality(false)
-, mxViewInformation()
-, mxExtendedInformation()
 {
-impInterpretPropertyValues(rExtendedParameters);
 }
 
 explicit ImpViewInformation2D(const uno::Sequence& 
rViewParameters)
-: maObjectTransformation()
-, maViewTransformation()
-, maObjectToViewTransformation()
-, maInverseObjectToViewTransformation()
-, maViewport()
-, maDiscreteViewport()
-, mxVisualizedPage()
-, mfViewTime()
-, mbReducedDisplayQuality(false)
+: mbReducedDisplayQuality(false)
 , mxViewInformation(rViewParameters)
-, mxExtendedInformation()
 {
 impInterpretPropertyValues(rViewParameters);
 }
 
 ImpViewInformation2D()
-: maObjectTransformation()
-, maViewTransformation()
-, maObjectToViewTransformation()
-, maInverseObjectToViewTransformation()
-, maViewport()
-, maDiscreteViewport()
-, mxVisualizedPage()
-, mfViewTime()
-, mbReducedDisplayQuality(false)
-, mxViewInformation()
-, mxExtendedInformation()
+: mbReducedDisplayQuality(false)
 {
 }
 
@@ -330,19 +304,13 @@ public:
 return mxViewInformation;
 }
 
-const uno::Sequence& 
getExtendedInformationSequence() const
-{
-return mxExtendedInformation;
-}

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

2021-06-20 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx|   16 +++-
 drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/bitmapprimitive2d.cxx  |2 
 drawinglayer/source/primitive2d/borderlineprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/controlprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/cropprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/epsprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/glowprimitive2d.cxx|2 
 drawinglayer/source/primitive2d/graphicprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/gridprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/groupprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/helplineprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/invertprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/maskprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/mediaprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/modifiedcolorprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/objectinfoprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/pagehierarchyprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/patternfillprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/pointarrayprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx |   39 
++
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/softedgeprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx |   20 -
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/texteffectprimitive2d.cxx  |5 +
 drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx   |   32 
++--
 drawinglayer/source/primitive2d/textlineprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/textprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/textstrikeoutprimitive2d.cxx   |   12 ++-
 drawinglayer/source/primitive2d/transformprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/transparenceprimitive2d.cxx|5 +
 drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx |5 +
 drawinglayer/source/primitive2d/wallpaperprimitive2d.cxx   |5 +
 drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx  |5 +
 include/drawinglayer/primitive2d/baseprimitive2d.hxx   |9 --
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx   |6 +
 svx/source/sdr/overlay/overlaytools.cxx|   30 
++-
 svx/source/sdr/primitive2d/sdrcaptionprimitive2d.cxx   |5 +
 svx/source/sdr/primitive2d/sdrconnectorprimitive2d.cxx |5 +
 svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx   |5 +
 svx/source/sdr/primitive2d/sdrellipseprimitive2d.cxx   |   10 ++
 svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx   |5 +
 svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx  |5 +
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx   |5 +
 svx/source/sdr/primitive2d/sdrole2primitive2d.cxx  |5 +
 svx/source/sdr/primitive2d/sdrolecontentprimitive2d.cxx|5 +
 svx/source/sdr/primitive2d/sdrpathprimitive2d.cxx  |5 +
 svx/source/sdr/primitive2d/sdrrectangleprimitive2d.cxx |5 +
 svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx  |   32 
++--
 svx/source/table/viewcontactoftableobj.cxx |5 +
 sw/source/core/draw/dflyobj.cxx|5 +
 

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

2021-01-30 Thread Noel Grandin (via logerrit)
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |6 --
 include/drawinglayer/primitive2d/baseprimitive2d.hxx |9 -
 2 files changed, 4 insertions(+), 11 deletions(-)

New commits:
commit d77a644a1a4af8b2c7eb3b524ba6ac24d58b67fb
Author: Noel Grandin 
AuthorDate: Sat Jan 30 13:23:15 2021 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 30 17:30:36 2021 +0100

this method should be pure virtual

otherwise there is no point in subclassing this helper class

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

diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index a3650a57807d..752bc3063a3b 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -104,12 +104,6 @@ sal_Int64 SAL_CALL BasePrimitive2D::estimateUsage()
 return 0; // for now ignore the objects themselves
 }
 
-void BufferedDecompositionPrimitive2D::create2DDecomposition(
-Primitive2DContainer& /*rContainer*/,
-const geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-}
-
 BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D()
 : BasePrimitive2D()
 , maBuffered2DDecomposition()
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx 
b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index 45d0e3519c40..7619e04e5279 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -218,11 +218,10 @@ protected:
 maBuffered2DDecomposition = rNew;
 }
 
-/** method which is to be used to implement the local decomposition of a 
2D primitive. The default
-implementation will just return an empty decomposition
- */
-virtual void create2DDecomposition(Primitive2DContainer& rContainer,
-   const geometry::ViewInformation2D& 
rViewInformation) const;
+/** method which is to be used to implement the local decomposition of a 
2D primitive. */
+virtual void
+create2DDecomposition(Primitive2DContainer& rContainer,
+  const geometry::ViewInformation2D& rViewInformation) 
const = 0;
 
 public:
 // constructor/destructor
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-12-01 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/primitive3d/textureprimitive3d.cxx   |2 +-
 include/drawinglayer/attribute/fillgradientattribute.hxx |2 +-
 svx/source/sdr/primitive2d/sdrattributecreator.cxx   |3 +--
 svx/source/xoutdev/xtabgrdt.cxx  |4 +---
 sw/source/uibase/docvw/HeaderFooterWin.cxx   |2 +-
 sw/source/uibase/docvw/ShadowOverlayObject.cxx   |9 +++--
 6 files changed, 8 insertions(+), 14 deletions(-)

New commits:
commit 8601eca3c8573b433933ab59180624d798c6189e
Author: Luboš Luňák 
AuthorDate: Tue Dec 1 12:39:39 2020 +0100
Commit: Luboš Luňák 
CommitDate: Tue Dec 1 16:28:59 2020 +0100

do not unnecessarily explicitly force gradient step count (tdf#138581)

Toolkits usually do not provide the ability to specify gradient steps,
which means VCL falls back to its algorithm, which at least with Skia
sometimes causes poor results.

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

diff --git a/drawinglayer/source/primitive3d/textureprimitive3d.cxx 
b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
index a053a7c214d0..7c9226bf40de 100644
--- a/drawinglayer/source/primitive3d/textureprimitive3d.cxx
+++ b/drawinglayer/source/primitive3d/textureprimitive3d.cxx
@@ -91,7 +91,7 @@ namespace drawinglayer::primitive3d
 {
 // create TransparenceTexturePrimitive3D with fixed 
transparence as replacement
 const basegfx::BColor aGray(getTransparence(), 
getTransparence(), getTransparence());
-const attribute::FillGradientAttribute 
aFillGradient(attribute::GradientStyle::Linear, 0.0, 0.0, 0.0, 0.0, aGray, 
aGray, 1);
+const attribute::FillGradientAttribute 
aFillGradient(attribute::GradientStyle::Linear, 0.0, 0.0, 0.0, 0.0, aGray, 
aGray);
 const Primitive3DReference xRef(new 
TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize()));
 return { xRef };
 }
diff --git a/include/drawinglayer/attribute/fillgradientattribute.hxx 
b/include/drawinglayer/attribute/fillgradientattribute.hxx
index f9d9e2245d9a..50a87a685f1a 100644
--- a/include/drawinglayer/attribute/fillgradientattribute.hxx
+++ b/include/drawinglayer/attribute/fillgradientattribute.hxx
@@ -53,7 +53,7 @@ public:
 /// constructors/assignmentoperator/destructor
 FillGradientAttribute(GradientStyle eStyle, double fBorder, double 
fOffsetX, double fOffsetY,
   double fAngle, const basegfx::BColor& rStartColor,
-  const basegfx::BColor& rEndColor, sal_uInt16 nSteps);
+  const basegfx::BColor& rEndColor, sal_uInt16 nSteps 
= 0);
 FillGradientAttribute();
 FillGradientAttribute(const FillGradientAttribute&);
 FillGradientAttribute(FillGradientAttribute&&);
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx 
b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index d5baa905e0a8..5ee93efef85f 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -644,8 +644,7 @@ namespace drawinglayer::primitive2d
 static_cast(rGradient.GetYOffset()) * 0.01,
 static_cast(rGradient.GetAngle().get()) * 
F_PI1800,
 basegfx::BColor(fStartLum, fStartLum, fStartLum),
-basegfx::BColor(fEndLum, fEndLum, fEndLum),
-0);
+basegfx::BColor(fEndLum, fEndLum, fEndLum));
 }
 }
 
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index fbb69a0ddd77..23bfc8313cb9 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -153,7 +153,6 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, 
const Size& rSize ) co
 }
 }
 
-const sal_uInt16 nSteps((rSize.Width() + rSize.Height()) / 3);
 const drawinglayer::attribute::FillGradientAttribute aFillGradient(
 aGradientStyle,
 static_cast(rGradient.GetBorder()) * 0.01,
@@ -161,8 +160,7 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, 
const Size& rSize ) co
 static_cast(rGradient.GetYOffset()) * 0.01,
 static_cast(rGradient.GetAngle().get()) * F_PI1800,
 aStart,
-aEnd,
-nSteps);
+aEnd);
 
 const drawinglayer::primitive2d::Primitive2DReference 
aGradientPrimitive(
 new drawinglayer::primitive2d::PolyPolygonGradientPrimitive2D(
diff --git a/sw/source/uibase/docvw/HeaderFooterWin.cxx 
b/sw/source/uibase/docvw/HeaderFooterWin.cxx
index 2f08f0a5a7c3..7305a440d29a 100644
--- a/sw/source/uibase/docvw/HeaderFooterWin.cxx
+++ 

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

2020-11-22 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/primitive2d/textlayoutdevice.cxx  |  746 --
 include/drawinglayer/primitive2d/textlayoutdevice.hxx |  166 +---
 solenv/clang-format/excludelist   |2 
 3 files changed, 423 insertions(+), 491 deletions(-)

New commits:
commit 9f7999c6281293d01f143e899056d72496868345
Author: Tomaž Vajngerl 
AuthorDate: Sun Oct 18 21:55:51 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Nov 23 08:30:16 2020 +0100

remove textlayoutdevice.{hxx,cxx} from clang-format excludelist

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

diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx 
b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 43afce5d0f1e..c842517b3e72 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -36,473 +36,423 @@
 #include 
 #include 
 
-
 // VDev RevDevice provider
 
 namespace
 {
-class ImpTimedRefDev;
+class ImpTimedRefDev;
 
-//the scoped_timed_RefDev owns an ImpTimeRefDev and releases it on dtor
-//or disposing of the default XComponentContext which causes the underlying
-//OutputDevice to get released
+//the scoped_timed_RefDev owns an ImpTimeRefDev and releases it on dtor
+//or disposing of the default XComponentContext which causes the underlying
+//OutputDevice to get released
 
-//The ImpTimerRefDev itself, if the timeout ever gets hit, will call
-//reset on the scoped_timed_RefDev to release the ImpTimerRefDev early
-//if it's unused for a few minutes
-class scoped_timed_RefDev : public 
comphelper::unique_disposing_ptr
+//The ImpTimerRefDev itself, if the timeout ever gets hit, will call
+//reset on the scoped_timed_RefDev to release the ImpTimerRefDev early
+//if it's unused for a few minutes
+class scoped_timed_RefDev : public 
comphelper::unique_disposing_ptr
+{
+public:
+scoped_timed_RefDev()
+: comphelper::unique_disposing_ptr(
+  (css::uno::Reference(
+  ::comphelper::getProcessComponentContext(), 
css::uno::UNO_QUERY_THROW)))
 {
-public:
-scoped_timed_RefDev() : 
comphelper::unique_disposing_ptr((css::uno::Reference(::comphelper::getProcessComponentContext(),
 css::uno::UNO_QUERY_THROW)))
-{
-}
-};
+}
+};
 
-class the_scoped_timed_RefDev : public rtl::Static {};
+class the_scoped_timed_RefDev : public rtl::Static
+{
+};
 
-class ImpTimedRefDev : public Timer
-{
-scoped_timed_RefDev&mrOwnerOfMe;
-VclPtr   mpVirDev;
-sal_uInt32  mnUseCount;
-
-public:
-explicit ImpTimedRefDev(scoped_timed_RefDev& rOwnerofMe);
-virtual ~ImpTimedRefDev() override;
-virtual void Invoke() override;
-
-VirtualDevice& acquireVirtualDevice();
-void releaseVirtualDevice();
-};
-
-ImpTimedRefDev::ImpTimedRefDev(scoped_timed_RefDev& rOwnerOfMe)
-:   Timer( "drawinglayer ImpTimedRefDev destroy mpVirDev" ),
-mrOwnerOfMe(rOwnerOfMe),
-mpVirDev(nullptr),
-mnUseCount(0)
-{
-SetTimeout(3L * 60L * 1000L); // three minutes
-Start();
-}
+class ImpTimedRefDev : public Timer
+{
+scoped_timed_RefDev& mrOwnerOfMe;
+VclPtr mpVirDev;
+sal_uInt32 mnUseCount;
+
+public:
+explicit ImpTimedRefDev(scoped_timed_RefDev& rOwnerofMe);
+virtual ~ImpTimedRefDev() override;
+virtual void Invoke() override;
+
+VirtualDevice& acquireVirtualDevice();
+void releaseVirtualDevice();
+};
+
+ImpTimedRefDev::ImpTimedRefDev(scoped_timed_RefDev& rOwnerOfMe)
+: Timer("drawinglayer ImpTimedRefDev destroy mpVirDev")
+, mrOwnerOfMe(rOwnerOfMe)
+, mpVirDev(nullptr)
+, mnUseCount(0)
+{
+SetTimeout(3L * 60L * 1000L); // three minutes
+Start();
+}
 
-ImpTimedRefDev::~ImpTimedRefDev()
-{
-OSL_ENSURE(0 == mnUseCount, "destruction of a still used 
ImpTimedRefDev (!)");
-const SolarMutexGuard aSolarGuard;
-mpVirDev.disposeAndClear();
-}
+ImpTimedRefDev::~ImpTimedRefDev()
+{
+OSL_ENSURE(0 == mnUseCount, "destruction of a still used ImpTimedRefDev 
(!)");
+const SolarMutexGuard aSolarGuard;
+mpVirDev.disposeAndClear();
+}
+
+void ImpTimedRefDev::Invoke()
+{
+// for obvious reasons, do not call anything after this
+mrOwnerOfMe.reset();
+}
 
-void ImpTimedRefDev::Invoke()
+VirtualDevice& ImpTimedRefDev::acquireVirtualDevice()
+{
+if (!mpVirDev)
 {
-// for obvious reasons, do not call anything after this
-mrOwnerOfMe.reset();
+mpVirDev = VclPtr::Create();
+mpVirDev->SetReferenceDevice(VirtualDevice::RefDevMode::MSO1);
 }
 
-VirtualDevice& ImpTimedRefDev::acquireVirtualDevice()
+if (!mnUseCount)
 {
-

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

2020-08-25 Thread Caolán McNamara (via logerrit)
 drawinglayer/source/primitive2d/textlayoutdevice.cxx  |   25 ++
 include/drawinglayer/primitive2d/textlayoutdevice.hxx |5 +++
 2 files changed, 30 insertions(+)

New commits:
commit 752dd8f5299cc2d661becd3b694ede1d037d3b84
Author: Caolán McNamara 
AuthorDate: Mon Aug 24 15:35:00 2020 +0100
Commit: Caolán McNamara 
CommitDate: Tue Aug 25 10:07:11 2020 +0200

add a getCaretPositions like getTextArray

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

diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx 
b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index fe541c04a9b3..b8ac0bf73c85 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -357,6 +357,31 @@ namespace drawinglayer::primitive2d
 return aRetval;
 }
 
+std::vector< double > TextLayouterDevice::getCaretPositions(
+const OUString& rText,
+sal_uInt32 nIndex,
+sal_uInt32 nLength) const
+{
+std::vector< double > aRetval;
+sal_uInt32 nTextLength(nLength);
+const sal_uInt32 nStringLength(rText.getLength());
+
+if(nTextLength + nIndex > nStringLength)
+{
+nTextLength = nStringLength - nIndex;
+}
+
+if(nTextLength)
+{
+aRetval.reserve(2 * nTextLength);
+std::vector aArray(2 * nTextLength);
+mrDevice.GetCaretPositions(rText, aArray.data(), nIndex, 
nLength);
+aRetval.assign(aArray.begin(), aArray.end());
+}
+
+return aRetval;
+}
+
 
 // helper methods for vcl font handling
 
diff --git a/include/drawinglayer/primitive2d/textlayoutdevice.hxx 
b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
index 597e1b34de09..10f0fc0b23c1 100644
--- a/include/drawinglayer/primitive2d/textlayoutdevice.hxx
+++ b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
@@ -105,6 +105,11 @@ namespace drawinglayer::primitive2d
 const OUString& rText,
 sal_uInt32 nIndex,
 sal_uInt32 nLength) const;
+
+::std::vector< double > getCaretPositions(
+const OUString& rText,
+sal_uInt32 nIndex,
+sal_uInt32 nLength) const;
 };
 
 // helper methods for vcl font handling
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-06-04 Thread A_GAN (via logerrit)
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx|   10 --
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx |1 +
 drawinglayer/source/processor3d/shadow3dextractor.cxx|1 +
 include/drawinglayer/primitive2d/shadowprimitive2d.hxx   |   10 --
 oox/source/drawingml/effectproperties.cxx|3 ++-
 sd/qa/unit/import-tests.cxx  |2 +-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |1 +
 7 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit b90d0a9dc8e7b4e6a683b35939a7ce0c3090e888
Author: A_GAN 
AuthorDate: Wed Jun 3 05:55:46 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Jun 4 18:43:51 2020 +0200

Update ShadowPrimitive2D to support shadow blur

Add attribute for the blur radius and get function.
give more range for the shadow depends on the size of the blur radius.
update the blur radius to be imported in Hmm and the test function.

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

diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
index 8cb8311494a5..e2c0be36ec9e 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -23,6 +23,8 @@
 #include 
 #include 
 
+#include 
+#include 
 
 using namespace com::sun::star;
 
@@ -32,10 +34,12 @@ namespace drawinglayer::primitive2d
 ShadowPrimitive2D::ShadowPrimitive2D(
 const basegfx::B2DHomMatrix& rShadowTransform,
 const basegfx::BColor& rShadowColor,
+double fShadowBlur,
 const Primitive2DContainer& rChildren)
 :   GroupPrimitive2D(rChildren),
 maShadowTransform(rShadowTransform),
-maShadowColor(rShadowColor)
+maShadowColor(rShadowColor),
+mfShadowBlur(fShadowBlur)
 {
 }
 
@@ -46,7 +50,8 @@ namespace drawinglayer::primitive2d
 const ShadowPrimitive2D& rCompare = static_cast< const 
ShadowPrimitive2D& >(rPrimitive);
 
 return (getShadowTransform() == rCompare.getShadowTransform()
-&& getShadowColor() == rCompare.getShadowColor());
+&& getShadowColor() == rCompare.getShadowColor()
+&& getShadowBlur() == rCompare.getShadowBlur());
 }
 
 return false;
@@ -55,6 +60,7 @@ namespace drawinglayer::primitive2d
 basegfx::B2DRange ShadowPrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewInformation) const
 {
 basegfx::B2DRange 
aRetval(getChildren().getB2DRange(rViewInformation));
+aRetval.grow(getShadowBlur());
 aRetval.transform(getShadowTransform());
 return aRetval;
 }
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index 28e9eccdacc5..afc841fcf3bd 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -235,6 +235,7 @@ namespace drawinglayer::primitive2d
 aShadow = new ShadowPrimitive2D(
 aShadowTransform,
 aShadowColor,
+0,  // fShadowBlur = 0, there's no blur 
for text shadow yet.
 aRetval);
 }
 
diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx 
b/drawinglayer/source/processor3d/shadow3dextractor.cxx
index 45fca6d8dd38..0b653236eb1b 100644
--- a/drawinglayer/source/processor3d/shadow3dextractor.cxx
+++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx
@@ -74,6 +74,7 @@ namespace drawinglayer::processor3d
 primitive2d::BasePrimitive2D* pNew = new 
primitive2d::ShadowPrimitive2D(
 rPrimitive.getShadowTransform(),
 rPrimitive.getShadowColor(),
+0,  // shadow3d doesn't have 
rPrimitive.getShadowBlur() yet.
 aNewSubList);
 
 
if(basegfx::fTools::more(rPrimitive.getShadowTransparence(), 0.0))
diff --git a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx 
b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
index 4bff4c7aa89c..f384049862a9 100644
--- a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 
 namespace drawinglayer::primitive2d
@@ -51,17 +52,22 @@ namespace drawinglayer::primitive2d
 /// the shadow color to which all geometry is to be forced

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

2020-05-29 Thread A_GAN (via logerrit)
 drawinglayer/source/attribute/sdrshadowattribute.cxx  |   14 +-
 include/drawinglayer/attribute/sdrshadowattribute.hxx |2 ++
 include/editeng/unoprnms.hxx  |1 +
 include/svx/svddef.hxx|3 ++-
 include/svx/unoshprp.hxx  |4 +++-
 svx/source/sdr/primitive2d/sdrattributecreator.cxx|4 +++-
 svx/source/svdraw/svdattr.cxx |1 +
 7 files changed, 25 insertions(+), 4 deletions(-)

New commits:
commit 4c48de44ad933ef6dd19777b3ebf1a51db5e14e3
Author: A_GAN 
AuthorDate: Sun May 17 00:51:09 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri May 29 09:09:58 2020 +0200

Add blur attributies and definitons into shadow classes and  properities

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

diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx 
b/drawinglayer/source/attribute/sdrshadowattribute.cxx
index 01ff66162ea5..9e379acaae28 100644
--- a/drawinglayer/source/attribute/sdrshadowattribute.cxx
+++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx
@@ -32,16 +32,19 @@ namespace drawinglayer::attribute
 basegfx::B2DVector  maOffset;   // 
shadow offset 1/100th mm
 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
 basegfx::BColor maColor;// 
color of shadow
 
 ImpSdrShadowAttribute(
 const basegfx::B2DVector& rOffset,
 const basegfx::B2DVector& rSize,
 double fTransparence,
+sal_Int32 nBlur,
 const basegfx::BColor& rColor)
 :   maOffset(rOffset),
 maSize(rSize),
 mfTransparence(fTransparence),
+mnBlur(nBlur),
 maColor(rColor)
 {
 }
@@ -50,6 +53,7 @@ namespace drawinglayer::attribute
 :   maOffset(basegfx::B2DVector()),
 maSize(basegfx::B2DVector()),
 mfTransparence(0.0),
+mnBlur(0),
 maColor(basegfx::BColor())
 {
 }
@@ -58,6 +62,7 @@ namespace drawinglayer::attribute
 const basegfx::B2DVector& getOffset() const { return maOffset; }
 const basegfx::B2DVector& getSize() const { return maSize; }
 double getTransparence() const { return mfTransparence; }
+sal_Int32 getBlur() const { return mnBlur; }
 const basegfx::BColor& getColor() const { return maColor; }
 
 bool operator==(const ImpSdrShadowAttribute& rCandidate) const
@@ -65,6 +70,7 @@ namespace drawinglayer::attribute
 return (getOffset() == rCandidate.getOffset()
 && getSize() == rCandidate.getSize()
 && getTransparence() == rCandidate.getTransparence()
+&& getBlur() == rCandidate.getBlur()
 && getColor() == rCandidate.getColor());
 }
 };
@@ -80,9 +86,10 @@ namespace drawinglayer::attribute
 const basegfx::B2DVector& rOffset,
 const basegfx::B2DVector& rSize,
 double fTransparence,
+sal_Int32 nBlur,
 const basegfx::BColor& rColor)
 :   mpSdrShadowAttribute(ImpSdrShadowAttribute(
-rOffset, rSize, fTransparence, rColor))
+rOffset, rSize, fTransparence,nBlur, rColor))
 {
 }
 
@@ -130,6 +137,11 @@ namespace drawinglayer::attribute
 return mpSdrShadowAttribute->getTransparence();
 }
 
+sal_Int32 SdrShadowAttribute::getBlur() const
+{
+return mpSdrShadowAttribute->getBlur();
+}
+
 const basegfx::BColor& SdrShadowAttribute::getColor() const
 {
 return mpSdrShadowAttribute->getColor();
diff --git a/include/drawinglayer/attribute/sdrshadowattribute.hxx 
b/include/drawinglayer/attribute/sdrshadowattribute.hxx
index fc797dc9d0a0..789edd459706 100644
--- a/include/drawinglayer/attribute/sdrshadowattribute.hxx
+++ b/include/drawinglayer/attribute/sdrshadowattribute.hxx
@@ -54,6 +54,7 @@ namespace drawinglayer
 const basegfx::B2DVector& rOffset,
 const basegfx::B2DVector& rSize,
 double fTransparence,
+sal_Int32 nBlur,
 const basegfx::BColor& rColor);
 SdrShadowAttribute();
 SdrShadowAttribute(const SdrShadowAttribute&);
@@ -72,6 +73,7 @@ namespace 

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

2020-05-28 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/primitive2d/glowprimitive2d.cxx |   16 
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   15 +++
 include/drawinglayer/primitive2d/glowprimitive2d.hxx|5 -
 3 files changed, 7 insertions(+), 29 deletions(-)

New commits:
commit c9f4952b98da9adad1b556414c5fcecafedca473
Author: Mike Kaganski 
AuthorDate: Thu May 28 17:51:15 2020 +0300
Commit: Mike Kaganski 
CommitDate: Fri May 29 06:25:48 2020 +0200

tdf#101181: use buffer device with alpha in glow effect

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

diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx 
b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index bf49b8e215b5..fb6a599ab4e2 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -60,22 +60,6 @@ GlowPrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewInformation
 return aRetval;
 }
 
-void GlowPrimitive2D::get2DDecomposition(
-Primitive2DDecompositionVisitor& rVisitor,
-const geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-if (getChildren().empty())
-return;
-
-// create a modifiedColorPrimitive containing the *black* color and the 
content. Using black
-// on white allows creating useful mask in 
VclPixelProcessor2D::processGlowPrimitive2D.
-basegfx::BColorModifierSharedPtr aBColorModifier
-= std::make_shared(basegfx::BColor());
-
-const Primitive2DReference xRef(new 
ModifiedColorPrimitive2D(getChildren(), aBColorModifier));
-rVisitor.append(xRef);
-}
-
 // provide unique ID
 ImplPrimitive2DIDBlock(GlowPrimitive2D, PRIMITIVE2D_ID_GLOWPRIMITIVE2D)
 
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 3c1a1087adcf..d4ee5f39b7a0 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -983,30 +983,29 @@ void VclPixelProcessor2D::processGlowPrimitive2D(const 
primitive2d::GlowPrimitiv
 // Consider glow transparency (initial transparency near the object edge)
 const sal_uInt8 nTransparency = 
rCandidate.getGlowColor().GetTransparency();
 
-impBufferDevice aBufferDevice(*mpOutputDevice, aRange);
+impBufferDevice aBufferDevice(*mpOutputDevice, aRange, true);
 if (aBufferDevice.isVisible())
 {
 // remember last OutDev and set to content
 OutputDevice* pLastOutputDevice = mpOutputDevice;
 mpOutputDevice = ();
-// Processing will draw whatever geometry on white background, 
applying *black*
-// replacement color. The black color replacement is added in 2d 
decomposition of
-// glow primitive.
 mpOutputDevice->Erase();
 process(rCandidate);
 const tools::Rectangle 
aRect(static_cast(std::floor(aRange.getMinX())),
  
static_cast(std::floor(aRange.getMinY())),
  
static_cast(std::ceil(aRange.getMaxX())),
  
static_cast(std::ceil(aRange.getMaxY(;
-Bitmap bitmap = mpOutputDevice->GetBitmap(aRect.TopLeft(), 
aRect.GetSize());
+BitmapEx bmpEx = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), 
aRect.GetSize());
 
-AlphaMask mask = ProcessAndBlurAlphaMask(bitmap, fBlurRadius, 
fBlurRadius, nTransparency);
+AlphaMask mask
+= ProcessAndBlurAlphaMask(bmpEx.GetAlpha(), fBlurRadius, 
fBlurRadius, nTransparency);
 
 // The end result is the bitmap filled with glow color and blurred 
8-bit alpha mask
 const basegfx::BColor aGlowColor(
 
maBColorModifierStack.getModifiedColor(rCandidate.getGlowColor().getBColor()));
-bitmap.Erase(Color(aGlowColor));
-BitmapEx result(bitmap, mask);
+Bitmap bmp = bmpEx.GetBitmap();
+bmp.Erase(Color(aGlowColor));
+BitmapEx result(bmp, mask);
 
 // back to old OutDev
 mpOutputDevice = pLastOutputDevice;
diff --git a/include/drawinglayer/primitive2d/glowprimitive2d.hxx 
b/include/drawinglayer/primitive2d/glowprimitive2d.hxx
index 5c3029882de2..62a585276b85 100644
--- a/include/drawinglayer/primitive2d/glowprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/glowprimitive2d.hxx
@@ -52,11 +52,6 @@ public:
 virtual basegfx::B2DRange
 getB2DRange(const geometry::ViewInformation2D& rViewInformation) const 
override;
 
-///  create decomposition
-virtual void
-get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
-   const geometry::ViewInformation2D& rViewInformation) 
const override;
-
 /// provide unique ID
 virtual sal_uInt32 getPrimitive2DID() 

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

2020-05-26 Thread Luboš Luňák (via logerrit)
 drawinglayer/source/primitive2d/borderlineprimitive2d.cxx  |   15 --
 include/drawinglayer/primitive2d/borderlineprimitive2d.hxx |   12 -
 svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx   |   80 ++---
 3 files changed, 52 insertions(+), 55 deletions(-)

New commits:
commit ef4964a4e598c3c9714cdc18ffa40bcb120dbef6
Author: Luboš Luňák 
AuthorDate: Tue May 26 12:29:37 2020 +0200
Commit: Luboš Luňák 
CommitDate: Tue May 26 15:55:53 2020 +0200

reduce dynamic_cast usage in an O(N^2) algorithm

When scrolling down in tdf#130431 this is the major CPU cost.
Move the dynamic_cast out of the loops as much as possible.

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

diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx 
b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index a5c2a51bc44e..b264e2c028af 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -305,18 +305,11 @@ namespace drawinglayer::primitive2d
 ImplPrimitive2DIDBlock(BorderLinePrimitive2D, 
PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D)
 
 Primitive2DReference tryMergeBorderLinePrimitive2D(
-const Primitive2DReference& rCandidateA,
-const Primitive2DReference& rCandidateB)
+const BorderLinePrimitive2D* pCandidateA,
+const BorderLinePrimitive2D* pCandidateB)
 {
-// try to cast to BorderLinePrimitive2D
-const primitive2d::BorderLinePrimitive2D* pCandidateA = 
dynamic_cast< const primitive2d::BorderLinePrimitive2D* >(rCandidateA.get());
-const primitive2d::BorderLinePrimitive2D* pCandidateB = 
dynamic_cast< const primitive2d::BorderLinePrimitive2D* >(rCandidateB.get());
-
-// we need a comparable BorderLinePrimitive2D
-if(nullptr == pCandidateA || nullptr == pCandidateB)
-{
-return Primitive2DReference();
-}
+assert(pCandidateA);
+assert(pCandidateB);
 
 // start of candidate has to match end of this
 if(!pCandidateA->getEnd().equal(pCandidateB->getStart()))
diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx 
b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
index 1a3bfa2b1b9b..537f503e5b9b 100644
--- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx
@@ -81,12 +81,6 @@ public:
 bool operator==(const BorderLine& rBorderLine) const;
 };
 
-/// helper to try to merge two instances of BorderLinePrimitive2D. If it was 
possible,
-/// a merged version is in the returned Primitive2DReference. Lots of 
preconditions
-/// have to be met to allow that, see implementation (and maybe even expand)
-Primitive2DReference DRAWINGLAYER_DLLPUBLIC tryMergeBorderLinePrimitive2D(
-const Primitive2DReference& rCandidateA, const Primitive2DReference& 
rCandidateB);
-
 /** BorderLinePrimitive2D class
 
 This is the basic primitive to build frames around objects, e.g. tables.
@@ -141,6 +135,12 @@ public:
 virtual sal_uInt32 getPrimitive2DID() const override;
 };
 
+/// helper to try to merge two instances of BorderLinePrimitive2D. If it was 
possible,
+/// a merged version is in the returned Primitive2DReference. Lots of 
preconditions
+/// have to be met to allow that, see implementation (and maybe even expand)
+Primitive2DReference DRAWINGLAYER_DLLPUBLIC tryMergeBorderLinePrimitive2D(
+const BorderLinePrimitive2D* pCandidateA, const BorderLinePrimitive2D* 
pCandidateB);
+
 } // end of namespace drawinglayer::primitive2d
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx 
b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
index 3c131948579b..9799417209f8 100644
--- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
@@ -797,51 +797,55 @@ namespace drawinglayer::primitive2d
 
 for(const auto& aCandidatePartial : aPartial)
 {
-if(aRetval.empty())
-{
-// no local data yet, just add as 1st entry, done
-aRetval.append(aCandidatePartial);
-}
-else
-{
-bool bDidMerge(false);
+bool bDidMerge(false);
 
+// This algorithm is O(N^2) and repeated dynamic_cast 
inside would be quite costly.
+// So check first and skip if the primitives aren't 
BorderLinePrimitive2D.
+const 

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

2020-05-07 Thread Mike Kaganski (via logerrit)
 drawinglayer/source/attribute/sdrglowattribute.cxx  |   27 -
 drawinglayer/source/primitive2d/glowprimitive2d.cxx |   24 ++--
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |   80 +++-
 include/drawinglayer/attribute/sdrglowattribute.hxx |   15 +--
 include/drawinglayer/primitive2d/glowprimitive2d.hxx|   16 +--
 include/vcl/BitmapFilterStackBlur.hxx   |3 
 svx/source/sdr/primitive2d/sdrattributecreator.cxx  |7 +
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx|5 -
 vcl/qa/cppunit/BitmapFilterTest.cxx |6 -
 vcl/source/bitmap/BitmapFilterStackBlur.cxx |   46 -
 10 files changed, 94 insertions(+), 135 deletions(-)

New commits:
commit 08ebcff89f56bec3b0f9b346504748e4eb1687af
Author: Mike Kaganski 
AuthorDate: Fri May 1 01:05:24 2020 +0300
Commit: Mike Kaganski 
CommitDate: Thu May 7 21:57:37 2020 +0200

tdf#101181: improve glow effect

The shadow of objects must not be scaled: this displaces any internal
areas that need blur, e.g. holes. Instead, it needs to dilate the
shadow using kernel with radius equal to blur radius: this allows the
borders of dilated objects to be in the middle of the blur area. The
following blur makes those new margin points to have 50% intensity,
and full glow intensity at the point of old object margins. This also
removed artifacts when moving objects with glow effect caused by
mismatch between scaling and D2D range calculation.

The D2D range therefore is not calculated by scaling, but using grow.
Blur filter's "extend bitmap by blur radius" option got obsoleted and
removed.

There's no need to blur the glow color (24-bit RGB). Instead, glow
bitmap must be filled by glow color, and have an alpha mask that is
blurred accordingly. This makes the glow properly transparent, and
also reduces the blur complexity which now only needs to process 8
bits of alpha channel.

The object shadow is created using basegfx::BColorModifier_replace
inserted into the 2d decomposition of the effect, as before. To make
sure that any non-fully-transparent pixel will become black pixel in
the shadow, black color is used, and the result is further processed
in VclPixelProcessor2D::processGlowPrimitive2D with monochrome filter
using threshold 255.

Glow transparency attribute is taken into account: the initial value
at the margins of the objects. Color replacement filter is used to
replace the object shadow with the attribute value before blur pass.

Correct blur radius is used, calculated from glow effect radius,
instead of hardcoded value of 5 pixels. This makes the glow to fade
gradually along the full width of the effect, instead of only fading
in narrow outer border previously.

Since blur filter is only implemented for radius up to 254 pixels,
and since downsampling the shadow before blur increases performance
without noticeable quality loss, the image is downsampled before
filtering.

It should be noted that the glow effect is almost identical to soft
shadow effect, likely with the only difference of using dilation in
the former, but not in the latter. The code might be reused later to
implement soft shadow as well.

Change-Id: I728c532f9df7ccf85f353c23c6c7d8352d7b2086
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93235
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 
Reviewed-by: Mike Kaganski 

diff --git a/drawinglayer/source/attribute/sdrglowattribute.cxx 
b/drawinglayer/source/attribute/sdrglowattribute.cxx
index 4295aef23ae3..90367ff67ea0 100644
--- a/drawinglayer/source/attribute/sdrglowattribute.cxx
+++ b/drawinglayer/source/attribute/sdrglowattribute.cxx
@@ -21,7 +21,7 @@ namespace drawinglayer
 {
 namespace attribute
 {
-SdrGlowAttribute::SdrGlowAttribute(sal_Int32 nRadius, const basegfx::BColor& 
rColor)
+SdrGlowAttribute::SdrGlowAttribute(sal_Int32 nRadius, const Color& rColor)
 : m_nRadius(nRadius)
 , m_color(rColor)
 {
@@ -44,31 +44,6 @@ bool SdrGlowAttribute::operator==(const SdrGlowAttribute& 
rCandidate) const
 return m_nRadius == rCandidate.m_nRadius && m_color == rCandidate.m_color;
 }
 
-const basegfx::B2DHomMatrix& 
SdrGlowAttribute::GetTransfMatrix(basegfx::B2DRange nRange) const
-{
-if (!m_oTransfCache)
-{
-double dRadius100mm = static_cast(m_nRadius) / 360.0;
-// Apply a scaling with the center point of the shape as origin.
-// 1) translate shape to the origin
-basegfx::B2DHomMatrix matrix = 
basegfx::utils::createCoordinateSystemTransform(
-nRange.getCenter(), basegfx::B2DVector(-1, 0), 
basegfx::B2DVector(0, -1));
-
-basegfx::B2DHomMatrix inverse(matrix);
-inverse.invert();
-
-// 2) Scale up
-double scale_x = (nRange.getWidth() + 

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

2020-04-23 Thread Gülşah Köse (via logerrit)
 drawinglayer/source/attribute/sdrshadowattribute.cxx  |   14 +-
 include/drawinglayer/attribute/sdrshadowattribute.hxx |2 ++
 include/editeng/unoprnms.hxx  |2 ++
 include/oox/drawingml/shapepropertymap.hxx|4 +++-
 include/svx/svddef.hxx|4 +++-
 include/svx/unoshprp.hxx  |4 +++-
 oox/source/drawingml/effectproperties.cxx |   16 
 oox/source/drawingml/effectproperties.hxx |2 ++
 oox/source/drawingml/effectpropertiescontext.cxx  |2 ++
 oox/source/drawingml/shapepropertymap.cxx |4 +++-
 oox/source/token/properties.txt   |2 ++
 svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx |4 +++-
 svx/source/sdr/primitive2d/sdrattributecreator.cxx|7 ++-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx  |   18 ++
 svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx |   10 --
 svx/source/svdraw/svdattr.cxx |2 ++
 16 files changed, 84 insertions(+), 13 deletions(-)

New commits:
commit 6454b6336b8de9a4c5899adeab552af6f794cdc4
Author: Gülşah Köse 
AuthorDate: Tue Apr 14 15:49:28 2020 +0300
Commit: Gülşah Köse 
CommitDate: Thu Apr 23 10:07:13 2020 +0200

tdf#130058 Import shadow size.

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

diff --git a/drawinglayer/source/attribute/sdrshadowattribute.cxx 
b/drawinglayer/source/attribute/sdrshadowattribute.cxx
index 29e2e6f8bbb4..01ff66162ea5 100644
--- a/drawinglayer/source/attribute/sdrshadowattribute.cxx
+++ b/drawinglayer/source/attribute/sdrshadowattribute.cxx
@@ -30,14 +30,17 @@ namespace drawinglayer::attribute
 public:
 // shadow definitions
 basegfx::B2DVector  maOffset;   // 
shadow offset 1/100th mm
+basegfx::B2DVector  maSize; // 
[0.0 .. 2.0]
 double  mfTransparence; // 
[0.0 .. 1.0], 0.0==no transp.
 basegfx::BColor maColor;// 
color of shadow
 
 ImpSdrShadowAttribute(
 const basegfx::B2DVector& rOffset,
+const basegfx::B2DVector& rSize,
 double fTransparence,
 const basegfx::BColor& rColor)
 :   maOffset(rOffset),
+maSize(rSize),
 mfTransparence(fTransparence),
 maColor(rColor)
 {
@@ -45,6 +48,7 @@ namespace drawinglayer::attribute
 
 ImpSdrShadowAttribute()
 :   maOffset(basegfx::B2DVector()),
+maSize(basegfx::B2DVector()),
 mfTransparence(0.0),
 maColor(basegfx::BColor())
 {
@@ -52,12 +56,14 @@ namespace drawinglayer::attribute
 
 // data read access
 const basegfx::B2DVector& getOffset() const { return maOffset; }
+const basegfx::B2DVector& getSize() const { return maSize; }
 double getTransparence() const { return mfTransparence; }
 const basegfx::BColor& getColor() const { return maColor; }
 
 bool operator==(const ImpSdrShadowAttribute& rCandidate) const
 {
 return (getOffset() == rCandidate.getOffset()
+&& getSize() == rCandidate.getSize()
 && getTransparence() == rCandidate.getTransparence()
 && getColor() == rCandidate.getColor());
 }
@@ -72,10 +78,11 @@ namespace drawinglayer::attribute
 
 SdrShadowAttribute::SdrShadowAttribute(
 const basegfx::B2DVector& rOffset,
+const basegfx::B2DVector& rSize,
 double fTransparence,
 const basegfx::BColor& rColor)
 :   mpSdrShadowAttribute(ImpSdrShadowAttribute(
-rOffset, fTransparence, rColor))
+rOffset, rSize, fTransparence, rColor))
 {
 }
 
@@ -113,6 +120,11 @@ namespace drawinglayer::attribute
 return mpSdrShadowAttribute->getOffset();
 }
 
+const basegfx::B2DVector& SdrShadowAttribute::getSize() const
+{
+return mpSdrShadowAttribute->getSize();
+}
+
 double SdrShadowAttribute::getTransparence() const
 {
 return mpSdrShadowAttribute->getTransparence();
diff --git a/include/drawinglayer/attribute/sdrshadowattribute.hxx 
b/include/drawinglayer/attribute/sdrshadowattribute.hxx
index 39b5acf59b73..c785a24f1e81 100644
--- a/include/drawinglayer/attribute/sdrshadowattribute.hxx
+++ b/include/drawinglayer/attribute/sdrshadowattribute.hxx
@@ -52,6 +52,7 @@ namespace drawinglayer
 

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

2020-04-03 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx  |  931 ++--
 include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx |  729 -
 solenv/clang-format/blacklist   |2 
 3 files changed, 838 insertions(+), 824 deletions(-)

New commits:
commit ab931bf1148123ac262633f195efebb7babf9ce1
Author: Tomaž Vajngerl 
AuthorDate: Wed Apr 1 13:05:16 2020 +0200
Commit: Tomaž Vajngerl 
CommitDate: Fri Apr 3 16:08:37 2020 +0200

remove polypolygonprimitive2d.{hxx,cxx} from clang-format blacklist

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

diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx 
b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
index 1a521ab65243..959ae69a2159 100644
--- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
@@ -31,531 +31,534 @@
 #include 
 #include 
 
-
 using namespace com::sun::star;
 
-
 namespace drawinglayer::primitive2d
 {
-void 
PolyPolygonHairlinePrimitive2D::create2DDecomposition(Primitive2DContainer& 
rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
-const sal_uInt32 nCount(aPolyPolygon.count());
-
-if(nCount)
-{
-for(sal_uInt32 a(0); a < nCount; a++)
-{
-rContainer.push_back(new 
PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor()));
-}
-}
-}
-
-PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const 
basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor)
-:   BufferedDecompositionPrimitive2D(),
-maPolyPolygon(rPolyPolygon),
-maBColor(rBColor)
-{
-}
-
-bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
-{
-if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
-{
-const PolyPolygonHairlinePrimitive2D& rCompare = 
static_cast(rPrimitive);
-
-return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
-&& getBColor() == rCompare.getBColor());
-}
-
-return false;
-}
+void PolyPolygonHairlinePrimitive2D::create2DDecomposition(
+Primitive2DContainer& rContainer, const geometry::ViewInformation2D& 
/*rViewInformation*/) const
+{
+const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
+const sal_uInt32 nCount(aPolyPolygon.count());
 
-basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& /*rViewInformation*/) const
+if (nCount)
+{
+for (sal_uInt32 a(0); a < nCount; a++)
 {
-// return range
-return basegfx::utils::getRange(getB2DPolyPolygon());
+rContainer.push_back(
+new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), 
getBColor()));
 }
+}
+}
+
+PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(
+const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& 
rBColor)
+: BufferedDecompositionPrimitive2D()
+, maPolyPolygon(rPolyPolygon)
+, maBColor(rBColor)
+{
+}
 
-// provide unique ID
-sal_uInt32 PolyPolygonHairlinePrimitive2D::getPrimitive2DID() const { 
return PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D; }
-
-void 
PolyPolygonMarkerPrimitive2D::create2DDecomposition(Primitive2DContainer& 
rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
-const sal_uInt32 nCount(aPolyPolygon.count());
+bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
+{
+if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
+{
+const PolyPolygonHairlinePrimitive2D& rCompare
+= static_cast(rPrimitive);
 
-if(nCount)
-{
-for(sal_uInt32 a(0); a < nCount; a++)
-{
-rContainer.push_back(
-new PolygonMarkerPrimitive2D(
-aPolyPolygon.getB2DPolygon(a),
-getRGBColorA(),
-getRGBColorB(),
-getDiscreteDashLength()));
-}
-}
-}
+return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
+&& getBColor() == rCompare.getBColor());
+}
 
-PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D(
-const 

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

2020-03-11 Thread Armin Le Grand (via logerrit)
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx  |  461 +---
 drawinglayer/source/tools/emfphelperdata.cxx|   14 
 include/drawinglayer/primitive2d/svggradientprimitive2d.hxx |   33 
 3 files changed, 242 insertions(+), 266 deletions(-)

New commits:
commit c3f0c527b31f5c88263ea63d3d0e332c4783917c
Author: Armin Le Grand 
AuthorDate: Wed Mar 11 14:06:53 2020 +0100
Commit: Armin Le Grand 
CommitDate: Wed Mar 11 16:24:36 2020 +0100

tdf#124424 Enhanced SvgGradientHelper for EMF+

Added support for repeat modes in GDI+ support
and saw that the SVG primitive gradient helpers
are not capable to support these completely, so
had to do some quite complex adaptions which
OTOH will be useful for more complex gradients
anyways

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

diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index b6b85390a711..4367d8e3eb1a 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -28,6 +28,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 
 using namespace com::sun::star;
@@ -102,131 +104,191 @@ namespace drawinglayer::primitive2d
 
 if(rEntries.empty())
 {
-// no fill at all
+// no fill at all, done
+return;
 }
-else
-{
-const sal_uInt32 nCount(rEntries.size());
 
-if(1 == nCount)
+// sort maGradientEntries by offset, small to big
+std::sort(maGradientEntries.begin(), maGradientEntries.end());
+
+// gradient with at least two colors
+bool bAllInvisible(true);
+bool bInvalidEntries(false);
+
+for(const SvgGradientEntry& rCandidate : rEntries)
+{
+if(basegfx::fTools::equalZero(rCandidate.getOpacity()))
 {
-// fill with single existing color
-setSingleEntry();
+// invisible
+mbFullyOpaque = false;
+}
+else if(basegfx::fTools::equal(rCandidate.getOpacity(), 1.0))
+{
+// completely opaque
+bAllInvisible = false;
 }
 else
 {
-// sort maGradientEntries when more than one
-std::sort(maGradientEntries.begin(), 
maGradientEntries.end());
+// opacity
+bAllInvisible = false;
+mbFullyOpaque = false;
+}
 
-// gradient with at least two colors
-bool bAllInvisible(true);
+
if(!basegfx::fTools::betweenOrEqualEither(rCandidate.getOffset(), 0.0, 1.0))
+{
+bInvalidEntries = true;
+}
+}
 
-for(sal_uInt32 a(0); a < nCount; a++)
-{
-const SvgGradientEntry& rCandidate = rEntries[a];
+if(bAllInvisible)
+{
+// all invisible, nothing to do
+return;
+}
 
-if(basegfx::fTools::equalZero(rCandidate.getOpacity()))
-{
-// invisible
-mbFullyOpaque = false;
-}
-else 
if(basegfx::fTools::equal(rCandidate.getOpacity(), 1.0))
-{
-// completely opaque
-bAllInvisible = false;
-}
-else
-{
-// opacity
-bAllInvisible = false;
-mbFullyOpaque = false;
-}
-}
+if(bInvalidEntries)
+{
+// invalid entries, do nothing
+SAL_WARN("drawinglayer", "SvgGradientHelper got invalid 
SvgGradientEntries outside [0.0 .. 1.0]");
+return;
+}
 
-if(bAllInvisible)
-{
-// all invisible, nothing to do
-}
-else
-{
-const basegfx::B2DRange 
aPolyRange(getPolyPolygon().getB2DRange());
+const basegfx::B2DRange aPolyRange(getPolyPolygon().getB2DRange());
 
-if(aPolyRange.isEmpty())
-{
-// no range to fill, 

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

2020-03-07 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/geometry/viewinformation2d.cxx  |5 +
 include/drawinglayer/geometry/viewinformation2d.hxx |   18 ++
 2 files changed, 7 insertions(+), 16 deletions(-)

New commits:
commit 98bff332b061efdf0ee018a5bea5e46a7d2b7fb0
Author: Tomaž Vajngerl 
AuthorDate: Sat Mar 7 10:40:28 2020 +0100
Commit: Tomaž Vajngerl 
CommitDate: Sat Mar 7 14:40:19 2020 +0100

clean-up namespaces viewinformation2d.{cxx,hxx}

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

diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx 
b/drawinglayer/source/geometry/viewinformation2d.cxx
index d06e9d596f2d..a88757416b1b 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -346,10 +346,7 @@ public:
 && mxExtendedInformation == rCandidate.mxExtendedInformation);
 }
 };
-} // end of namespace drawinglayer::geometry
 
-namespace drawinglayer::geometry
-{
 namespace
 {
 struct theGlobalDefault : public rtl::Static
@@ -446,6 +443,6 @@ const uno::Sequence& 
ViewInformation2D::getExtendedInforma
 return mpViewInformation2D->getExtendedInformationSequence();
 }
 
-} // end of namespace
+} // end of namespace drawinglayer::geometry
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/geometry/viewinformation2d.hxx 
b/include/drawinglayer/geometry/viewinformation2d.hxx
index 263027b3b5d8..cfcbca6eacbd 100644
--- a/include/drawinglayer/geometry/viewinformation2d.hxx
+++ b/include/drawinglayer/geometry/viewinformation2d.hxx
@@ -27,13 +27,10 @@
 
 // predefines
 
-namespace drawinglayer
-{
-namespace geometry
+namespace drawinglayer::geometry
 {
 class ImpViewInformation2D;
 }
-}
 
 namespace basegfx
 {
@@ -45,22 +42,19 @@ namespace com::sun::star::beans
 {
 struct PropertyValue;
 }
+
 namespace com::sun::star::drawing
 {
 class XDrawPage;
 }
+
 namespace com::sun::star::uno
 {
 template  class Reference;
-}
-namespace com::sun::star::uno
-{
 template  class Sequence;
 }
 
-namespace drawinglayer
-{
-namespace geometry
+namespace drawinglayer::geometry
 {
 /** ViewInformation2D class
 
@@ -184,8 +178,8 @@ public:
 */
 const css::uno::Sequence& 
getExtendedInformationSequence() const;
 };
-} // end of namespace geometry
-} // end of namespace drawinglayer
+
+} // end of namespace drawinglayer::geometry
 
 #endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION2D_HXX
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2020-03-07 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/geometry/viewinformation2d.cxx  |  705 +---
 include/drawinglayer/geometry/viewinformation2d.hxx |  289 
 solenv/clang-format/blacklist   |2 
 3 files changed, 490 insertions(+), 506 deletions(-)

New commits:
commit 9d1f294bb889c7fe4a3bd1771509dd8d7f4dfc11
Author: Tomaž Vajngerl 
AuthorDate: Sat Mar 7 10:37:36 2020 +0100
Commit: Tomaž Vajngerl 
CommitDate: Sat Mar 7 14:40:01 2020 +0100

remove viewinformation2d.{cxx,hxx} from clang-format blacklist

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

diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx 
b/drawinglayer/source/geometry/viewinformation2d.cxx
index acc076c4e846..d06e9d596f2d 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -28,452 +28,423 @@
 #include 
 #include 
 
-
 using namespace com::sun::star;
 
-
 namespace drawinglayer::geometry
 {
-
 namespace
 {
-constexpr OUStringLiteral g_PropertyName_ObjectTransformation 
="ObjectTransformation";
-constexpr OUStringLiteral g_PropertyName_ViewTransformation 
="ViewTransformation";
-constexpr OUStringLiteral g_PropertyName_Viewport ="Viewport";
-constexpr OUStringLiteral g_PropertyName_Time ="Time";
-constexpr OUStringLiteral g_PropertyName_VisualizedPage = 
"VisualizedPage";
-constexpr OUStringLiteral g_PropertyName_ReducedDisplayQuality = 
"ReducedDisplayQuality";
+constexpr OUStringLiteral g_PropertyName_ObjectTransformation = 
"ObjectTransformation";
+constexpr OUStringLiteral g_PropertyName_ViewTransformation = 
"ViewTransformation";
+constexpr OUStringLiteral g_PropertyName_Viewport = "Viewport";
+constexpr OUStringLiteral g_PropertyName_Time = "Time";
+constexpr OUStringLiteral g_PropertyName_VisualizedPage = "VisualizedPage";
+constexpr OUStringLiteral g_PropertyName_ReducedDisplayQuality = 
"ReducedDisplayQuality";
 }
 
-class ImpViewInformation2D
-{
-private:
-// ViewInformation2D implementation can change refcount, so we 
have only
-// two memory regions for pairs of 
ViewInformation2D/ImpViewInformation2D
-friend class ::drawinglayer::geometry::ViewInformation2D;
+class ImpViewInformation2D
+{
+private:
+// ViewInformation2D implementation can change refcount, so we have only
+// two memory regions for pairs of ViewInformation2D/ImpViewInformation2D
+friend class ::drawinglayer::geometry::ViewInformation2D;
 
-protected:
-// the object transformation
-basegfx::B2DHomMatrix   maObjectTransformation;
+protected:
+// the object transformation
+basegfx::B2DHomMatrix maObjectTransformation;
 
-// the view transformation
-basegfx::B2DHomMatrix   maViewTransformation;
+// the view transformation
+basegfx::B2DHomMatrix maViewTransformation;
 
-// the ObjectToView and it's inverse, both on demand from 
ObjectTransformation
-// and ViewTransformation
-basegfx::B2DHomMatrix   
maObjectToViewTransformation;
-basegfx::B2DHomMatrix   
maInverseObjectToViewTransformation;
+// the ObjectToView and it's inverse, both on demand from 
ObjectTransformation
+// and ViewTransformation
+basegfx::B2DHomMatrix maObjectToViewTransformation;
+basegfx::B2DHomMatrix maInverseObjectToViewTransformation;
 
-// the visible range and the on-demand one in ViewCoordinates
-basegfx::B2DRange   maViewport;
-basegfx::B2DRange   maDiscreteViewport;
+// the visible range and the on-demand one in ViewCoordinates
+basegfx::B2DRange maViewport;
+basegfx::B2DRange maDiscreteViewport;
 
-// the DrawPage which is target of visualisation. This is needed 
e.g. for
-// the view-dependent decomposition of PageNumber TextFields.
-// This parameter is buffered here, but mainly resides in 
mxExtendedInformation,
-// so it will be interpreted, but held there. It will also not be 
added
-// to mxExtendedInformation in impFillViewInformationFromContent 
(it's there already)
-uno::Reference< drawing::XDrawPage >mxVisualizedPage;
+// the DrawPage which is target of visualisation. This is needed e.g. for
+// the view-dependent decomposition of PageNumber TextFields.
+// This parameter is buffered here, but mainly resides in 
mxExtendedInformation,
+// so it will be interpreted, but held there. It will also not be added
+// to mxExtendedInformation in impFillViewInformationFromContent (it's 
there already)
+uno::Reference 

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

2020-02-03 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/primitive2d/bitmapprimitive2d.cxx  |   59 +++--
 include/drawinglayer/primitive2d/bitmapprimitive2d.hxx |   18 ++---
 solenv/clang-format/blacklist  |2 
 3 files changed, 35 insertions(+), 44 deletions(-)

New commits:
commit a334f77792dfff92e3c97f7f61f59d01fc9338cf
Author: Tomaž Vajngerl 
AuthorDate: Sun Feb 2 21:58:04 2020 +0100
Commit: Tomaž Vajngerl 
CommitDate: Mon Feb 3 23:23:49 2020 +0100

remove bitmapprimitive2d.{cxx,hxx} from clang-format blacklist

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

diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx 
b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
index 4da17e185260..1953a36a71ac 100644
--- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
@@ -20,48 +20,43 @@
 #include 
 #include 
 
-
 using namespace com::sun::star;
 
-
 namespace drawinglayer::primitive2d
 {
-BitmapPrimitive2D::BitmapPrimitive2D(
-const BitmapEx& rBitmapEx,
-const basegfx::B2DHomMatrix& rTransform)
-:   BasePrimitive2D(),
-maBitmapEx(rBitmapEx),
-maTransform(rTransform)
-{
-}
+BitmapPrimitive2D::BitmapPrimitive2D(const BitmapEx& rBitmapEx,
+ const basegfx::B2DHomMatrix& rTransform)
+: BasePrimitive2D()
+, maBitmapEx(rBitmapEx)
+, maTransform(rTransform)
+{
+}
 
-bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) 
const
-{
-if(BasePrimitive2D::operator==(rPrimitive))
-{
-const BitmapPrimitive2D& rCompare = static_cast(rPrimitive);
+bool BitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+if (BasePrimitive2D::operator==(rPrimitive))
+{
+const BitmapPrimitive2D& rCompare = static_cast(rPrimitive);
 
-return (getBitmapEx() == rCompare.getBitmapEx()
-&& getTransform() == rCompare.getTransform());
-}
+return (getBitmapEx() == rCompare.getBitmapEx()
+&& getTransform() == rCompare.getTransform());
+}
 
-return false;
-}
+return false;
+}
 
-basegfx::B2DRange BitmapPrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
-aRetval.transform(maTransform);
-return aRetval;
-}
+basegfx::B2DRange
+BitmapPrimitive2D::getB2DRange(const geometry::ViewInformation2D& 
/*rViewInformation*/) const
+{
+basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
+aRetval.transform(maTransform);
+return aRetval;
+}
 
-sal_Int64 SAL_CALL BitmapPrimitive2D::estimateUsage()
-{
-return getBitmapEx().GetSizeBytes();
-}
+sal_Int64 SAL_CALL BitmapPrimitive2D::estimateUsage() { return 
getBitmapEx().GetSizeBytes(); }
 
-// provide unique ID
-ImplPrimitive2DIDBlock(BitmapPrimitive2D, 
PRIMITIVE2D_ID_BITMAPPRIMITIVE2D)
+// provide unique ID
+ImplPrimitive2DIDBlock(BitmapPrimitive2D, PRIMITIVE2D_ID_BITMAPPRIMITIVE2D)
 
 } // end of namespace
 
diff --git a/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx 
b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
index 41d76e6549ba..747e9e571c21 100644
--- a/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/bitmapprimitive2d.hxx
@@ -28,7 +28,6 @@
 
 namespace drawinglayer::primitive2d
 {
-
 /** BitmapPrimitive2D class
 
 This class is the central primitive for Bitmap-based primitives.
@@ -40,18 +39,16 @@ class DRAWINGLAYER_DLLPUBLIC BitmapPrimitive2D final : 
public BasePrimitive2D
 {
 private:
 /// the RGBA Bitmap-data
-BitmapExmaBitmapEx;
+BitmapEx maBitmapEx;
 
 /** the object transformation from unit coordinates, defining
 size, shear, rotate and position
  */
-basegfx::B2DHomMatrix   maTransform;
+basegfx::B2DHomMatrix maTransform;
 
 public:
 /// constructor
-BitmapPrimitive2D(
-const BitmapEx& rBitmapEx,
-const basegfx::B2DHomMatrix& rTransform);
+BitmapPrimitive2D(const BitmapEx& rBitmapEx, const basegfx::B2DHomMatrix& 
rTransform);
 
 /// data read access
 const BitmapEx& getBitmapEx() const { return maBitmapEx; }
@@ -61,13 +58,14 @@ public:
 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
 
 /// get range
-virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& 
rViewInformation) const override;
-
-/// provide unique ID
-DeclPrimitive2DIDBlock()
+virtual basegfx::B2DRange
+getB2DRange(const 

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

2020-01-03 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |   22 ++-
 include/drawinglayer/primitive2d/baseprimitive2d.hxx |   36 +--
 2 files changed, 7 insertions(+), 51 deletions(-)

New commits:
commit e5f4352d52044957c10f6530f76e97e0ca5cc4b3
Author: Tomaž Vajngerl 
AuthorDate: Tue Dec 31 17:28:10 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Fri Jan 3 10:52:42 2020 +0100

drawinglayer: simplify namespaces in BasePrimitive files

Non-functional change

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

diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 72b0f33734ee..1ee89de9e5bc 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -28,11 +28,9 @@
 #include 
 #include 
 
-using namespace com::sun::star;
+using namespace css;
 
-namespace drawinglayer
-{
-namespace primitive2d
+namespace drawinglayer::primitive2d
 {
 Primitive2DDecompositionVisitor::~Primitive2DDecompositionVisitor() {}
 
@@ -110,13 +108,7 @@ sal_Int64 SAL_CALL BasePrimitive2D::estimateUsage()
 {
 return 0; // for now ignore the objects themselves
 }
-} // end of namespace primitive2d
-} // end of namespace drawinglayer
 
-namespace drawinglayer
-{
-namespace primitive2d
-{
 void BufferedDecompositionPrimitive2D::create2DDecomposition(
 Primitive2DContainer& /*rContainer*/,
 const geometry::ViewInformation2D& /*rViewInformation*/) const
@@ -145,15 +137,9 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition(
 
 rVisitor.append(getBuffered2DDecomposition());
 }
-} // end of namespace primitive2d
-} // end of namespace drawinglayer
 
 // tooling
 
-namespace drawinglayer
-{
-namespace primitive2d
-{
 Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) const
 {
 const sal_uInt32 nSize(size());
@@ -454,7 +440,7 @@ OUString idToString(sal_uInt32 nId)
 return OUString::number((nId >> 16) & 0xFF) + "|" + 
OUString::number(nId & 0xFF);
 }
 }
-} // end of namespace primitive2d
-} // end of namespace drawinglayer
+
+} // end of namespace drawinglayer::primitive2d
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx 
b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index 17b5d2f03a36..dfe196e2e608 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -40,19 +40,12 @@
 #define ImplPrimitive2DIDBlock(TheClass, TheID)
\
 sal_uInt32 TheClass::getPrimitive2DID() const { return TheID; }
 
-// predefines
-
-namespace drawinglayer
-{
-namespace geometry
+namespace drawinglayer::geometry
 {
 class ViewInformation2D;
 }
-}
 
-namespace drawinglayer
-{
-namespace primitive2d
+namespace drawinglayer::primitive2d
 {
 /// typedefs for basePrimitive2DImplBase, Primitive2DSequence and 
Primitive2DReference
 typedef cppu::WeakComponentImplHelper
@@ -123,15 +116,7 @@ public:
 basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& 
aViewInformation) const;
 Primitive2DContainer maybeInvert(bool bInvert = false) const;
 };
-}
-}
-
-// basePrimitive2D class
 
-namespace drawinglayer
-{
-namespace primitive2d
-{
 /** BasePrimitive2D class
 
 Baseclass for all C++ implementations of css::graphic::XPrimitive2D
@@ -255,15 +240,7 @@ public:
 // XAccounting
 virtual sal_Int64 SAL_CALL estimateUsage() override;
 };
-} // end of namespace primitive2d
-} // end of namespace drawinglayer
 
-// BufferedDecompositionPrimitive2D class
-
-namespace drawinglayer
-{
-namespace primitive2d
-{
 /** BufferedDecompositionPrimitive2D class
 
 Baseclass for all C++ implementations of css::graphic::XPrimitive2D
@@ -333,15 +310,9 @@ public:
 get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& rViewInformation) 
const override;
 };
-} // end of namespace primitive2d
-} // end of namespace drawinglayer
 
 // tooling
 
-namespace drawinglayer
-{
-namespace primitive2d
-{
 /// get B2DRange from a given Primitive2DReference
 basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC getB2DRangeFromPrimitive2DReference(
 const Primitive2DReference& rCandidate, const geometry::ViewInformation2D& 
aViewInformation);
@@ -354,8 +325,7 @@ bool DRAWINGLAYER_DLLPUBLIC 
arePrimitive2DReferencesEqual(const Primitive2DRefer
 
 OUString DRAWINGLAYER_DLLPUBLIC idToString(sal_uInt32 nId);
 
-} // end of namespace primitive2d
-} // end of namespace drawinglayer
+} // end of namespace drawinglayer::primitive2d
 
 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_BASEPRIMITIVE2D_HXX
 
___
Libreoffice-commits 

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

2020-01-01 Thread Tomaž Vajngerl (via logerrit)
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |  666 ++-
 include/drawinglayer/primitive2d/baseprimitive2d.hxx |  540 ---
 solenv/clang-format/blacklist|2 
 3 files changed, 664 insertions(+), 544 deletions(-)

New commits:
commit a3569c7b89a7ddee06149ece91ce608b1252fa82
Author: Tomaž Vajngerl 
AuthorDate: Tue Dec 31 13:39:33 2019 +0100
Commit: Tomaž Vajngerl 
CommitDate: Wed Jan 1 20:58:56 2020 +0100

drawinglayer: clang-format BasePrimitive2D + remove from blacklist

No functional change was made, only formatting of the code.

The code was formatted with clang-format and moves the files
baseprimitve2d.{cxx,hxx} out of blacklist so it will be auto
formatted with every change from now on.

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

diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 4db80991dd93..72b0f33734ee 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -28,349 +28,433 @@
 #include 
 #include 
 
-
 using namespace com::sun::star;
 
-
 namespace drawinglayer
 {
-namespace primitive2d
-{
-Primitive2DDecompositionVisitor::~Primitive2DDecompositionVisitor() {}
-
-BasePrimitive2D::BasePrimitive2D()
-:   BasePrimitive2DImplBase(m_aMutex)
-{
-}
-
-BasePrimitive2D::~BasePrimitive2D()
-{
-}
-
-bool BasePrimitive2D::operator==( const BasePrimitive2D& rPrimitive ) 
const
-{
-return (getPrimitive2DID() == rPrimitive.getPrimitive2DID());
-}
+namespace primitive2d
+{
+Primitive2DDecompositionVisitor::~Primitive2DDecompositionVisitor() {}
 
-namespace {
-
-// Visitor class to get the B2D range from a tree of 
Primitive2DReference's
-//
-class B2DRangeVisitor : public Primitive2DDecompositionVisitor {
-public:
-const geometry::ViewInformation2D& mrViewInformation;
-basegfx::B2DRange maRetval;
-B2DRangeVisitor(const geometry::ViewInformation2D& 
rViewInformation) : mrViewInformation(rViewInformation) {}
-virtual void append(const Primitive2DReference& r) override {
-maRetval.expand(getB2DRangeFromPrimitive2DReference(r, 
mrViewInformation));
-}
-virtual void append(const Primitive2DContainer& r) override {
-maRetval.expand(r.getB2DRange(mrViewInformation));
-}
-virtual void append(Primitive2DContainer&& r) override {
-maRetval.expand(r.getB2DRange(mrViewInformation));
-}
-};
+BasePrimitive2D::BasePrimitive2D()
+: BasePrimitive2DImplBase(m_aMutex)
+{
+}
 
-}
+BasePrimitive2D::~BasePrimitive2D() {}
 
-basegfx::B2DRange BasePrimitive2D::getB2DRange(const 
geometry::ViewInformation2D& rViewInformation) const
-{
-B2DRangeVisitor aVisitor(rViewInformation);
-get2DDecomposition(aVisitor, rViewInformation);
-return aVisitor.maRetval;
-}
+bool BasePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
+{
+return (getPrimitive2DID() == rPrimitive.getPrimitive2DID());
+}
 
-void 
BasePrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& 
/*rVisitor*/, const geometry::ViewInformation2D& /*rViewInformation*/) const
-{
-}
+namespace
+{
+// Visitor class to get the B2D range from a tree of Primitive2DReference's
+//
+class B2DRangeVisitor : public Primitive2DDecompositionVisitor
+{
+public:
+const geometry::ViewInformation2D& mrViewInformation;
+basegfx::B2DRange maRetval;
+B2DRangeVisitor(const geometry::ViewInformation2D& rViewInformation)
+: mrViewInformation(rViewInformation)
+{
+}
+virtual void append(const Primitive2DReference& r) override
+{
+maRetval.expand(getB2DRangeFromPrimitive2DReference(r, 
mrViewInformation));
+}
+virtual void append(const Primitive2DContainer& r) override
+{
+maRetval.expand(r.getB2DRange(mrViewInformation));
+}
+virtual void append(Primitive2DContainer&& r) override
+{
+maRetval.expand(r.getB2DRange(mrViewInformation));
+}
+};
+}
 
-css::uno::Sequence< ::css::uno::Reference< 
::css::graphic::XPrimitive2D > > SAL_CALL BasePrimitive2D::getDecomposition( 
const uno::Sequence< beans::PropertyValue >& rViewParameters )
-{
-const geometry::ViewInformation2D 
aViewInformation(rViewParameters);
-Primitive2DContainer aContainer;
-get2DDecomposition(aContainer, aViewInformation);
-return 

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

2019-03-21 Thread Libreoffice Gerrit user
 drawinglayer/source/primitive2d/structuretagprimitive2d.cxx  |7 ++-
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx   |   23 ---
 include/drawinglayer/primitive2d/structuretagprimitive2d.hxx |7 ++-
 sd/source/ui/unoidl/unomodel.cxx |3 -
 4 files changed, 29 insertions(+), 11 deletions(-)

New commits:
commit a0fd6c4d1ea6d40573ad91922bf4e37992e87143
Author: Katarina Behrens 
AuthorDate: Wed Mar 6 17:22:21 2019 +0100
Commit: Katarina Behrens 
CommitDate: Thu Mar 21 13:20:46 2019 +0100

Limit tagging of background objects to images

i.e. don't tag custom shapes and other than bitmap background fills

Change-Id: I1d42012420f59e1e7b62affb8aca5a8c85688423
Reviewed-on: https://gerrit.libreoffice.org/69258
Tested-by: Jenkins
Reviewed-by: Katarina Behrens 

diff --git a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx 
b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
index 41f5577efa16..c1aedc84a587 100644
--- a/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/structuretagprimitive2d.cxx
@@ -31,10 +31,12 @@ namespace drawinglayer
 StructureTagPrimitive2D::StructureTagPrimitive2D(
 const vcl::PDFWriter::StructElement& rStructureElement,
 bool bBackground,
+bool bIsImage,
 const Primitive2DContainer& rChildren)
 :   GroupPrimitive2D(rChildren),
 maStructureElement(rStructureElement),
-mbBackground(bBackground)
+mbBackground(bBackground),
+mbIsImage(bIsImage)
 {
 }
 
@@ -44,7 +46,8 @@ namespace drawinglayer
 {
 const StructureTagPrimitive2D& rCompare = static_cast(rPrimitive);
 
-return (isBackground() == rCompare.isBackground());
+return (isBackground() == rCompare.isBackground() &&
+isImage() == rCompare.isImage());
 }
 
 return false;
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 1c3e73fc85b3..40eec9fc4245 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -2213,20 +2213,31 @@ namespace drawinglayer
 {
 // structured tag primitive
 const vcl::PDFWriter::StructElement& 
rTagElement(rStructureTagCandidate.getStructureElement());
-const bool bTagUsed(vcl::PDFWriter::NonStructElement != 
rTagElement);
-const bool bIsBackground(rStructureTagCandidate.isBackground());
+bool bTagUsed((vcl::PDFWriter::NonStructElement != rTagElement));
 
 if(mpPDFExtOutDevData && bTagUsed)
 {
-// Write start tag. For background elements use 
NonStructElement instead of real element type (e.g. Figure)
-// to guarantee it gets exported as artifact (tagged PDF)
-mpPDFExtOutDevData->BeginStructureElement(bIsBackground ? 
vcl::PDFWriter::NonStructElement : rTagElement);
+// foreground object: tag as regular structure element
+if (!rStructureTagCandidate.isBackground())
+{
+mpPDFExtOutDevData->BeginStructureElement(rTagElement);
+}
+// background object
+else
+{
+// background image: tag as artifact
+if (rStructureTagCandidate.isImage())
+
mpPDFExtOutDevData->BeginStructureElement(vcl::PDFWriter::NonStructElement);
+// any other background object: do not tag
+else
+bTagUsed = false;
+}
 }
 
 // process children normally
 process(rStructureTagCandidate.getChildren());
 
-if(mpPDFExtOutDevData &&  bTagUsed)
+if(mpPDFExtOutDevData && bTagUsed)
 {
 // write end tag
 mpPDFExtOutDevData->EndStructureElement();
diff --git a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx 
b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
index b6e9ad94ede8..255dc5e64f56 100644
--- a/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/structuretagprimitive2d.hxx
@@ -48,20 +48,23 @@ namespace drawinglayer
 /// the PDF structure element this grouping represents
 vcl::PDFWriter::StructElement   maStructureElement;
 
-///Z flag for background contenht that may be handled as
-/// Tagged PDF '/Artifact'
+/// flag for background object
 boolmbBackground;
+/// flag for image (OBJ_GRAF)
+ 

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

2018-07-16 Thread Libreoffice Gerrit user
 drawinglayer/source/processor2d/processor2dtools.cxx   |9 +++---
 drawinglayer/source/processor2d/processorfromoutputdevice.cxx  |7 ++---
 drawinglayer/source/tools/converters.cxx   |4 +-
 include/drawinglayer/processor2d/processor2dtools.hxx  |5 ++-
 include/drawinglayer/processor2d/processorfromoutputdevice.hxx |3 +-
 sc/source/ui/inc/output.hxx|2 -
 sc/source/ui/view/output.cxx   |2 -
 svx/source/dialog/pagectrl.cxx |   10 ++-
 sw/source/core/doc/notxtfrm.cxx|6 +---
 sw/source/core/inc/frame.hxx   |2 -
 sw/source/core/layout/paintfrm.cxx |   14 
++
 11 files changed, 29 insertions(+), 35 deletions(-)

New commits:
commit 03a651d48e7cb3b19c98bdf3ed0a1080b60974ae
Author: Noel Grandin 
AuthorDate: Sun Jul 15 12:05:08 2018 +0200
Commit: Noel Grandin 
CommitDate: Mon Jul 16 08:39:20 2018 +0200

return BaseProcessor2D by std::unique_ptr

Change-Id: Ibad6e989d2d7ba779e7557e41552d06c076f657b
Reviewed-on: https://gerrit.libreoffice.org/57448
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/processor2d/processor2dtools.cxx 
b/drawinglayer/source/processor2d/processor2dtools.cxx
index 49863873ddba..9d7e1aed245c 100644
--- a/drawinglayer/source/processor2d/processor2dtools.cxx
+++ b/drawinglayer/source/processor2d/processor2dtools.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 #include 
+#include 
 #include "vclpixelprocessor2d.hxx"
 #include "vclmetafileprocessor2d.hxx"
 
@@ -28,15 +29,15 @@ namespace drawinglayer
 {
 namespace processor2d
 {
-BaseProcessor2D* createPixelProcessor2DFromOutputDevice(
+std::unique_ptr 
createPixelProcessor2DFromOutputDevice(
 OutputDevice& rTargetOutDev,
 const drawinglayer::geometry::ViewInformation2D& 
rViewInformation2D)
 {
 // create Pixel Vcl-Processor
-return new VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
+return o3tl::make_unique(rViewInformation2D, 
rTargetOutDev);
 }
 
-BaseProcessor2D* createProcessor2DFromOutputDevice(
+std::unique_ptr createProcessor2DFromOutputDevice(
 OutputDevice& rTargetOutDev,
 const drawinglayer::geometry::ViewInformation2D& 
rViewInformation2D)
 {
@@ -46,7 +47,7 @@ namespace drawinglayer
 if(bOutputToRecordingMetaFile)
 {
 // create MetaFile Vcl-Processor and process
-return new VclMetafileProcessor2D(rViewInformation2D, 
rTargetOutDev);
+return 
o3tl::make_unique(rViewInformation2D, rTargetOutDev);
 }
 else
 {
diff --git a/drawinglayer/source/processor2d/processorfromoutputdevice.cxx 
b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
index 16bd3b6404f4..ce81ce4b8f88 100644
--- a/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
+++ b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
@@ -26,6 +26,7 @@
 #include "vclmetafileprocessor2d.hxx"
 #include "vclpixelprocessor2d.hxx"
 #include 
+#include 
 
 using namespace com::sun::star;
 
@@ -33,7 +34,7 @@ namespace drawinglayer
 {
 namespace processor2d
 {
-drawinglayer::processor2d::BaseProcessor2D* 
createBaseProcessor2DFromOutputDevice(
+std::unique_ptr 
createBaseProcessor2DFromOutputDevice(
 OutputDevice& rTargetOutDev,
 const drawinglayer::geometry::ViewInformation2D& 
rViewInformation2D)
 {
@@ -43,12 +44,12 @@ namespace drawinglayer
 if(bOutputToRecordingMetaFile)
 {
 // create MetaFile Vcl-Processor and process
-return new 
drawinglayer::processor2d::VclMetafileProcessor2D(rViewInformation2D, 
rTargetOutDev);
+return 
o3tl::make_unique(rViewInformation2D,
 rTargetOutDev);
 }
 else
 {
 // create Pixel Vcl-Processor
-return new 
drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, 
rTargetOutDev);
+return 
o3tl::make_unique(rViewInformation2D,
 rTargetOutDev);
 }
 }
 } // end of namespace processor2d
diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 968b67bef4c0..c34dc03e9039 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -80,7 +80,7 @@ namespace drawinglayer
 // create pixel processor, also already takes care of AAing and
 // checking the getOptionsDrawinglayer().IsAntiAliasing() switch. 
If
 // not wanted, change after this 

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

2018-06-06 Thread Noel Grandin
 drawinglayer/source/texture/texture3d.cxx  |  100 +++--
 include/drawinglayer/texture/texture3d.hxx |4 +
 2 files changed, 86 insertions(+), 18 deletions(-)

New commits:
commit b292a27698e85fd9d60c03613c3b0c67835c4dc1
Author: Noel Grandin 
Date:   Wed Jun 6 16:31:03 2018 +0200

tdf#118029 crashtesting ooo24656-1.doc with --convert-to pdf

Revert "dont use GetMask in GeoTexSvxBitmapEx"

This reverts commit 63e65d1743264dfa26d2aba615d71978e65784e8.

Until we come up with something better

Change-Id: I246468abdd5e3ee917143e251c2e95430d84f77b
Reviewed-on: https://gerrit.libreoffice.org/55385
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/drawinglayer/source/texture/texture3d.cxx 
b/drawinglayer/source/texture/texture3d.cxx
index 647b671c5ea7..0dac447ccf50 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -64,22 +64,39 @@ namespace drawinglayer
 const BitmapEx& rBitmapEx,
 const basegfx::B2DRange& rRange)
 :   maBitmapEx(rBitmapEx),
+maTransparence(),
 maTopLeft(rRange.getMinimum()),
 maSize(rRange.getRange()),
 mfMulX(0.0),
 mfMulY(0.0),
-mbIsAlpha(false)
+mbIsAlpha(false),
+mbIsTransparent(maBitmapEx.IsTransparent())
 {
-if(maBitmapEx.IsTransparent())
+// #121194# Todo: use alpha channel, too (for 3d)
+maBitmap = maBitmapEx.GetBitmap();
+
+if(mbIsTransparent)
 {
 if(maBitmapEx.IsAlpha())
 {
 mbIsAlpha = true;
+maTransparence = rBitmapEx.GetAlpha().GetBitmap();
+}
+else
+{
+maTransparence = rBitmapEx.GetMask();
 }
+
+mpReadTransparence = Bitmap::ScopedReadAccess(maTransparence);
 }
 
-mfMulX = static_cast(maBitmapEx.GetSizePixel().Width()) / 
maSize.getX();
-mfMulY = static_cast(maBitmapEx.GetSizePixel().Height()) / 
maSize.getY();
+mpReadBitmap = Bitmap::ScopedReadAccess(maBitmap);
+SAL_WARN_IF(!mpReadBitmap, "drawinglayer", "GeoTexSvxBitmapEx: Got 
no read access to Bitmap");
+if (mpReadBitmap)
+{
+mfMulX = static_cast(mpReadBitmap->Width()) / 
maSize.getX();
+mfMulY = static_cast(mpReadBitmap->Height()) / 
maSize.getY();
+}
 
 if(maSize.getX() <= 1.0)
 {
@@ -96,20 +113,60 @@ namespace drawinglayer
 {
 }
 
-sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32 nX, 
sal_Int32 nY) const
+sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32 rX, 
sal_Int32 rY) const
 {
-return maBitmapEx.GetTransparency(nX, nY);
+switch(maBitmapEx.GetTransparentType())
+{
+case TransparentType::NONE:
+{
+break;
+}
+case TransparentType::Color:
+{
+const BitmapColor aBitmapColor(mpReadBitmap->GetColor(rY, 
rX));
+
+if(maBitmapEx.GetTransparentColor() == 
aBitmapColor.GetColor())
+{
+return 255;
+}
+
+break;
+}
+case TransparentType::Bitmap:
+{
+OSL_ENSURE(mpReadTransparence, "OOps, transparence type 
Bitmap, but no read access created in the constructor (?)");
+const BitmapColor 
aBitmapColor(mpReadTransparence->GetPixel(rY, rX));
+
+if(mbIsAlpha)
+{
+return aBitmapColor.GetIndex();
+}
+else
+{
+if(0x00 != aBitmapColor.GetIndex())
+{
+return 255;
+}
+}
+break;
+}
+}
+
+return 0;
 }
 
 bool GeoTexSvxBitmapEx::impIsValid(const basegfx::B2DPoint& rUV, 
sal_Int32& rX, sal_Int32& rY) const
 {
-rX = static_cast((rUV.getX() - maTopLeft.getX()) * 
mfMulX);
-
-if(rX >= 0 && rX < maBitmapEx.GetSizePixel().Width())
+if(mpReadBitmap)
 {
-rY = static_cast((rUV.getY() - maTopLeft.getY()) * 
mfMulY);
+rX = static_cast((rUV.getX() - maTopLeft.getX()) * 
mfMulX);
+
+if(rX >= 0 && rX < mpReadBitmap->Width())
+{
+rY = static_cast((rUV.getY() - 
maTopLeft.getY()) * mfMulY);
 
-return (rY >= 0 && rY < 

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

2018-05-30 Thread Noel Grandin
 drawinglayer/source/texture/texture3d.cxx  |  100 +
 include/drawinglayer/texture/texture3d.hxx |4 -
 2 files changed, 18 insertions(+), 86 deletions(-)

New commits:
commit 63e65d1743264dfa26d2aba615d71978e65784e8
Author: Noel Grandin 
Date:   Wed May 30 11:11:21 2018 +0200

dont use GetMask in GeoTexSvxBitmapEx

part of the process of making Bitmap's internals be private to vcl

Change-Id: I3784c14be1572d4df64b9cbdb5adcebdd1b274fd
Reviewed-on: https://gerrit.libreoffice.org/55050
Tested-by: Jenkins 
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/drawinglayer/source/texture/texture3d.cxx 
b/drawinglayer/source/texture/texture3d.cxx
index 0dac447ccf50..0573c3e4b3f5 100644
--- a/drawinglayer/source/texture/texture3d.cxx
+++ b/drawinglayer/source/texture/texture3d.cxx
@@ -64,39 +64,22 @@ namespace drawinglayer
 const BitmapEx& rBitmapEx,
 const basegfx::B2DRange& rRange)
 :   maBitmapEx(rBitmapEx),
-maTransparence(),
 maTopLeft(rRange.getMinimum()),
 maSize(rRange.getRange()),
 mfMulX(0.0),
 mfMulY(0.0),
-mbIsAlpha(false),
-mbIsTransparent(maBitmapEx.IsTransparent())
+mbIsAlpha(false)
 {
-// #121194# Todo: use alpha channel, too (for 3d)
-maBitmap = maBitmapEx.GetBitmap();
-
-if(mbIsTransparent)
+if(maBitmapEx.IsTransparent())
 {
 if(maBitmapEx.IsAlpha())
 {
 mbIsAlpha = true;
-maTransparence = rBitmapEx.GetAlpha().GetBitmap();
-}
-else
-{
-maTransparence = rBitmapEx.GetMask();
 }
-
-mpReadTransparence = Bitmap::ScopedReadAccess(maTransparence);
 }
 
-mpReadBitmap = Bitmap::ScopedReadAccess(maBitmap);
-SAL_WARN_IF(!mpReadBitmap, "drawinglayer", "GeoTexSvxBitmapEx: Got 
no read access to Bitmap");
-if (mpReadBitmap)
-{
-mfMulX = static_cast(mpReadBitmap->Width()) / 
maSize.getX();
-mfMulY = static_cast(mpReadBitmap->Height()) / 
maSize.getY();
-}
+mfMulX = static_cast(maBitmapEx.GetSizePixel().Width()) / 
maSize.getX();
+mfMulY = static_cast(maBitmapEx.GetSizePixel().Height()) / 
maSize.getY();
 
 if(maSize.getX() <= 1.0)
 {
@@ -113,60 +96,20 @@ namespace drawinglayer
 {
 }
 
-sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32 rX, 
sal_Int32 rY) const
+sal_uInt8 GeoTexSvxBitmapEx::impGetTransparence(sal_Int32 nX, 
sal_Int32 nY) const
 {
-switch(maBitmapEx.GetTransparentType())
-{
-case TransparentType::NONE:
-{
-break;
-}
-case TransparentType::Color:
-{
-const BitmapColor aBitmapColor(mpReadBitmap->GetColor(rY, 
rX));
-
-if(maBitmapEx.GetTransparentColor() == 
aBitmapColor.GetColor())
-{
-return 255;
-}
-
-break;
-}
-case TransparentType::Bitmap:
-{
-OSL_ENSURE(mpReadTransparence, "OOps, transparence type 
Bitmap, but no read access created in the constructor (?)");
-const BitmapColor 
aBitmapColor(mpReadTransparence->GetPixel(rY, rX));
-
-if(mbIsAlpha)
-{
-return aBitmapColor.GetIndex();
-}
-else
-{
-if(0x00 != aBitmapColor.GetIndex())
-{
-return 255;
-}
-}
-break;
-}
-}
-
-return 0;
+return maBitmapEx.GetTransparency(nX, nY);
 }
 
 bool GeoTexSvxBitmapEx::impIsValid(const basegfx::B2DPoint& rUV, 
sal_Int32& rX, sal_Int32& rY) const
 {
-if(mpReadBitmap)
-{
-rX = static_cast((rUV.getX() - maTopLeft.getX()) * 
mfMulX);
+rX = static_cast((rUV.getX() - maTopLeft.getX()) * 
mfMulX);
 
-if(rX >= 0 && rX < mpReadBitmap->Width())
-{
-rY = static_cast((rUV.getY() - 
maTopLeft.getY()) * mfMulY);
+if(rX >= 0 && rX < maBitmapEx.GetSizePixel().Width())
+{
+rY = static_cast((rUV.getY() - maTopLeft.getY()) * 
mfMulY);
 
-return (rY >= 0 && rY < mpReadBitmap->Height());
-}
+return (rY >= 0 && rY < 

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

2018-01-28 Thread Jochen Nitschke
 drawinglayer/source/attribute/fillgradientattribute.cxx |   26 ++-
 drawinglayer/source/attribute/fillgraphicattribute.cxx  |   15 +-
 drawinglayer/source/attribute/fillhatchattribute.cxx|   26 ++-
 drawinglayer/source/attribute/fontattribute.cxx |   26 ++-
 drawinglayer/source/attribute/lineattribute.cxx |   15 +-
 drawinglayer/source/attribute/linestartendattribute.cxx |   15 +-
 drawinglayer/source/attribute/materialattribute3d.cxx   |   15 +-
 drawinglayer/source/attribute/sdrfillattribute.cxx  |   26 ++-
 drawinglayer/source/attribute/sdrfillgraphicattribute.cxx   |   26 ++-
 drawinglayer/source/attribute/sdrlightattribute3d.cxx   |   15 +-
 drawinglayer/source/attribute/sdrlightingattribute3d.cxx|   27 ++--
 drawinglayer/source/attribute/sdrlineattribute.cxx  |   26 ++-
 drawinglayer/source/attribute/sdrlinestartendattribute.cxx  |   26 ++-
 drawinglayer/source/attribute/sdrobjectattribute3d.cxx  |   15 +-
 drawinglayer/source/attribute/sdrsceneattribute3d.cxx   |   26 ++-
 drawinglayer/source/attribute/sdrshadowattribute.cxx|   26 ++-
 drawinglayer/source/attribute/strokeattribute.cxx   |   26 ++-
 drawinglayer/source/geometry/viewinformation2d.cxx  |   26 ++-
 drawinglayer/source/geometry/viewinformation3d.cxx  |   26 ++-
 include/drawinglayer/attribute/fillgradientattribute.hxx|8 +--
 include/drawinglayer/attribute/fillgraphicattribute.hxx |4 -
 include/drawinglayer/attribute/fillhatchattribute.hxx   |8 +--
 include/drawinglayer/attribute/fontattribute.hxx|8 +--
 include/drawinglayer/attribute/lineattribute.hxx|4 -
 include/drawinglayer/attribute/linestartendattribute.hxx|4 -
 include/drawinglayer/attribute/materialattribute3d.hxx  |4 -
 include/drawinglayer/attribute/sdrfillattribute.hxx |8 +--
 include/drawinglayer/attribute/sdrfillgraphicattribute.hxx  |8 +--
 include/drawinglayer/attribute/sdrlightattribute3d.hxx  |4 -
 include/drawinglayer/attribute/sdrlineattribute.hxx |8 +--
 include/drawinglayer/attribute/sdrlinestartendattribute.hxx |8 +--
 include/drawinglayer/attribute/sdrobjectattribute3d.hxx |4 -
 include/drawinglayer/attribute/sdrsceneattribute3d.hxx  |8 +--
 include/drawinglayer/attribute/sdrshadowattribute.hxx   |8 +--
 include/drawinglayer/attribute/strokeattribute.hxx  |8 +--
 include/drawinglayer/geometry/viewinformation2d.hxx |8 +--
 include/drawinglayer/geometry/viewinformation3d.hxx |8 +--
 37 files changed, 144 insertions(+), 405 deletions(-)

New commits:
commit 8010abe4ab300f966b878b64ccc8733e3ea3cbc4
Author: Jochen Nitschke 
Date:   Sun Jan 28 20:18:12 2018 +0100

clang-tidy modernize-use-equals-default in drawinglayer

Change-Id: I2fbcac7a22a881681bc8b84274e7d39f1cec18bf
Reviewed-on: https://gerrit.libreoffice.org/48800
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index 941f311e1ac5..e4931abab825 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -119,36 +119,20 @@ namespace drawinglayer
 {
 }
 
-FillGradientAttribute::FillGradientAttribute(const 
FillGradientAttribute& rCandidate)
-:   mpFillGradientAttribute(rCandidate.mpFillGradientAttribute)
-{
-}
+FillGradientAttribute::FillGradientAttribute(const 
FillGradientAttribute&) = default;
 
-FillGradientAttribute::FillGradientAttribute(FillGradientAttribute&& 
rCandidate)
-:   
mpFillGradientAttribute(std::move(rCandidate.mpFillGradientAttribute))
-{
-}
+FillGradientAttribute::FillGradientAttribute(FillGradientAttribute&&) 
= default;
 
-FillGradientAttribute::~FillGradientAttribute()
-{
-}
+FillGradientAttribute::~FillGradientAttribute() = default;
 
 bool FillGradientAttribute::isDefault() const
 {
 return 
mpFillGradientAttribute.same_object(theGlobalDefault::get());
 }
 
-FillGradientAttribute& FillGradientAttribute::operator=(const 
FillGradientAttribute& rCandidate)
-{
-mpFillGradientAttribute = rCandidate.mpFillGradientAttribute;
-return *this;
-}
+FillGradientAttribute& FillGradientAttribute::operator=(const 
FillGradientAttribute&) = default;
 
-FillGradientAttribute& 
FillGradientAttribute::operator=(FillGradientAttribute&& rCandidate)
-{
-

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

2017-11-26 Thread Caolán McNamara
 drawinglayer/source/primitive2d/textlayoutdevice.cxx  |2 +-
 include/drawinglayer/primitive2d/textlayoutdevice.hxx |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b5f0395aa408e831f4cc6182c65885ee2a78f90e
Author: Caolán McNamara 
Date:   Sun Nov 26 21:12:20 2017 +

coverity#1421100 Uncaught exception

Change-Id: Id9cb50e0e3eace3365eefe29650e993694480d47

diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx 
b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index 3b49ad6c13e5..ca0b8bb7e95c 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -157,7 +157,7 @@ namespace drawinglayer
 {
 }
 
-TextLayouterDevice::~TextLayouterDevice()
+TextLayouterDevice::~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE
 {
 releaseGlobalVirtualDevice();
 }
diff --git a/include/drawinglayer/primitive2d/textlayoutdevice.hxx 
b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
index c8670603e26a..478c630f311f 100644
--- a/include/drawinglayer/primitive2d/textlayoutdevice.hxx
+++ b/include/drawinglayer/primitive2d/textlayoutdevice.hxx
@@ -64,7 +64,7 @@ namespace drawinglayer
 public:
 /// constructor/destructor
 TextLayouterDevice();
-~TextLayouterDevice();
+~TextLayouterDevice() COVERITY_NOEXCEPT_FALSE;
 
 /// tooling methods
 void setFont(const vcl::Font& rFont);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2017-11-05 Thread Noel Grandin
 drawinglayer/source/processor2d/vclpixelprocessor2d.hxx  |4 ---
 include/drawinglayer/animation/animationtiming.hxx   |9 ++-
 include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx |4 ---
 include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx  |4 ---
 include/drawinglayer/primitive3d/sdrextrudelathetools3d.hxx  |3 --
 include/drawinglayer/primitive3d/shadowprimitive3d.hxx   |3 --
 include/drawinglayer/texture/texture.hxx |   13 +++
 include/drawinglayer/texture/texture3d.hxx   |9 ++-
 8 files changed, 15 insertions(+), 34 deletions(-)

New commits:
commit 149247ec64b558244f8d94834ead37a1354029f4
Author: Noel Grandin 
Date:   Fri Nov 3 15:13:24 2017 +0200

loplugin:finalclasses in drawinglayer

Change-Id: I8922fc85ab23453791e3ce0b639d4ffafd31e967
Reviewed-on: https://gerrit.libreoffice.org/44315
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
index fb7cc5280c64..0190fed7dfe7 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.hxx
@@ -47,13 +47,11 @@ namespace drawinglayer
 all feeded primitives to a VCL Window. It is the currently used 
renderer
 for all VCL editing output from the DrawingLayer.
  */
-class VclPixelProcessor2D : public VclProcessor2D
+class VclPixelProcessor2D final : public VclProcessor2D
 {
-private:
 struct Impl;
 std::unique_ptr m_pImpl;
 
-protected:
 /*  the local processor for BasePrimitive2D-Implementation based 
primitives,
 called from the common process()-implementation
  */
diff --git a/include/drawinglayer/animation/animationtiming.hxx 
b/include/drawinglayer/animation/animationtiming.hxx
index f98136d1621a..6925994d8f61 100644
--- a/include/drawinglayer/animation/animationtiming.hxx
+++ b/include/drawinglayer/animation/animationtiming.hxx
@@ -50,9 +50,8 @@ namespace drawinglayer
 };
 
 
-class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed : public 
AnimationEntry
+class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed final : public 
AnimationEntry
 {
-protected:
 double  mfDuration;
 double  mfState;
 
@@ -68,9 +67,8 @@ namespace drawinglayer
 };
 
 
-class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear : public 
AnimationEntry
+class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear final : public 
AnimationEntry
 {
-protected:
 double  mfDuration;
 double  mfFrequency;
 double  mfStart;
@@ -112,9 +110,8 @@ namespace drawinglayer
 };
 
 
-class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop : public 
AnimationEntryList
+class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop final : public 
AnimationEntryList
 {
-protected:
 sal_uInt32  mnRepeat;
 
 public:
diff --git a/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx 
b/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx
index 6203b58f3407..b46051be91bd 100644
--- a/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx
+++ b/include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx
@@ -37,16 +37,14 @@ namespace drawinglayer
 primitive has no default buffering, it is necessary here to add a 
local
 buffering mechanism for the decomposition
  */
-class DRAWINGLAYER_DLLPUBLIC HatchTexturePrimitive3D : public 
TexturePrimitive3D
+class DRAWINGLAYER_DLLPUBLIC HatchTexturePrimitive3D final : public 
TexturePrimitive3D
 {
-private:
 /// the hatch definition
 attribute::FillHatchAttribute   maHatch;
 
 /// the buffered decomposed hatch
 Primitive3DContainer 
maBuffered3DDecomposition;
 
-protected:
 /// helper: local decomposition
 Primitive3DContainer impCreate3DDecomposition() const;
 
diff --git a/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx 
b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
index 76429400ee16..ed0732e48d70 100644
--- a/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
+++ b/include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx
@@ -44,9 +44,8 @@ namespace drawinglayer
 3D objects needed for the line tubes and the edge 

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

2017-09-12 Thread Armin Le Grand
 drawinglayer/source/primitive2d/textprimitive2d.cxx  |9 +
 include/drawinglayer/primitive2d/textprimitive2d.hxx |   17 ++---
 2 files changed, 15 insertions(+), 11 deletions(-)

New commits:
commit 41c704a8d6ca225e0ba0b1deb730c2bead66da25
Author: Armin Le Grand 
Date:   Tue Sep 12 10:30:01 2017 +0200

tdf#111853 Added TextFillColor to operator==

TextFillColor was added to TextSimplePortionPrimitive2D, but not added to
TextSimplePortionPrimitive2D::operator==, so when this changed it was not
detected. Added this.
Also added was bFilled and nWidthToFill, all defaulted. This is not 
accessible
for TextDecoratedPortionPrimitive2D and seems to be some special solution
just for one special case in DrawPortionInfo, only used from 
Outliner::DrawingTab,
so I am not sure if that change to the central TextSimplePortionPrimitive2D 
is
good and should stay

Change-Id: Ief8da74a8b66281e47c4c8a47131125e30b90e7d
Reviewed-on: https://gerrit.libreoffice.org/42188
Reviewed-by: Armin Le Grand 
Tested-by: Armin Le Grand 

diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index 0cf27bbba440..3dc00a9e1a99 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -225,7 +225,7 @@ namespace drawinglayer
 const basegfx::BColor& rFontColor,
 bool bFilled,
 long nWidthToFill,
-const Color& rFillColor)
+const Color& rTextFillColor)
 :   BufferedDecompositionPrimitive2D(),
 maTextTransform(rNewTransform),
 maText(rText),
@@ -235,10 +235,10 @@ namespace drawinglayer
 maFontAttribute(rFontAttribute),
 maLocale(rLocale),
 maFontColor(rFontColor),
-maB2DRange(),
 mbFilled(bFilled),
 mnWidthToFill(nWidthToFill),
-maTextFillColor(rFillColor)
+maTextFillColor(rTextFillColor),
+maB2DRange()
 {
 #if OSL_DEBUG_LEVEL > 0
 const sal_Int32 aStringLength(getText().getLength());
@@ -269,7 +269,8 @@ namespace drawinglayer
 && LocalesAreEqual(getLocale(), rCompare.getLocale())
 && getFontColor() == rCompare.getFontColor()
 && mbFilled == rCompare.mbFilled
-&& mnWidthToFill == rCompare.mnWidthToFill);
+&& mnWidthToFill == rCompare.mnWidthToFill
+&& maTextFillColor == rCompare.maTextFillColor);
 }
 
 return false;
diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx 
b/include/drawinglayer/primitive2d/textprimitive2d.hxx
index 6b6b8381c563..2eb208f271ce 100644
--- a/include/drawinglayer/primitive2d/textprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -93,7 +93,7 @@ namespace drawinglayer
 
 @param nWidthToFill
 
-@param rFillColor
+@param rTextFillColor
 Text background color (has nothing to do with bFilled and 
nWidthToFill)
 
  */
@@ -119,20 +119,23 @@ namespace drawinglayer
 attribute::FontAttributemaFontAttribute;
 
 /// The Locale for the text
-css::lang::Locale  maLocale;
+css::lang::Locale   maLocale;
 
 /// font color
 basegfx::BColor maFontColor;
 
+// Whether to fill a given width with the text
+boolmbFilled;
 
-/// #i96669# internal: add simple range buffering for this 
primitive
-basegfx::B2DRange   maB2DRange;
-boolmbFilled;   // 
Whether to fill a given width with the text
-longmnWidthToFill;  // the 
width to fill
+// the width to fill
+longmnWidthToFill;
 
 /// The fill color of the text
 Color   maTextFillColor;
 
+/// #i96669# internal: add simple range buffering for this 
primitive
+basegfx::B2DRange   maB2DRange;
+
 protected:
 /// local decomposition.
 virtual void create2DDecomposition(Primitive2DContainer& 
rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
@@ -150,7 +153,7 @@ namespace drawinglayer
 const basegfx::BColor& rFontColor,
 bool bFilled = false,
 long nWidthToFill = 0,
-const Color& rFillColor = COL_TRANSPARENT );
+const 

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

2017-07-31 Thread Armin Le Grand
 drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx  |   23 ++
 drawinglayer/source/processor2d/hittestprocessor2d.cxx|9 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx|   12 -
 include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx |   10 -
 include/drawinglayer/processor2d/hittestprocessor2d.hxx   |   15 +
 include/svx/sdrhittesthelper.hxx  |9 
 svx/source/svdraw/sdrhittesthelper.cxx|   22 +-
 svx/source/svdraw/svdotextdecomposition.cxx   |   13 +
 svx/source/svdraw/svdview.cxx |   92 ++
 9 files changed, 152 insertions(+), 53 deletions(-)

New commits:
commit d62d07b3d29014f76c0d676c891cbafa80d0765f
Author: Armin Le Grand 
Date:   Mon Jul 31 14:46:03 2017 +0200

Corrected HitTest for layouted text

For text layouted using EditEngine the HitTest in SVX is
identifying Field like URLs. Thus ist is better to use the
anyways more precise primitives for HitTest (rotation/shear/
mirror, ...). This was necessary since the former mechanism
which used a combination of primitive-beased HitTest and then
using an Outliner to get the position/content of the Field
landed on different positions e.g. when the layout needed to
use multiple lines for the contained URL, but there could
be more cases found.
Adapted the text decompositon, the primitive HitTest and
the TextHirearchyFieldPrimitive2D accordingly.

Change-Id: Ice559e20d02547fdcfcf9783e7cc5481706aab03
Reviewed-on: https://gerrit.libreoffice.org/40591
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx 
b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx
index 86883e43b6cb..45fa8531bee3 100644
--- a/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/texthierarchyprimitive2d.cxx
@@ -95,11 +95,28 @@ namespace drawinglayer
 TextHierarchyFieldPrimitive2D::TextHierarchyFieldPrimitive2D(
 const Primitive2DContainer& rChildren,
 const FieldType& rFieldType,
-const OUString& rString)
+const std::vector< std::pair< OUString, OUString>>* pNameValue)
 :   GroupPrimitive2D(rChildren),
 meType(rFieldType),
-maString(rString)
+meNameValue()
 {
+if (nullptr != pNameValue)
+{
+meNameValue = *pNameValue;
+}
+}
+
+OUString TextHierarchyFieldPrimitive2D::getValue(const OUString& 
rName) const
+{
+for (const std::pair< OUString, OUString >& candidate : 
meNameValue)
+{
+if (candidate.first.equals(rName))
+{
+return candidate.second;
+}
+}
+
+return OUString();
 }
 
 bool TextHierarchyFieldPrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
@@ -109,7 +126,7 @@ namespace drawinglayer
 const TextHierarchyFieldPrimitive2D& rCompare = 
static_cast(rPrimitive);
 
 return (getType() == rCompare.getType()
-&&  getString() == rCompare.getString());
+&& getNameValue() == rCompare.getNameValue());
 }
 
 return false;
diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx 
b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 82ccfd00b7fe..cae95d7e6a51 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -45,6 +45,8 @@ namespace drawinglayer
 :   BaseProcessor2D(rViewInformation),
 maDiscreteHitPosition(),
 mfDiscreteHitTolerance(0.0),
+maHitStack(),
+mbCollectHitStack(false),
 mbHit(false),
 mbHitTextOnly(bHitTextOnly)
 {
@@ -536,6 +538,13 @@ namespace drawinglayer
 break;
 }
 }
+
+if (getHit() && getCollectHitStack())
+{
+/// push candidate to HitStack to create it. This only happens 
when a hit is found and
+/// creating the HitStack was requested (see collectHitStack)
+
maHitStack.append(primitive2d::Primitive2DReference(const_cast< 
primitive2d::BasePrimitive2D* >()));
+}
 }
 
 } // end of namespace processor2d
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index efe3342b7cf9..c8ec56088085 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -977,6 

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

2017-07-20 Thread Noel Grandin
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx  |2 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx|4 -
 drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx|4 -
 drawinglayer/source/tools/emfppath.cxx|2 
 drawinglayer/source/tools/emfppath.hxx|2 
 drawinglayer/source/tools/wmfemfhelper.cxx|   28 +-
 include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx |2 
 7 files changed, 22 insertions(+), 22 deletions(-)

New commits:
commit 08366676c82d585019b575eb9ddb2d9fc537dd76
Author: Noel Grandin 
Date:   Thu Jul 20 11:54:21 2017 +0200

loplugin:constparams in drawinglayer

Change-Id: I3111210ae77f67301bb319d5364f77c52e2c4d6d
Reviewed-on: https://gerrit.libreoffice.org/40220
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index 4d2abbfe5d3c..897166caa5fc 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -36,7 +36,7 @@ namespace drawinglayer
 {
 void TextDecoratedPortionPrimitive2D::impCreateGeometryContent(
 std::vector< Primitive2DReference >& rTarget,
-basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose& rDecTrans,
+basegfx::tools::B2DHomMatrixBufferedOnDemandDecompose const & 
rDecTrans,
 const OUString& rText,
 sal_Int32 nTextPosition,
 sal_Int32 nTextLength,
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 93c6bd0033bb..efe3342b7cf9 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -342,7 +342,7 @@ namespace drawinglayer
 }
 }
 
-void VclMetafileProcessor2D::impStartSvtGraphicFill(SvtGraphicFill* 
pSvtGraphicFill)
+void VclMetafileProcessor2D::impStartSvtGraphicFill(SvtGraphicFill 
const * pSvtGraphicFill)
 {
 if(pSvtGraphicFill && !mnSvtGraphicFillCount)
 {
@@ -530,7 +530,7 @@ namespace drawinglayer
 return pRetval;
 }
 
-void 
VclMetafileProcessor2D::impStartSvtGraphicStroke(SvtGraphicStroke* 
pSvtGraphicStroke)
+void VclMetafileProcessor2D::impStartSvtGraphicStroke(SvtGraphicStroke 
const * pSvtGraphicStroke)
 {
 if(pSvtGraphicStroke && !mnSvtGraphicStrokeCount)
 {
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx 
b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
index bbd032dfd94e..50ab3ec33566 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx
@@ -79,7 +79,7 @@ namespace drawinglayer
 Gradient& o_rVCLGradient,
 const attribute::FillGradientAttribute& rFiGrAtt,
 bool bIsTransparenceGradient);
-void impStartSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
+void impStartSvtGraphicFill(SvtGraphicFill const * 
pSvtGraphicFill);
 void impEndSvtGraphicFill(SvtGraphicFill* pSvtGraphicFill);
 SvtGraphicStroke* impTryToCreateSvtGraphicStroke(
 const basegfx::B2DPolygon& rB2DPolygon,
@@ -88,7 +88,7 @@ namespace drawinglayer
 const attribute::StrokeAttribute* pStrokeAttribute,
 const attribute::LineStartEndAttribute* pStart,
 const attribute::LineStartEndAttribute* pEnd);
-void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
+void impStartSvtGraphicStroke(SvtGraphicStroke const * 
pSvtGraphicStroke);
 void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
 
 /// Convert the fWidth to the same space as its coordinates.
diff --git a/drawinglayer/source/tools/emfppath.cxx 
b/drawinglayer/source/tools/emfppath.cxx
index d68fd425994c..1cd1276f9120 100644
--- a/drawinglayer/source/tools/emfppath.cxx
+++ b/drawinglayer/source/tools/emfppath.cxx
@@ -61,7 +61,7 @@ namespace emfplushelper
 }
 
 // TODO: remove rR argument when debug code is no longer needed
-void EMFPPath::Read (SvStream& s, sal_uInt32 pathFlags, EmfPlusHelperData& 
rR)
+void EMFPPath::Read (SvStream& s, sal_uInt32 pathFlags, EmfPlusHelperData 
const & rR)
 {
 for (int i = 0; i < nPoints; i ++)
 {
diff --git a/drawinglayer/source/tools/emfppath.hxx 
b/drawinglayer/source/tools/emfppath.hxx
index 1e8c69771f59..6f2ccd10fe5c 100644
--- a/drawinglayer/source/tools/emfppath.hxx
+++ 

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

2017-05-02 Thread Noel Grandin
 drawinglayer/source/primitive2d/controlprimitive2d.cxx |4 ++--
 drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx  |4 ++--
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx   |   10 +-
 drawinglayer/source/processor2d/contourextractor2d.cxx |2 +-
 drawinglayer/source/texture/texture.cxx|   13 ++---
 include/drawinglayer/primitive2d/controlprimitive2d.hxx|2 +-
 include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx |2 +-
 include/drawinglayer/primitive2d/sceneprimitive2d.hxx  |4 ++--
 include/drawinglayer/texture/texture.hxx   |1 -
 9 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit db4802de3474af2475890c9483a3b65d3b553b2b
Author: Noel Grandin 
Date:   Fri Apr 28 14:12:48 2017 +0200

loplugin:checkunusedparams in drawinglayer

Change-Id: Ib497b284a80fae69930f226d2e70368cb9e962ef
Reviewed-on: https://gerrit.libreoffice.org/37072
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx 
b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 578637677055..3b967fb092b5 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -220,7 +220,7 @@ namespace drawinglayer
 return xRetval;
 }
 
-Primitive2DReference 
ControlPrimitive2D::createPlaceholderDecomposition(const 
geometry::ViewInformation2D& /*rViewInformation*/) const
+Primitive2DReference 
ControlPrimitive2D::createPlaceholderDecomposition() const
 {
 // create a gray placeholder hairline polygon in object size
 basegfx::B2DRange aObjectRange(0.0, 0.0, 1.0, 1.0);
@@ -242,7 +242,7 @@ namespace drawinglayer
 
 if(!xReference.is())
 {
-xReference = createPlaceholderDecomposition(rViewInformation);
+xReference = createPlaceholderDecomposition();
 }
 
 rContainer.push_back(xReference);
diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx 
b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
index 8b557ceb83c3..52642107069e 100644
--- a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx
@@ -36,7 +36,7 @@ namespace drawinglayer
 {
 namespace primitive2d
 {
-bool Embedded3DPrimitive2D::impGetShadow3D(const 
geometry::ViewInformation2D& /*rViewInformation*/) const
+bool Embedded3DPrimitive2D::impGetShadow3D() const
 {
 osl::MutexGuard aGuard( m_aMutex );
 
@@ -126,7 +126,7 @@ namespace drawinglayer
 
 // check for 3D shadows and their 2D projections. If those 
exist, they need to be
 // taken into account
-if(impGetShadow3D(rViewInformation))
+if(impGetShadow3D())
 {
 const basegfx::B2DRange 
aShadow2DRange(maShadowPrimitives.getB2DRange(rViewInformation));
 
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx 
b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index 030c6985f321..32b3bc7c4c05 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -136,7 +136,7 @@ namespace drawinglayer
 {
 namespace primitive2d
 {
-bool ScenePrimitive2D::impGetShadow3D(const 
geometry::ViewInformation2D& /*rViewInformation*/) const
+bool ScenePrimitive2D::impGetShadow3D() const
 {
 ::osl::MutexGuard aGuard( m_aMutex );
 
@@ -225,7 +225,7 @@ namespace drawinglayer
 {
 // create 2D shadows from contained 3D primitives. This creates 
the shadow primitives on demand and tells if
 // there are some or not. Do this at start, the shadow might still 
be visible even when the scene is not
-if(impGetShadow3D(rViewInformation))
+if(impGetShadow3D())
 {
 // test visibility
 const basegfx::B2DRange 
aShadow2DRange(maShadowPrimitives.getB2DRange(rViewInformation));
@@ -513,12 +513,12 @@ namespace drawinglayer
 return aRetval;
 }
 
-Primitive2DContainer ScenePrimitive2D::getShadow2D(const 
geometry::ViewInformation2D& rViewInformation) const
+Primitive2DContainer ScenePrimitive2D::getShadow2D() const
 {
 Primitive2DContainer aRetval;
 
 // create 2D shadows from contained 3D primitives
-if(impGetShadow3D(rViewInformation))
+if(impGetShadow3D())
 {
 // add extracted 2d shadows (before 3d scene creations itself)
 aRetval = maShadowPrimitives;
@@ -619,7 +619,7 @@ namespace 

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

2017-03-29 Thread Stephan Bergmann
 drawinglayer/source/animation/animationtiming.cxx  |   10 +-
 include/drawinglayer/animation/animationtiming.hxx |6 --
 2 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 225ca94608243a4fa1feeba92153dd348f4da017
Author: Stephan Bergmann 
Date:   Wed Mar 29 10:33:14 2017 +0200

Propagate proper integer type out of AnimationEntryList::impGetIndexAtTime

...after 49f8917cd4c10685645128768a2dc63043a7b398 "fix 
loplugin:loopvartoosmall"

Change-Id: I8ec284711afa2f8323462a87d30fdf4c27941b6c
Reviewed-on: https://gerrit.libreoffice.org/35830
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/drawinglayer/source/animation/animationtiming.cxx 
b/drawinglayer/source/animation/animationtiming.cxx
index 44210b9567c6..c5c39d77328f 100644
--- a/drawinglayer/source/animation/animationtiming.cxx
+++ b/drawinglayer/source/animation/animationtiming.cxx
@@ -159,16 +159,16 @@ namespace drawinglayer
 }
 
 
-sal_uInt32 AnimationEntryList::impGetIndexAtTime(double fTime, double 
) const
+AnimationEntryList::Entries::size_type 
AnimationEntryList::impGetIndexAtTime(double fTime, double ) const
 {
-size_t nIndex(0L);
+Entries::size_type nIndex(0L);
 
 while(nIndex < maEntries.size() && 
basegfx::fTools::lessOrEqual(rfAddedTime + maEntries[nIndex]->getDuration(), 
fTime))
 {
 rfAddedTime += maEntries[nIndex++]->getDuration();
 }
 
-return sal_uInt32(nIndex);
+return nIndex;
 }
 
 AnimationEntryList::AnimationEntryList()
@@ -233,7 +233,7 @@ namespace drawinglayer
 if(!basegfx::fTools::equalZero(mfDuration))
 {
 double fAddedTime(0.0);
-const sal_uInt32 nIndex(impGetIndexAtTime(fTime, fAddedTime));
+const auto nIndex(impGetIndexAtTime(fTime, fAddedTime));
 
 if(nIndex < maEntries.size())
 {
@@ -251,7 +251,7 @@ namespace drawinglayer
 if(!basegfx::fTools::equalZero(mfDuration))
 {
 double fAddedTime(0.0);
-const sal_uInt32 nIndex(impGetIndexAtTime(fTime, fAddedTime));
+const auto nIndex(impGetIndexAtTime(fTime, fAddedTime));
 
 if(nIndex < maEntries.size())
 {
diff --git a/include/drawinglayer/animation/animationtiming.hxx 
b/include/drawinglayer/animation/animationtiming.hxx
index 67d13eeede0b..f98136d1621a 100644
--- a/include/drawinglayer/animation/animationtiming.hxx
+++ b/include/drawinglayer/animation/animationtiming.hxx
@@ -91,11 +91,13 @@ namespace drawinglayer
 class DRAWINGLAYER_DLLPUBLIC AnimationEntryList : public AnimationEntry
 {
 protected:
+using Entries = std::vector;
+
 double  mfDuration;
-::std::vector< std::unique_ptr >  maEntries;
+Entries maEntries;
 
 // helpers
-sal_uInt32 impGetIndexAtTime(double fTime, double ) 
const;
+Entries::size_type impGetIndexAtTime(double fTime, double 
) const;
 
 public:
 AnimationEntryList();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-12-21 Thread Noel Grandin
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx |   14 +--
 drawinglayer/source/primitive2d/backgroundcolorprimitive2d.cxx  |4 -
 drawinglayer/source/primitive2d/baseprimitive2d.cxx |   38 
--
 drawinglayer/source/primitive2d/controlprimitive2d.cxx  |4 -
 drawinglayer/source/primitive2d/cropprimitive2d.cxx |6 -
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx|6 -
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx|   10 +-
 drawinglayer/source/primitive2d/gridprimitive2d.cxx |4 -
 drawinglayer/source/primitive2d/groupprimitive2d.cxx|4 -
 drawinglayer/source/primitive2d/helplineprimitive2d.cxx |4 -
 drawinglayer/source/primitive2d/hiddengeometryprimitive2d.cxx   |2 
 drawinglayer/source/primitive2d/patternfillprimitive2d.cxx  |4 -
 drawinglayer/source/primitive2d/polygonprimitive2d.cxx  |4 -
 drawinglayer/source/primitive2d/primitivetools2d.cxx|   16 ++--
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx|4 -
 drawinglayer/source/primitive2d/shadowprimitive2d.cxx   |4 -
 drawinglayer/source/primitive2d/texteffectprimitive2d.cxx   |4 -
 drawinglayer/source/primitive2d/unifiedtransparenceprimitive2d.cxx  |6 -
 drawinglayer/source/processor2d/hittestprocessor2d.cxx  |2 
 include/drawinglayer/primitive2d/animatedprimitive2d.hxx|6 -
 include/drawinglayer/primitive2d/backgroundcolorprimitive2d.hxx |2 
 include/drawinglayer/primitive2d/baseprimitive2d.hxx|   22 
-
 include/drawinglayer/primitive2d/controlprimitive2d.hxx |2 
 include/drawinglayer/primitive2d/cropprimitive2d.hxx|2 
 include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx   |2 
 include/drawinglayer/primitive2d/gridprimitive2d.hxx|2 
 include/drawinglayer/primitive2d/groupprimitive2d.hxx   |4 -
 include/drawinglayer/primitive2d/helplineprimitive2d.hxx|2 
 include/drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx  |2 
 include/drawinglayer/primitive2d/patternfillprimitive2d.hxx |2 
 include/drawinglayer/primitive2d/polygonprimitive2d.hxx |2 
 include/drawinglayer/primitive2d/primitivetools2d.hxx   |8 +-
 include/drawinglayer/primitive2d/sceneprimitive2d.hxx   |2 
 include/drawinglayer/primitive2d/shadowprimitive2d.hxx  |2 
 include/drawinglayer/primitive2d/texteffectprimitive2d.hxx  |2 
 include/drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx |2 
 svx/inc/sdr/primitive2d/sdrole2primitive2d.hxx  |2 
 svx/inc/sdr/primitive2d/sdrtextprimitive2d.hxx  |2 
 svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx|6 -
 svx/source/sdr/primitive2d/sdrole2primitive2d.cxx   |4 -
 svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx   |4 -
 sw/source/core/draw/dflyobj.cxx |6 -
 42 files changed, 134 insertions(+), 96 deletions(-)

New commits:
commit cc15806b527cc02c57bd92211fda259e33963106
Author: Noel Grandin 
Date:   Mon Nov 14 09:11:35 2016 +0200

convert BasePrimitive2D::get2DDecomposition to use a visitor

which lets us avoid constructing the decomposition when we are only
interesting in the bounding box, e.g. for hit testing

Change-Id: Icd8d430b75d207063f1db70e5a0822d5d82a7d00
Reviewed-on: https://gerrit.libreoffice.org/30835
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 13564af..63c2527 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -64,7 +64,7 @@ namespace drawinglayer
 return false;
 }
 
-void 
AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DContainer& rContainer, 
const geometry::ViewInformation2D& rViewInformation) const
+void 
AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& 
rVisitor, const geometry::ViewInformation2D& rViewInformation) const
 {
 if(!getChildren().empty())
 {
@@ -78,7 +78,7 @@ namespace drawinglayer
 }
 
 const Primitive2DReference xRef(getChildren()[nIndex], 
uno::UNO_QUERY_THROW);
-rContainer.push_back(xRef);
+rVisitor.append(xRef);
 }
 }
 
@@ -100,7 +100,7 @@ namespace drawinglayer
 {

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

2016-12-06 Thread Mark Page
 drawinglayer/source/animation/animationtiming.cxx|   30 ++-
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx  |6 ---
 include/drawinglayer/animation/animationtiming.hxx   |   13 +++---
 include/drawinglayer/primitive2d/animatedprimitive2d.hxx |4 +-
 4 files changed, 22 insertions(+), 31 deletions(-)

New commits:
commit 13e77648265a91ec2b7d649d30a108e4e1eff3c8
Author: Mark Page 
Date:   Mon Dec 5 12:25:30 2016 +

Use std::unique_ptr for AnimationEntry

Change-Id: Ia089be3677adadb4250003b78b7c6bc15ab8bc42
Reviewed-on: https://gerrit.libreoffice.org/31631
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/drawinglayer/source/animation/animationtiming.cxx 
b/drawinglayer/source/animation/animationtiming.cxx
index 72400c1..683c5f5 100644
--- a/drawinglayer/source/animation/animationtiming.cxx
+++ b/drawinglayer/source/animation/animationtiming.cxx
@@ -19,7 +19,7 @@
 
 #include 
 #include 
-
+#include 
 
 namespace drawinglayer
 {
@@ -46,9 +46,9 @@ namespace drawinglayer
 {
 }
 
-AnimationEntry* AnimationEntryFixed::clone() const
+std::unique_ptr AnimationEntryFixed::clone() const
 {
-return new AnimationEntryFixed(mfDuration, mfState);
+return o3tl::make_unique(mfDuration, mfState);
 }
 
 bool AnimationEntryFixed::operator==(const AnimationEntry& rCandidate) 
const
@@ -95,9 +95,9 @@ namespace drawinglayer
 {
 }
 
-AnimationEntry* AnimationEntryLinear::clone() const
+std::unique_ptr AnimationEntryLinear::clone() const
 {
-return new AnimationEntryLinear(mfDuration, mfFrequency, mfStart, 
mfStop);
+return o3tl::make_unique(mfDuration, 
mfFrequency, mfStart, mfStop);
 }
 
 bool AnimationEntryLinear::operator==(const AnimationEntry& 
rCandidate) const
@@ -178,22 +178,18 @@ namespace drawinglayer
 
 AnimationEntryList::~AnimationEntryList()
 {
-for(AnimationEntry* i : maEntries)
-{
-delete i;
-}
 }
 
-AnimationEntry* AnimationEntryList::clone() const
+std::unique_ptr AnimationEntryList::clone() const
 {
-AnimationEntryList* pNew = new AnimationEntryList();
+std::unique_ptr 
pNew(o3tl::make_unique());
 
-for(AnimationEntry* i : maEntries)
+for(const auto  : maEntries)
 {
 pNew->append(*i);
 }
 
-return pNew;
+return std::move(pNew);
 }
 
 bool AnimationEntryList::operator==(const AnimationEntry& rCandidate) 
const
@@ -277,16 +273,16 @@ namespace drawinglayer
 {
 }
 
-AnimationEntry* AnimationEntryLoop::clone() const
+std::unique_ptr AnimationEntryLoop::clone() const
 {
-AnimationEntryLoop* pNew = new AnimationEntryLoop(mnRepeat);
+std::unique_ptr 
pNew(o3tl::make_unique(mnRepeat));
 
-for(AnimationEntry* i : maEntries)
+for(const auto  : maEntries)
 {
 pNew->append(*i);
 }
 
-return pNew;
+return std::move(pNew);
 }
 
 bool AnimationEntryLoop::operator==(const AnimationEntry& rCandidate) 
const
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 713c4bd..13564af 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -33,9 +33,6 @@ namespace drawinglayer
 {
 void AnimatedSwitchPrimitive2D::setAnimationEntry(const 
animation::AnimationEntry& rNew)
 {
-// delete cloned animation description
-delete mpAnimationEntry;
-
 // clone given animation description
 mpAnimationEntry = rNew.clone();
 }
@@ -45,7 +42,6 @@ namespace drawinglayer
 const Primitive2DContainer& rChildren,
 bool bIsTextAnimation)
 :   GroupPrimitive2D(rChildren),
-mpAnimationEntry(nullptr),
 mbIsTextAnimation(bIsTextAnimation)
 {
 // clone given animation description
@@ -54,8 +50,6 @@ namespace drawinglayer
 
 AnimatedSwitchPrimitive2D::~AnimatedSwitchPrimitive2D()
 {
-// delete cloned animation description
-delete mpAnimationEntry;
 }
 
 bool AnimatedSwitchPrimitive2D::operator==(const BasePrimitive2D& 
rPrimitive) const
diff --git a/include/drawinglayer/animation/animationtiming.hxx 
b/include/drawinglayer/animation/animationtiming.hxx
index 4514349..67d13ee 100644
--- a/include/drawinglayer/animation/animationtiming.hxx
+++ b/include/drawinglayer/animation/animationtiming.hxx
@@ 

[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer include/vcl offapi/com offapi/UnoApi_offapi.mk vcl/source

2016-11-07 Thread Michael Stahl
 drawinglayer/source/primitive2d/baseprimitive2d.cxx |6 ++
 drawinglayer/source/primitive2d/bitmapprimitive2d.cxx   |6 ++
 drawinglayer/source/primitive2d/groupprimitive2d.cxx|   15 +
 drawinglayer/source/primitive2d/patternfillprimitive2d.cxx  |   15 +
 include/drawinglayer/primitive2d/baseprimitive2d.hxx|   12 +++-
 include/drawinglayer/primitive2d/bitmapprimitive2d.hxx  |3 +
 include/drawinglayer/primitive2d/groupprimitive2d.hxx   |3 +
 include/drawinglayer/primitive2d/patternfillprimitive2d.hxx |3 +
 include/vcl/svgdata.hxx |3 +
 offapi/UnoApi_offapi.mk |1 
 offapi/com/sun/star/util/XAccounting.idl|   34 
 vcl/source/gdi/impgraph.cxx |7 ++
 vcl/source/gdi/svgdata.cxx  |   29 ++
 13 files changed, 134 insertions(+), 3 deletions(-)

New commits:
commit f9028f1945e3ad87cda1b3001611632b1b424467
Author: Michael Stahl 
Date:   Mon Nov 7 15:09:31 2016 +0100

vcl: improve accounting of SVG images in graphics cache

The problem is that the graphics cache only counts the size of the SVG
text, which is stored in SvgData::maSvgDataArray.  However the
SvgData::maSequence may use a lot more memory, as it may contain
de-compressed bitmaps that are stored as base64-encoded PNGs in the SVG
text.

For example icon-themes/galaxy/brand/flat_logo.svg is 812 Ko but contains
60 Mo of bitmaps.

This may cause excessive memory usage and failure to export documents
due to OOM; according to valgrind massif, the bitmap buffers use 90% of
the heap.

Add a new interface com::sun::star::util::XAccounting, and implement
it in drawinglayer BasePrimitive2D.  VCL SvgData can't access
drawinglayer via C++ directly so this looks like the best approach.

Change-Id: I5a7c3147733e23473c1decabed24c1f79d951c7d
Reviewed-on: https://gerrit.libreoffice.org/30669
Tested-by: Jenkins 
Reviewed-by: Michael Stahl 

diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 6f89cf3..84833c3 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -71,6 +71,12 @@ namespace drawinglayer
 const geometry::ViewInformation2D 
aViewInformation(rViewParameters);
 return 
basegfx::unotools::rectangle2DFromB2DRectangle(getB2DRange(aViewInformation));
 }
+
+sal_Int64 SAL_CALL BasePrimitive2D::estimateUsage()
+throw (css::uno::RuntimeException)
+{
+return 0; // for now ignore the objects themselves
+}
 } // end of namespace primitive2d
 } // end of namespace drawinglayer
 
diff --git a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx 
b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
index 30d3cde..db75ba5 100644
--- a/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/bitmapprimitive2d.cxx
@@ -58,6 +58,12 @@ namespace drawinglayer
 return aRetval;
 }
 
+sal_Int64 SAL_CALL BitmapPrimitive2D::estimateUsage()
+throw (css::uno::RuntimeException)
+{
+return getBitmapEx().GetSizeBytes();
+}
+
 // provide unique ID
 ImplPrimitive2DIDBlock(BitmapPrimitive2D, 
PRIMITIVE2D_ID_BITMAPPRIMITIVE2D)
 
diff --git a/drawinglayer/source/primitive2d/groupprimitive2d.cxx 
b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
index d35f5b1..b5582a0 100644
--- a/drawinglayer/source/primitive2d/groupprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/groupprimitive2d.cxx
@@ -56,6 +56,21 @@ namespace drawinglayer
 return getChildren();
 }
 
+sal_Int64 SAL_CALL GroupPrimitive2D::estimateUsage()
+throw (css::uno::RuntimeException)
+{
+size_t nRet(0);
+for (auto& it : getChildren())
+{
+uno::Reference const xAcc(it, 
uno::UNO_QUERY);
+if (xAcc.is())
+{
+nRet += xAcc->estimateUsage();
+}
+}
+return nRet;
+}
+
 // provide unique ID
 ImplPrimitive2DIDBlock(GroupPrimitive2D, 
PRIMITIVE2D_ID_GROUPPRIMITIVE2D)
 
diff --git a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx 
b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
index 5d1eec1..82d397d 100644
--- a/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/patternfillprimitive2d.cxx
@@ -314,6 +314,21 @@ namespace drawinglayer
 return 
BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);

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

2016-08-25 Thread Noel Grandin
 drawinglayer/source/attribute/sdrlineattribute.cxx  |   11 +++
 include/drawinglayer/attribute/sdrlineattribute.hxx |2 ++
 2 files changed, 13 insertions(+)

New commits:
commit 065913d8aa830480961939aeec3c484c0b055f35
Author: Noel Grandin 
Date:   Thu Aug 25 11:43:30 2016 +0200

cid#1371309 Missing move assignment operator

Change-Id: Ic00f39793f0341820ccce912f4350644a90104c5

diff --git a/drawinglayer/source/attribute/sdrlineattribute.cxx 
b/drawinglayer/source/attribute/sdrlineattribute.cxx
index aac95d7..8541aa4 100644
--- a/drawinglayer/source/attribute/sdrlineattribute.cxx
+++ b/drawinglayer/source/attribute/sdrlineattribute.cxx
@@ -124,6 +124,11 @@ namespace drawinglayer
 {
 }
 
+SdrLineAttribute::SdrLineAttribute(SdrLineAttribute&& rCandidate)
+:   mpSdrLineAttribute(rCandidate.mpSdrLineAttribute)
+{
+}
+
 SdrLineAttribute::~SdrLineAttribute()
 {
 }
@@ -139,6 +144,12 @@ namespace drawinglayer
 return *this;
 }
 
+SdrLineAttribute& SdrLineAttribute::operator=(SdrLineAttribute&& 
rCandidate)
+{
+mpSdrLineAttribute = rCandidate.mpSdrLineAttribute;
+return *this;
+}
+
 bool SdrLineAttribute::operator==(const SdrLineAttribute& rCandidate) 
const
 {
 // tdf#87509 default attr is always != non-default attr, even with 
same values
diff --git a/include/drawinglayer/attribute/sdrlineattribute.hxx 
b/include/drawinglayer/attribute/sdrlineattribute.hxx
index af1e156..f57289d 100644
--- a/include/drawinglayer/attribute/sdrlineattribute.hxx
+++ b/include/drawinglayer/attribute/sdrlineattribute.hxx
@@ -62,7 +62,9 @@ namespace drawinglayer
 double fFullDotDashLen);
 SdrLineAttribute();
 SdrLineAttribute(const SdrLineAttribute& rCandidate);
+SdrLineAttribute(SdrLineAttribute&& rCandidate);
 SdrLineAttribute& operator=(const SdrLineAttribute& rCandidate);
+SdrLineAttribute& operator=(SdrLineAttribute&& rCandidate);
 ~SdrLineAttribute();
 
 // checks if the incarnation is default constructed
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-08-25 Thread Noel Grandin
 drawinglayer/source/attribute/strokeattribute.cxx  |6 ++
 include/drawinglayer/attribute/strokeattribute.hxx |1 +
 2 files changed, 7 insertions(+)

New commits:
commit 19828cc01ff1e3421907f77863a464e87c70f57c
Author: Noel Grandin 
Date:   Thu Aug 25 11:41:01 2016 +0200

cid#1371315 Missing move assignment operator

Change-Id: I9da0ffe856a0a40094c1c553bb2c5e05d8d3ef5d

diff --git a/drawinglayer/source/attribute/strokeattribute.cxx 
b/drawinglayer/source/attribute/strokeattribute.cxx
index 932be14c..c5b2d8d 100644
--- a/drawinglayer/source/attribute/strokeattribute.cxx
+++ b/drawinglayer/source/attribute/strokeattribute.cxx
@@ -107,6 +107,12 @@ namespace drawinglayer
 return *this;
 }
 
+StrokeAttribute& StrokeAttribute::operator=(StrokeAttribute&& 
rCandidate)
+{
+mpStrokeAttribute = rCandidate.mpStrokeAttribute;
+return *this;
+}
+
 bool StrokeAttribute::operator==(const StrokeAttribute& rCandidate) 
const
 {
 // tdf#87509 default attr is always != non-default attr, even with 
same values
diff --git a/include/drawinglayer/attribute/strokeattribute.hxx 
b/include/drawinglayer/attribute/strokeattribute.hxx
index 69576ed..4ca3955 100644
--- a/include/drawinglayer/attribute/strokeattribute.hxx
+++ b/include/drawinglayer/attribute/strokeattribute.hxx
@@ -52,6 +52,7 @@ namespace drawinglayer
 StrokeAttribute();
 StrokeAttribute(const StrokeAttribute& rCandidate);
 StrokeAttribute& operator=(const StrokeAttribute& rCandidate);
+StrokeAttribute& operator=(StrokeAttribute&& rCandidate);
 ~StrokeAttribute();
 
 // checks if the incarnation is default constructed
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2016-06-26 Thread Noel Grandin
 drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx  |   65 
 drawinglayer/source/processor2d/hittestprocessor2d.cxx  |6 -
 drawinglayer/source/processor3d/cutfindprocessor3d.cxx  |   20 ---
 include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx |5 
 include/drawinglayer/processor2d/hittestprocessor2d.hxx |9 -
 include/drawinglayer/processor3d/cutfindprocessor3d.hxx |6 -
 6 files changed, 29 insertions(+), 82 deletions(-)

New commits:
commit db39c653e5de92bc371040a3f81cc5c4ea6dedf3
Author: Noel Grandin 
Date:   Sat Jun 25 14:55:09 2016 +0200

loplugin:singlevalfields in drawinglayer

Change-Id: I19f50b0afa624391bd0d8ada7afca822298e10cc
Reviewed-on: https://gerrit.libreoffice.org/26655
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx 
b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
index 3c2db2f..5cb7232 100644
--- a/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx
@@ -66,48 +66,37 @@ namespace drawinglayer
 // create a mapping from content to object.
 basegfx::B2DHomMatrix aPageTrans;
 
-if(getKeepAspectRatio())
+// #i101075# when keeping the aspect ratio is wanted, it 
is necessary to calculate
+// an equidistant scaling in X and Y and a corresponding 
translation to
+// center the output. Calculate needed scale factors
+const double fScaleX(aScale.getX() / getContentWidth());
+const double fScaleY(aScale.getY() / getContentHeight());
+
+// to keep the aspect, use the smaller scale and adapt 
missing size by translation
+if(fScaleX < fScaleY)
 {
-// #i101075# when keeping the aspect ratio is wanted, 
it is necessary to calculate
-// an equidistant scaling in X and Y and a 
corresponding translation to
-// center the output. Calculate needed scale factors
-const double fScaleX(aScale.getX() / 
getContentWidth());
-const double fScaleY(aScale.getY() / 
getContentHeight());
-
-// to keep the aspect, use the smaller scale and adapt 
missing size by translation
-if(fScaleX < fScaleY)
-{
-// height needs to be adapted
-const double fNeededHeight(aScale.getY() / 
fScaleX);
-const double fSpaceToAdd(fNeededHeight - 
getContentHeight());
-
-aPageTrans.translate(0.0, fSpaceToAdd * 0.5);
-aPageTrans.scale(fScaleX, aScale.getY() / 
fNeededHeight);
-}
-else
-{
-// width needs to be adapted
-const double fNeededWidth(aScale.getX() / fScaleY);
-const double fSpaceToAdd(fNeededWidth - 
getContentWidth());
-
-aPageTrans.translate(fSpaceToAdd * 0.5, 0.0);
-aPageTrans.scale(aScale.getX() / fNeededWidth, 
fScaleY);
-}
-
-// add the missing object transformation aspects
-const basegfx::B2DHomMatrix 
aCombined(basegfx::tools::createShearXRotateTranslateB2DHomMatrix(
-fShearX, fRotate, aTranslate.getX(), 
aTranslate.getY()));
-aPageTrans = aCombined * aPageTrans;
+// height needs to be adapted
+const double fNeededHeight(aScale.getY() / fScaleX);
+const double fSpaceToAdd(fNeededHeight - 
getContentHeight());
+
+aPageTrans.translate(0.0, fSpaceToAdd * 0.5);
+aPageTrans.scale(fScaleX, aScale.getY() / 
fNeededHeight);
 }
 else
 {
-// completely scale to PageObject size. Scale to unit 
size.
-aPageTrans.scale(1.0/ getContentWidth(), 1.0 / 
getContentHeight());
+// width needs to be adapted
+const double fNeededWidth(aScale.getX() / fScaleY);
+const double fSpaceToAdd(fNeededWidth - 
getContentWidth());
 
-// apply object matrix
-aPageTrans *= getTransform();
+aPageTrans.translate(fSpaceToAdd * 0.5, 0.0);
+aPageTrans.scale(aScale.getX() / fNeededWidth, 
fScaleY);
  

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

2016-06-10 Thread Armin Le Grand
 drawinglayer/source/primitive2d/animatedprimitive2d.cxx  |9 
 drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx |  516 ---
 include/drawinglayer/primitive2d/animatedprimitive2d.hxx |9 
 3 files changed, 395 insertions(+), 139 deletions(-)

New commits:
commit 285744fef87f4ca0278834b97d7f618bdba5f4c0
Author: Armin Le Grand 
Date:   Fri Jun 3 13:58:40 2016 +0200

tdf#99519 Added more intelligent handling of animated GIFs

Isolated to a single Primitive2D class based on the AnimatedSwitch-
Primitive2D which does the specializing in one place. Buffers small
GIFs completely, handles 1st frame always buffered, huge GIFs get
animated by just playing he next frame.
To reach more with the current approach we would have to re-implement
AnimatedGIF import, replay it internally on a sys-specific Surface
and blit the current content (with alpha) to our display

Change-Id: I46c3325fa7936df73bea9a9284a0421f1475a34b
Reviewed-on: https://gerrit.libreoffice.org/26103
Tested-by: Jenkins 
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 5533b26..2fa2916 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -31,6 +31,15 @@ namespace drawinglayer
 {
 namespace primitive2d
 {
+void AnimatedSwitchPrimitive2D::setAnimationEntry(const 
animation::AnimationEntry& rNew)
+{
+// delete cloned animation description
+delete mpAnimationEntry;
+
+// clone given animation description
+mpAnimationEntry = rNew.clone();
+}
+
 AnimatedSwitchPrimitive2D::AnimatedSwitchPrimitive2D(
 const animation::AnimationEntry& rAnimationEntry,
 const Primitive2DContainer& rChildren,
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx 
b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index b51fc91..66a67d4 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -37,152 +38,413 @@
 #include 
 #include 
 
-namespace
+namespace drawinglayer
 {
-struct animationStep
+namespace primitive2d
 {
-BitmapExmaBitmapEx;
-sal_uInt32  mnTime;
-};
+class AnimatedGraphicPrimitive2D : public AnimatedSwitchPrimitive2D
+{
+private:
+/// the geometric definition
+basegfx::B2DHomMatrix   maTransform;
 
-class animatedBitmapExPreparator
-{
-::Animation maAnimation;
-::std::vector< animationStep >  maSteps;
+/** the Graphic with all its content possibilities, here only
+animated is allowed and gets checked by isValidData().
+an instance of Graphic is used here since it's ref-counted
+and thus a safe cpoy for now
+ */
+const Graphic   maGraphic;
 
-sal_uInt32 generateStepTime(sal_uInt32 nIndex) const;
+/// local animation processing data, excerpt from maGraphic
+::Animation maAnimation;
 
-public:
-explicit animatedBitmapExPreparator(const Graphic& rGraphic);
+/// the on-demand created VirtualDevices for frame creation
+ScopedVclPtrInstance< VirtualDevice >   maVirtualDevice;
+ScopedVclPtrInstance< VirtualDevice >   maVirtualDeviceMask;
 
-sal_uInt32 count() const { return maSteps.size(); }
-sal_uInt32 loopCount() const { return 
(sal_uInt32)maAnimation.GetLoopCount(); }
-sal_uInt32 stepTime(sal_uInt32 a) const { return maSteps[a].mnTime; }
-const BitmapEx& stepBitmapEx(sal_uInt32 a) const { return 
maSteps[a].maBitmapEx; }
-};
+// index of the next frame that would be regularly prepared
+sal_uInt32  mnNextFrameToPrepare;
 
-sal_uInt32 animatedBitmapExPreparator::generateStepTime(sal_uInt32 nIndex) 
const
-{
-const AnimationBitmap& rAnimBitmap = 
maAnimation.Get(sal_uInt16(nIndex));
-sal_uInt32 nWaitTime(rAnimBitmap.nWait * 10);
+/// buffering of 1st frame (always active)
+Primitive2DReferencemaBufferedFirstFrame;
 
-// Take care of special value for MultiPage TIFFs. ATM these shall just
-// show their first page. Later we will offer some 

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

2016-05-23 Thread Noel Grandin
 drawinglayer/source/attribute/fillgradientattribute.cxx |2 -
 drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx |   18 ++--
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx |   14 -
 drawinglayer/source/primitive3d/textureprimitive3d.cxx  |2 -
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx  |   12 
 drawinglayer/source/processor3d/defaultprocessor3d.cxx  |   12 
 include/drawinglayer/attribute/fillgradientattribute.hxx|   14 -
 svx/source/sdr/primitive2d/sdrattributecreator.cxx  |   12 
 svx/source/xoutdev/xtabgrdt.cxx |   14 -
 sw/source/uibase/docvw/HeaderFooterWin.cxx  |2 -
 sw/source/uibase/docvw/ShadowOverlayObject.cxx  |6 ++--
 11 files changed, 54 insertions(+), 54 deletions(-)

New commits:
commit 5c5209c2d9f2626d2c024493a7f9cde9577e6261
Author: Noel Grandin 
Date:   Sat May 21 19:15:22 2016 +0200

Convert GradientStyle to scoped enum

Change-Id: I1da151dd25648e363ba88bf88caa3e820f0ee424
Reviewed-on: https://gerrit.libreoffice.org/25270
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/attribute/fillgradientattribute.cxx 
b/drawinglayer/source/attribute/fillgradientattribute.cxx
index c91e40c..5cc76e3 100644
--- a/drawinglayer/source/attribute/fillgradientattribute.cxx
+++ b/drawinglayer/source/attribute/fillgradientattribute.cxx
@@ -60,7 +60,7 @@ namespace drawinglayer
 }
 
 ImpFillGradientAttribute()
-:   meStyle(GRADIENTSTYLE_LINEAR),
+:   meStyle(GradientStyle::Linear),
 mfBorder(0.0),
 mfOffsetX(0.0),
 mfOffsetY(0.0),
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index b9e4132..4fba3c8 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -64,7 +64,7 @@ namespace drawinglayer
 
 switch(getFillGradient().getStyle())
 {
-case attribute::GRADIENTSTYLE_LINEAR:
+case attribute::GradientStyle::Linear:
 {
 texture::GeoTexSvxGradientLinear aGradient(
 getDefinitionRange(),
@@ -77,7 +77,7 @@ namespace drawinglayer
 aGradient.appendTransformationsAndColors(rEntries, 
rOuterColor);
 break;
 }
-case attribute::GRADIENTSTYLE_AXIAL:
+case attribute::GradientStyle::Axial:
 {
 texture::GeoTexSvxGradientAxial aGradient(
 getDefinitionRange(),
@@ -90,7 +90,7 @@ namespace drawinglayer
 aGradient.appendTransformationsAndColors(rEntries, 
rOuterColor);
 break;
 }
-case attribute::GRADIENTSTYLE_RADIAL:
+case attribute::GradientStyle::Radial:
 {
 texture::GeoTexSvxGradientRadial aGradient(
 getDefinitionRange(),
@@ -103,7 +103,7 @@ namespace drawinglayer
 aGradient.appendTransformationsAndColors(rEntries, 
rOuterColor);
 break;
 }
-case attribute::GRADIENTSTYLE_ELLIPTICAL:
+case attribute::GradientStyle::Elliptical:
 {
 texture::GeoTexSvxGradientElliptical aGradient(
 getDefinitionRange(),
@@ -117,7 +117,7 @@ namespace drawinglayer
 aGradient.appendTransformationsAndColors(rEntries, 
rOuterColor);
 break;
 }
-case attribute::GRADIENTSTYLE_SQUARE:
+case attribute::GradientStyle::Square:
 {
 texture::GeoTexSvxGradientSquare aGradient(
 getDefinitionRange(),
@@ -131,7 +131,7 @@ namespace drawinglayer
 aGradient.appendTransformationsAndColors(rEntries, 
rOuterColor);
 break;
 }
-case attribute::GRADIENTSTYLE_RECT:
+case attribute::GradientStyle::Rect:
 {
 texture::GeoTexSvxGradientRect aGradient(
 getDefinitionRange(),
@@ -252,13 +252,13 @@ namespace drawinglayer
 
 switch(getFillGradient().getStyle())
 {
-case attribute::GRADIENTSTYLE_RADIAL:
-case attribute::GRADIENTSTYLE_ELLIPTICAL:
+case attribute::GradientStyle::Radial:
+case attribute::GradientStyle::Elliptical:
 {
 aUnitPolygon 

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

2016-05-23 Thread Noel Grandin
 drawinglayer/source/attribute/fillhatchattribute.cxx|2 +-
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx|6 +++---
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx |8 
 drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx |6 +++---
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx  |   10 +-
 drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |6 +++---
 drawinglayer/source/texture/texture3d.cxx   |4 ++--
 include/drawinglayer/attribute/fillhatchattribute.hxx   |8 
 svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx|2 +-
 svx/source/sdr/overlay/overlaytools.cxx |2 +-
 svx/source/sdr/primitive2d/sdrattributecreator.cxx  |6 +++---
 svx/source/xoutdev/xtabhtch.cxx |8 
 12 files changed, 34 insertions(+), 34 deletions(-)

New commits:
commit 4a98af674c90de499909174af409d0e29cc155e2
Author: Noel Grandin 
Date:   Sat May 21 19:26:41 2016 +0200

Convert HatchStyle to scoped enum

Change-Id: I27878a67457d32e6922dfb6da73f896ff6ab1d01
Reviewed-on: https://gerrit.libreoffice.org/25271
Tested-by: Jenkins 
Reviewed-by: Noel Grandin 

diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx 
b/drawinglayer/source/attribute/fillhatchattribute.cxx
index e3dd831..e55e1f7 100644
--- a/drawinglayer/source/attribute/fillhatchattribute.cxx
+++ b/drawinglayer/source/attribute/fillhatchattribute.cxx
@@ -56,7 +56,7 @@ namespace drawinglayer
 }
 
 ImpFillHatchAttribute()
-:   meStyle(HATCHSTYLE_SINGLE),
+:   meStyle(HatchStyle::Single),
 mfDistance(0.0),
 mfAngle(0.0),
 maColor(basegfx::BColor()),
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx 
b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index a253c5f..5e4a7cc 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -62,7 +62,7 @@ namespace drawinglayer
 // get hatch transformations
 switch(getFillHatch().getStyle())
 {
-case attribute::HATCHSTYLE_TRIPLE:
+case attribute::HatchStyle::Triple:
 {
 // rotated 45 degrees
 texture::GeoTexSvxHatch aHatch(
@@ -75,7 +75,7 @@ namespace drawinglayer
 
 SAL_FALLTHROUGH;
 }
-case attribute::HATCHSTYLE_DOUBLE:
+case attribute::HatchStyle::Double:
 {
 // rotated 90 degrees
 texture::GeoTexSvxHatch aHatch(
@@ -88,7 +88,7 @@ namespace drawinglayer
 
 SAL_FALLTHROUGH;
 }
-case attribute::HATCHSTYLE_SINGLE:
+case attribute::HatchStyle::Single:
 {
 // angle as given
 texture::GeoTexSvxHatch aHatch(
diff --git a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx 
b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
index ea58a15..3f118a9 100644
--- a/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/metafileprimitive2d.cxx
@@ -900,23 +900,23 @@ namespace
  */
 drawinglayer::attribute::FillHatchAttribute createFillHatchAttribute(const 
Hatch& rHatch)
 {
-drawinglayer::attribute::HatchStyle 
aHatchStyle(drawinglayer::attribute::HATCHSTYLE_SINGLE);
+drawinglayer::attribute::HatchStyle 
aHatchStyle(drawinglayer::attribute::HatchStyle::Single);
 
 switch(rHatch.GetStyle())
 {
 default : // case HATCH_SINGLE :
 {
-aHatchStyle = drawinglayer::attribute::HATCHSTYLE_SINGLE;
+aHatchStyle = drawinglayer::attribute::HatchStyle::Single;
 break;
 }
 case HATCH_DOUBLE :
 {
-aHatchStyle = drawinglayer::attribute::HATCHSTYLE_DOUBLE;
+aHatchStyle = drawinglayer::attribute::HatchStyle::Double;
 break;
 }
 case HATCH_TRIPLE :
 {
-aHatchStyle = drawinglayer::attribute::HATCHSTYLE_TRIPLE;
+aHatchStyle = drawinglayer::attribute::HatchStyle::Triple;
 break;
 }
 }
diff --git a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx 
b/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
index a54c9df..43ae926 100644
--- a/drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx
+++ 

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

2016-05-01 Thread Armin Le Grand
 drawinglayer/source/attribute/fillgraphicattribute.cxx  |5 +++
 drawinglayer/source/attribute/fontattribute.cxx |5 +++
 drawinglayer/source/attribute/materialattribute3d.cxx   |5 +++
 drawinglayer/source/attribute/sdrlightattribute3d.cxx   |   17 ++
 drawinglayer/source/attribute/sdrobjectattribute3d.cxx  |   25 
 include/drawinglayer/attribute/fontattribute.hxx|3 +
 include/drawinglayer/attribute/materialattribute3d.hxx  |3 +
 include/drawinglayer/attribute/sdrlightattribute3d.hxx  |4 ++
 include/drawinglayer/attribute/sdrobjectattribute3d.hxx |4 ++
 9 files changed, 71 insertions(+)

New commits:
commit 75d9f7a4332f8dec141159c88fe70a9f18a5daae
Author: Armin Le Grand 
Date:   Fri Apr 29 17:10:18 2016 +0200

Complete drawinglayer attributes

All DrawingLayer Atrributes used for ptimitives need a default
constructor. Since the o3tl::cow_wrapper is used in combination
with a static default incarnation of the impl class it is better
to define that. Also needed is a working isDefault() implementation
that compares the impl class to the static default. Added missing
stuff for this.

Change-Id: I98e9fee7343112cd979b972229423ac0ef3994a6
Reviewed-on: https://gerrit.libreoffice.org/24496
Tested-by: Jenkins 
Reviewed-by: Armin Le Grand 

diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx 
b/drawinglayer/source/attribute/fillgraphicattribute.cxx
index 89422be..6d70e46 100644
--- a/drawinglayer/source/attribute/fillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx
@@ -98,6 +98,11 @@ namespace drawinglayer
 {
 }
 
+FillGraphicAttribute::FillGraphicAttribute()
+:   mpFillGraphicAttribute(theGlobalDefault::get())
+{
+}
+
 FillGraphicAttribute::FillGraphicAttribute(const FillGraphicAttribute& 
rCandidate)
 :   mpFillGraphicAttribute(rCandidate.mpFillGraphicAttribute)
 {
diff --git a/drawinglayer/source/attribute/fontattribute.cxx 
b/drawinglayer/source/attribute/fontattribute.cxx
index 20d743d..110404e 100644
--- a/drawinglayer/source/attribute/fontattribute.cxx
+++ b/drawinglayer/source/attribute/fontattribute.cxx
@@ -144,6 +144,11 @@ namespace drawinglayer
 {
 }
 
+bool FontAttribute::isDefault() const
+{
+return mpFontAttribute.same_object(theGlobalDefault::get());
+}
+
 FontAttribute& FontAttribute::operator=(const FontAttribute& 
rCandidate)
 {
 mpFontAttribute = rCandidate.mpFontAttribute;
diff --git a/drawinglayer/source/attribute/materialattribute3d.cxx 
b/drawinglayer/source/attribute/materialattribute3d.cxx
index 59d39a0..72fce36 100644
--- a/drawinglayer/source/attribute/materialattribute3d.cxx
+++ b/drawinglayer/source/attribute/materialattribute3d.cxx
@@ -110,6 +110,11 @@ namespace drawinglayer
 {
 }
 
+bool MaterialAttribute3D::isDefault() const
+{
+return mpMaterialAttribute3D.same_object(theGlobalDefault::get());
+}
+
 MaterialAttribute3D& MaterialAttribute3D::operator=(const 
MaterialAttribute3D& rCandidate)
 {
 mpMaterialAttribute3D = rCandidate.mpMaterialAttribute3D;
diff --git a/drawinglayer/source/attribute/sdrlightattribute3d.cxx 
b/drawinglayer/source/attribute/sdrlightattribute3d.cxx
index e249a88..868bc9c 100644
--- a/drawinglayer/source/attribute/sdrlightattribute3d.cxx
+++ b/drawinglayer/source/attribute/sdrlightattribute3d.cxx
@@ -47,6 +47,13 @@ namespace drawinglayer
 {
 }
 
+ImpSdr3DLightAttribute()
+:   maColor(),
+maDirection(),
+mbSpecular(false)
+{
+}
+
 // data read access
 const basegfx::BColor& getColor() const { return maColor; }
 const basegfx::B3DVector& getDirection() const { return 
maDirection; }
@@ -75,6 +82,11 @@ namespace drawinglayer
 {
 }
 
+Sdr3DLightAttribute::Sdr3DLightAttribute()
+:   mpSdr3DLightAttribute(theGlobalDefault::get())
+{
+}
+
 Sdr3DLightAttribute::Sdr3DLightAttribute(const Sdr3DLightAttribute& 
rCandidate)
 :   mpSdr3DLightAttribute(rCandidate.mpSdr3DLightAttribute)
 {
@@ -84,6 +96,11 @@ namespace drawinglayer
 {
 }
 
+bool Sdr3DLightAttribute::isDefault() const
+{
+return mpSdr3DLightAttribute.same_object(theGlobalDefault::get());
+}
+
 Sdr3DLightAttribute& Sdr3DLightAttribute::operator=(const 
Sdr3DLightAttribute& rCandidate)
 {
 mpSdr3DLightAttribute = rCandidate.mpSdr3DLightAttribute;
diff --git a/drawinglayer/source/attribute/sdrobjectattribute3d.cxx 

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

2016-01-14 Thread Miklos Vajna
 drawinglayer/source/processor2d/hittestprocessor2d.cxx  |   11 ---
 include/drawinglayer/processor2d/hittestprocessor2d.hxx |6 +-
 include/svx/sdrhittesthelper.hxx|1 -
 include/svx/svdmodel.hxx|2 --
 svx/source/sdr/overlay/overlayobjectlist.cxx|8 +++-
 svx/source/svdraw/sdrhittesthelper.cxx  |6 ++
 svx/source/svdraw/svdedxv.cxx   |8 
 svx/source/svdraw/svdmodel.cxx  |5 -
 svx/source/svdraw/svdmrkv.cxx   |3 ++-
 svx/source/svdraw/svdpagv.cxx   |4 ++--
 svx/source/svdraw/svdpntv.cxx   |6 +++---
 svx/source/table/tablecontroller.cxx|9 +
 12 files changed, 26 insertions(+), 43 deletions(-)

New commits:
commit 1859acbc7c9f2548f835212f030fd1d09335ae79
Author: Miklos Vajna 
Date:   Fri Jan 15 07:43:49 2016 +0100

svx: remove now unused SdrModel::isTiledRendering()

Change-Id: I8d3c6b1de2db57e39678a7e57de6e015c72719ec

diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx 
b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
index 190778e..4853a28 100644
--- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx
@@ -32,8 +32,7 @@
 #include 
 #include 
 #include 
-
-
+#include 
 
 namespace drawinglayer
 {
@@ -42,16 +41,14 @@ namespace drawinglayer
 HitTestProcessor2D::HitTestProcessor2D(const 
geometry::ViewInformation2D& rViewInformation,
 const basegfx::B2DPoint& rLogicHitPosition,
 double fLogicHitTolerance,
-bool bHitTextOnly,
-bool bTiledRendering)
+bool bHitTextOnly)
 :   BaseProcessor2D(rViewInformation),
 maDiscreteHitPosition(),
 mfDiscreteHitTolerance(0.0),
 mbHit(false),
 mbHitToleranceUsed(false),
 mbUseInvisiblePrimitiveContent(true),
-mbHitTextOnly(bHitTextOnly),
-mbTiledRendering(bTiledRendering)
+mbHitTextOnly(bHitTextOnly)
 {
 // init hit tolerance
 mfDiscreteHitTolerance = fLogicHitTolerance;
@@ -444,7 +441,7 @@ namespace drawinglayer
 const Size& rSizePixel(rBitmapEx.GetSizePixel());
 
 // When tiled rendering, don't bother with the 
pixel size of the candidate.
-if(rSizePixel.Width() && rSizePixel.Height() && 
!mbTiledRendering)
+if(rSizePixel.Width() && rSizePixel.Height() && 
!comphelper::LibreOfficeKit::isActive())
 {
 basegfx::B2DHomMatrix aBackTransform(
 
getViewInformation2D().getObjectToViewTransformation() *
diff --git a/include/drawinglayer/processor2d/hittestprocessor2d.hxx 
b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
index 96e9d9c..9f78f44 100644
--- a/include/drawinglayer/processor2d/hittestprocessor2d.hxx
+++ b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
@@ -61,9 +61,6 @@ namespace drawinglayer
 /// flag to concentrate on text hits only
 boolmbHitTextOnly : 1;
 
-/// If we are tiled rendering.
-bool mbTiledRendering;
-
 /// tooling methods
 void processBasePrimitive2D(const primitive2d::BasePrimitive2D& 
rCandidate) override;
 bool checkHairlineHitWithTolerance(
@@ -79,8 +76,7 @@ namespace drawinglayer
 const geometry::ViewInformation2D& rViewInformation,
 const basegfx::B2DPoint& rLogicHitPosition,
 double fLogicHitTolerance,
-bool bHitTextOnly,
-bool bTiledRendering);
+bool bHitTextOnly);
 virtual ~HitTestProcessor2D();
 
 /// data read access
diff --git a/include/svx/sdrhittesthelper.hxx b/include/svx/sdrhittesthelper.hxx
index aaabfc7..63e0dec 100644
--- a/include/svx/sdrhittesthelper.hxx
+++ b/include/svx/sdrhittesthelper.hxx
@@ -56,7 +56,6 @@ SVX_DLLPUBLIC SdrObject* SdrObjListPrimitiveHit(
 // the pure HitTest based on a VOC
 
 SVX_DLLPUBLIC bool ViewObjectContactPrimitiveHit(
-const SdrObject& rObject,
 const sdr::contact::ViewObjectContact& rVOC,
 const basegfx::B2DPoint& rHitPosition,
 double fLogicHitTolerance,
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index b251a63..4288fac 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -339,8 +339,6 @@ public:
 OutputDevice*GetRefDevice() const   { return 
pRefOutDev.get(); }
 /// Set if we are doing tiled rendering.
 void setTiledRendering(bool 

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

2015-12-15 Thread Noel Grandin
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |   15 ---
 include/drawinglayer/primitive2d/baseprimitive2d.hxx |   12 
 2 files changed, 16 insertions(+), 11 deletions(-)

New commits:
commit 9c9291255f474b396813256050b84ffd425002aa
Author: Noel Grandin 
Date:   Fri Dec 11 14:59:12 2015 +0200

create a move append method for Primitive2DContainer

since it is fairly common to append temporaries.

Change-Id: I920daf8539e42fc9fe313af48fdb34ee4aaf908d
Reviewed-on: https://gerrit.libreoffice.org/20637
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 1f5e5dd..795c609 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -312,16 +312,17 @@ namespace drawinglayer
 {
 insert(end(), rSource.begin(), rSource.end());
 }
-/*
+
 void Primitive2DContainer::append(Primitive2DContainer&& rSource)
 {
-resize(size() + rSource.size());
-memcpy(data() + size(),
-   rSource.data(),
-   rSource.size() * sizeof(Primitive2DReference));
-memset(reinterpret_cast(rSource.data()), 0, rSource.size() 
* sizeof(Primitive2DReference));
+size_t n = size();
+resize(n + rSource.size());
+for (size_t i = 0; i(count) {}
-Primitive2DContainer( const Primitive2DContainer& other ) : 
std::vector< Primitive2DReference >(other) {}
-Primitive2DContainer( const std::vector< Primitive2DReference >& other 
) : std::vector< Primitive2DReference >(other) {}
-Primitive2DContainer( std::initializer_list init 
) : std::vector< Primitive2DReference >(init) {}
+explicit Primitive2DContainer( size_type count ) : vector(count) {}
+Primitive2DContainer( const Primitive2DContainer& other ) : 
vector(other) {}
+Primitive2DContainer( const Primitive2DContainer&& other ) : 
vector(other) {}
+Primitive2DContainer( const vector< Primitive2DReference >& other ) : 
vector(other) {}
+Primitive2DContainer( std::initializer_list init 
) : vector(init) {}
 
 void append(const Primitive2DContainer& rSource);
 void append(const Primitive2DSequence& rSource);
+void append(Primitive2DContainer&& rSource);
+Primitive2DContainer& operator=(const Primitive2DContainer& r) { 
vector::operator=(r); return *this; }
+Primitive2DContainer& operator=(const Primitive2DContainer&& r) { 
vector::operator=(r); return *this; }
 bool operator==(const Primitive2DContainer& rB) const;
 bool operator!=(const Primitive2DContainer& rB) const { return 
!operator==(rB); }
 basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& 
aViewInformation) const;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2015-12-15 Thread Noel Grandin
 drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx  |8 -
 drawinglayer/source/primitive2d/sceneprimitive2d.cxx   |   10 -
 drawinglayer/source/primitive3d/baseprimitive3d.cxx|   80 
--
 drawinglayer/source/primitive3d/groupprimitive3d.cxx   |6 
 drawinglayer/source/primitive3d/hatchtextureprimitive3d.cxx|   22 +-
 drawinglayer/source/primitive3d/hiddengeometryprimitive3d.cxx  |8 -
 drawinglayer/source/primitive3d/modifiedcolorprimitive3d.cxx   |2 
 drawinglayer/source/primitive3d/polygonprimitive3d.cxx |6 
 drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx |   56 +++
 drawinglayer/source/primitive3d/sdrcubeprimitive3d.cxx |   14 -
 drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx|   34 ++--
 drawinglayer/source/primitive3d/sdrextrudeprimitive3d.cxx  |   28 +--
 drawinglayer/source/primitive3d/sdrlatheprimitive3d.cxx|   28 +--
 drawinglayer/source/primitive3d/sdrpolypolygonprimitive3d.cxx  |   14 -
 drawinglayer/source/primitive3d/sdrsphereprimitive3d.cxx   |   14 -
 drawinglayer/source/primitive3d/shadowprimitive3d.cxx  |2 
 drawinglayer/source/primitive3d/textureprimitive3d.cxx |   18 +-
 drawinglayer/source/primitive3d/transformprimitive3d.cxx   |4 
 drawinglayer/source/processor2d/hittestprocessor2d.cxx |7 
 drawinglayer/source/processor3d/baseprocessor3d.cxx|   11 -
 drawinglayer/source/processor3d/cutfindprocessor3d.cxx |8 -
 drawinglayer/source/processor3d/defaultprocessor3d.cxx |   16 +-
 drawinglayer/source/processor3d/geometry2dextractor.cxx|8 -
 include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx |6 
 include/drawinglayer/primitive2d/sceneprimitive2d.hxx  |6 
 include/drawinglayer/primitive3d/baseprimitive3d.hxx   |   39 +++-
 include/drawinglayer/primitive3d/groupprimitive3d.hxx  |8 -
 include/drawinglayer/primitive3d/hatchtextureprimitive3d.hxx   |   12 -
 include/drawinglayer/primitive3d/hiddengeometryprimitive3d.hxx |4 
 include/drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx  |2 
 include/drawinglayer/primitive3d/polygonprimitive3d.hxx|2 
 include/drawinglayer/primitive3d/polygontubeprimitive3d.hxx|   10 -
 include/drawinglayer/primitive3d/sdrcubeprimitive3d.hxx|2 
 include/drawinglayer/primitive3d/sdrdecompositiontools3d.hxx   |   10 -
 include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx |4 
 include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx   |4 
 include/drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx |2 
 include/drawinglayer/primitive3d/sdrsphereprimitive3d.hxx  |2 
 include/drawinglayer/primitive3d/shadowprimitive3d.hxx |2 
 include/drawinglayer/primitive3d/textureprimitive3d.hxx|   12 -
 include/drawinglayer/primitive3d/transformprimitive3d.hxx  |2 
 include/drawinglayer/processor3d/baseprocessor3d.hxx   |2 
 include/svx/sdr/contact/viewcontactofe3d.hxx   |   16 +-
 include/svx/sdr/contact/viewcontactofe3dscene.hxx  |2 
 svx/inc/sdr/contact/viewcontactofe3dcube.hxx   |2 
 svx/inc/sdr/contact/viewcontactofe3dextrude.hxx|2 
 svx/inc/sdr/contact/viewcontactofe3dlathe.hxx  |2 
 svx/inc/sdr/contact/viewcontactofe3dpolygon.hxx|2 
 svx/inc/sdr/contact/viewcontactofe3dsphere.hxx |2 
 svx/inc/sdr/contact/viewobjectcontactofe3d.hxx |8 -
 svx/source/engine3d/helperhittest3d.cxx|6 
 svx/source/engine3d/helperminimaldepth3d.cxx   |6 
 svx/source/engine3d/obj3d.cxx  |   14 -
 svx/source/sdr/contact/viewcontactofe3d.cxx|   26 +--
 svx/source/sdr/contact/viewcontactofe3dcube.cxx|6 
 svx/source/sdr/contact/viewcontactofe3dextrude.cxx |6 
 svx/source/sdr/contact/viewcontactofe3dlathe.cxx   |6 
 svx/source/sdr/contact/viewcontactofe3dpolygon.cxx |6 
 svx/source/sdr/contact/viewcontactofe3dscene.cxx   |   51 +++---
 svx/source/sdr/contact/viewcontactofe3dsphere.cxx  |6 
 svx/source/sdr/contact/viewobjectcontactofe3d.cxx  |   18 +-
 61 files changed, 392 insertions(+), 330 deletions(-)

New commits:
commit 4463da0488099b52959544923407b15d73d3e172
Author: Noel Grandin 
Date:   Tue Dec 15 10:31:06 2015 +0200

use vector as container for Primitive3DReference

rather than uno::Sequence, since we modify this container a lot
and uno::Sequence is expensive to update

Change-Id: Id5bc5171cbc4b90b243e6dda6d572f21b3bdf00d

diff --git a/drawinglayer/source/primitive2d/embedded3dprimitive2d.cxx 

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

2015-12-11 Thread Noel Grandin
 drawinglayer/source/primitive2d/baseprimitive2d.cxx  |   35 ---
 include/drawinglayer/primitive2d/baseprimitive2d.hxx |3 -
 2 files changed, 38 deletions(-)

New commits:
commit da419ab6b28f0a20a62ea7fa13ab97a8ae946899
Author: Noel Grandin 
Date:   Fri Dec 11 11:53:57 2015 +0200

loplugin:unreffun

fallout from 58d8d8ac67aa9b907f1304a48efa0f7a473d9de4
"tdf#69977: uno::Sequence is expensive"

Change-Id: Ib55de090c72dcfd8ad049746b693b383e70e8ca9

diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx 
b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
index 361cd22..3ed8fea 100644
--- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx
@@ -111,25 +111,6 @@ namespace drawinglayer
 namespace primitive2d
 {
 // convert helper stl vector of primitives to Primitive2DSequence
-Primitive2DSequence Primitive2DContainerToPrimitive2DSequence(const 
Primitive2DContainer& rSource, bool bInvert)
-{
-const sal_uInt32 nSize(rSource.size());
-Primitive2DSequence aRetval;
-
-aRetval.realloc(nSize);
-
-for(sal_uInt32 a(0); a < nSize; a++)
-{
-aRetval[bInvert ? nSize - 1 - a : a] = rSource[a];
-}
-
-// all entries taken over to Uno References as owners. To avoid
-// errors with users of this mechanism to delete pointers to 
BasePrimitive2D
-// itself, clear given vector
-const_cast< Primitive2DContainer& >(rSource).clear();
-
-return aRetval;
-}
 Primitive2DContainer Primitive2DContainer::maybeInvert(bool bInvert) 
const
 {
 const sal_uInt32 nSize(size());
@@ -193,22 +174,6 @@ namespace drawinglayer
 
 return aRetval;
 }
-basegfx::B2DRange getB2DRangeFromPrimitive2DSequence(const 
Primitive2DContainer& rCandidate, const geometry::ViewInformation2D& 
aViewInformation)
-{
-basegfx::B2DRange aRetval;
-
-if(!rCandidate.empty())
-{
-const sal_Int32 nCount(rCandidate.size());
-
-for(sal_Int32 a(0L); a < nCount; a++)
-{
-
aRetval.expand(getB2DRangeFromPrimitive2DReference(rCandidate[a], 
aViewInformation));
-}
-}
-
-return aRetval;
-}
 
 bool arePrimitive2DReferencesEqual(const Primitive2DReference& rxA, 
const Primitive2DReference& rxB)
 {
diff --git a/include/drawinglayer/primitive2d/baseprimitive2d.hxx 
b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
index c21c59c..850fd2e 100644
--- a/include/drawinglayer/primitive2d/baseprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/baseprimitive2d.hxx
@@ -284,9 +284,6 @@ namespace drawinglayer
 /// get B2DRange from a given Primitive2DReference
 basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC 
getB2DRangeFromPrimitive2DReference(const Primitive2DReference& rCandidate, 
const geometry::ViewInformation2D& aViewInformation);
 
-/// get B2DRange from a given Primitive2DSequence
-basegfx::B2DRange DRAWINGLAYER_DLLPUBLIC 
getB2DRangeFromPrimitive2DSequence(const Primitive2DSequence& rCandidate, const 
geometry::ViewInformation2D& aViewInformation);
-
 /** compare two Primitive2DReferences for equality, including trying 
to get implementations (BasePrimitive2D)
 and using compare operator
  */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


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

2014-01-10 Thread Stephan Bergmann
 drawinglayer/source/attribute/fillgraphicattribute.cxx|2 -
 drawinglayer/source/attribute/fillhatchattribute.cxx  |2 -
 drawinglayer/source/attribute/fontattribute.cxx   |   14 +-
 drawinglayer/source/attribute/linestartendattribute.cxx   |2 -
 drawinglayer/source/attribute/sdrfillgraphicattribute.cxx |6 ++--
 drawinglayer/source/attribute/sdrlightattribute3d.cxx |2 -
 drawinglayer/source/attribute/sdrlinestartendattribute.cxx|8 ++---
 drawinglayer/source/attribute/sdrobjectattribute3d.cxx|   10 +++
 drawinglayer/source/attribute/sdrsceneattribute3d.cxx |2 -
 drawinglayer/source/processor3d/zbufferprocessor3d.cxx|   12 
 include/drawinglayer/primitive2d/animatedprimitive2d.hxx  |2 -
 include/drawinglayer/primitive2d/embedded3dprimitive2d.hxx|2 -
 include/drawinglayer/primitive2d/pagepreviewprimitive2d.hxx   |2 -
 include/drawinglayer/primitive2d/sceneprimitive2d.hxx |2 -
 include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx |   10 +++
 include/drawinglayer/primitive3d/polypolygonprimitive3d.hxx   |2 -
 include/drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx|   12 
 include/drawinglayer/primitive3d/sdrlatheprimitive3d.hxx  |   12 
 include/drawinglayer/primitive3d/shadowprimitive3d.hxx|2 -
 include/drawinglayer/primitive3d/textureprimitive3d.hxx   |4 +-
 include/drawinglayer/processor2d/hittestprocessor2d.hxx   |8 ++---
 include/drawinglayer/processor2d/linegeometryextractor2d.hxx  |2 -
 include/drawinglayer/processor3d/defaultprocessor3d.hxx   |6 ++--
 include/drawinglayer/processor3d/shadow3dextractor.hxx|6 ++--
 include/drawinglayer/texture/texture3d.hxx|2 -
 25 files changed, 67 insertions(+), 67 deletions(-)

New commits:
commit 70863f08d83dec5c9ee51d06b64bbca59e9daaef
Author: Stephan Bergmann sberg...@redhat.com
Date:   Fri Jan 10 17:52:34 2014 +0100

Use bool

Change-Id: I2d06ae03650b318a1318d0e2b026352e22404fdd

diff --git a/drawinglayer/source/attribute/fillgraphicattribute.cxx 
b/drawinglayer/source/attribute/fillgraphicattribute.cxx
index f92b06d..2fc61e1 100644
--- a/drawinglayer/source/attribute/fillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/fillgraphicattribute.cxx
@@ -34,7 +34,7 @@ namespace drawinglayer
 basegfx::B2DRange   maGraphicRange;
 
 // bitfield
-unsignedmbTiling : 1;
+boolmbTiling : 1;
 
 // tiling definitions, offsets in X/Y in percent for each 2nd row.
 // If both are set, Y is ignored (X has precedence)
diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx 
b/drawinglayer/source/attribute/fillhatchattribute.cxx
index 1d56bad..fad8ca3 100644
--- a/drawinglayer/source/attribute/fillhatchattribute.cxx
+++ b/drawinglayer/source/attribute/fillhatchattribute.cxx
@@ -38,7 +38,7 @@ namespace drawinglayer
 sal_uInt32  mnMinimalDiscreteDistance;
 
 // bitfield
-unsignedmbFillBackground : 1;
+boolmbFillBackground : 1;
 
 ImpFillHatchAttribute(
 HatchStyle eStyle,
diff --git a/drawinglayer/source/attribute/fontattribute.cxx 
b/drawinglayer/source/attribute/fontattribute.cxx
index 16f1785..f0b438c 100644
--- a/drawinglayer/source/attribute/fontattribute.cxx
+++ b/drawinglayer/source/attribute/fontattribute.cxx
@@ -36,13 +36,13 @@ namespace drawinglayer
 sal_uInt16  mnWeight;   // 
Font weight
 
 /// bitfield
-unsignedmbSymbol : 1;   // 
Symbol Font Flag
-unsignedmbVertical : 1; // 
Vertical Text Flag
-unsignedmbItalic : 1;   // 
Italic Flag
-unsignedmbOutline : 1;  // 
Outline Flag
-unsignedmbRTL : 1;  // 
RTL Flag
-unsignedmbBiDiStrong : 1;   // 
BiDi Flag
-unsignedmbMonospaced : 1;
+boolmbSymbol : 1;   // 
Symbol Font Flag
+boolmbVertical : 1; // 
Vertical Text Flag
+boolmbItalic : 1;   // 
Italic Flag
+boolmbOutline : 1;  // 
Outline Flag
+boolmbRTL : 1;  // 
RTL 

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

2014-01-09 Thread Armin Le Grand
 drawinglayer/source/attribute/sdrfillgraphicattribute.cxx  |   22 ++-
 include/drawinglayer/attribute/sdrfillgraphicattribute.hxx |2 +
 svx/source/sdr/primitive2d/sdrattributecreator.cxx |   24 -
 3 files changed, 36 insertions(+), 12 deletions(-)

New commits:
commit 01541c21b61fc1f26e452196b79324344c868f8e
Author: Armin Le Grand a...@apache.org
Date:   Thu Jan 9 15:58:41 2014 +

Resolves: #i124002# use own logical size for graphics...

do not adapt PrefSize of these in rendering stack

(cherry picked from commit b57f921795c7249d82ca739884c0116574426194)

Conflicts:
drawinglayer/source/attribute/sdrfillgraphicattribute.cxx

Change-Id: I3eff4438a42209ad4c259dfdbed4869ae046bfc6

diff --git a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx 
b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
index 0b1af9c..217e7ab 100755
--- a/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
+++ b/drawinglayer/source/attribute/sdrfillgraphicattribute.cxx
@@ -33,6 +33,7 @@ namespace drawinglayer
 public:
 // data definitions
 Graphic maFillGraphic;
+basegfx::B2DVector  maGraphicLogicSize;
 basegfx::B2DVector  maSize;
 basegfx::B2DVector  maOffset;
 basegfx::B2DVector  maOffsetPosition;
@@ -45,6 +46,7 @@ namespace drawinglayer
 
 ImpSdrFillGraphicAttribute(
 const Graphic rFillGraphic,
+const basegfx::B2DVector rGraphicLogicSize,
 const basegfx::B2DVector rSize,
 const basegfx::B2DVector rOffset,
 const basegfx::B2DVector rOffsetPosition,
@@ -53,6 +55,7 @@ namespace drawinglayer
 bool bStretch,
 bool bLogSize)
 :   maFillGraphic(rFillGraphic),
+maGraphicLogicSize(rGraphicLogicSize),
 maSize(rSize),
 maOffset(rOffset),
 maOffsetPosition(rOffsetPosition),
@@ -65,6 +68,7 @@ namespace drawinglayer
 
 ImpSdrFillGraphicAttribute()
 :   maFillGraphic(Graphic()),
+maGraphicLogicSize(basegfx::B2DVector()),
 maSize(basegfx::B2DVector()),
 maOffset(basegfx::B2DVector()),
 maOffsetPosition(basegfx::B2DVector()),
@@ -77,6 +81,7 @@ namespace drawinglayer
 
 // data read access
 const Graphic getFillGraphic() const { return maFillGraphic; }
+const basegfx::B2DVector getGraphicLogicSize() const { return 
maGraphicLogicSize; }
 const basegfx::B2DVector getSize() const { return maSize; }
 const basegfx::B2DVector getOffset() const { return maOffset; }
 const basegfx::B2DVector getOffsetPosition() const { return 
maOffsetPosition; }
@@ -88,6 +93,7 @@ namespace drawinglayer
 bool operator==(const ImpSdrFillGraphicAttribute rCandidate) const
 {
 return (getFillGraphic() == rCandidate.getFillGraphic()
+ getGraphicLogicSize() == 
rCandidate.getGraphicLogicSize()
  getSize() == rCandidate.getSize()
  getOffset() == rCandidate.getOffset()
  getOffsetPosition() == rCandidate.getOffsetPosition()
@@ -106,6 +112,7 @@ namespace drawinglayer
 
 SdrFillGraphicAttribute::SdrFillGraphicAttribute(
 const Graphic rFillGraphic,
+const basegfx::B2DVector rGraphicLogicSize,
 const basegfx::B2DVector rSize,
 const basegfx::B2DVector rOffset,
 const basegfx::B2DVector rOffsetPosition,
@@ -116,6 +123,7 @@ namespace drawinglayer
 :   mpSdrFillGraphicAttribute(
 ImpSdrFillGraphicAttribute(
 rFillGraphic,
+rGraphicLogicSize,
 rSize,
 rOffset,
 rOffsetPosition,
@@ -161,6 +169,11 @@ namespace drawinglayer
 return mpSdrFillGraphicAttribute-getFillGraphic();
 }
 
+const basegfx::B2DVector 
SdrFillGraphicAttribute::getGraphicLogicSize() const
+{
+return mpSdrFillGraphicAttribute-getGraphicLogicSize();
+}
+
 const basegfx::B2DVector SdrFillGraphicAttribute::getSize() const
 {
 return mpSdrFillGraphicAttribute-getSize();
@@ -200,7 +213,6 @@ namespace drawinglayer
 {
 // get logical size of bitmap (before expanding eventually)
 Graphic aGraphic(getFillGraphic());
-const basegfx::B2DVector 
aLogicalSize(aGraphic.GetPrefSize().getWidth(), 
aGraphic.GetPrefSize().getHeight());
 
 // init values with defaults
 basegfx::B2DPoint aBitmapSize(1.0, 1.0);
@@ -228,7 +240,9 @@ namespace 

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

2013-07-08 Thread Armin Le Grand
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx  |   10 +++---
 drawinglayer/source/processor2d/vclprocessor2d.cxx  |8 ++--
 include/drawinglayer/primitive2d/svggradientprimitive2d.hxx |4 ++--
 3 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit 8b74ad05daa9e766c875152d1c82eee5926ee182
Author: Armin Le Grand a...@apache.org
Date:   Mon Jul 8 10:30:37 2013 +

WaE and numerical inconsequence in gradient fallback render handling

(cherry picked from commit d8dfdae3da901a5a26182f3221c7aa374561672f)

Conflicts:
drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx
drawinglayer/source/primitive2d/svggradientprimitive2d.cxx

Change-Id: Ifcc795a3474efad1c1bca77088adfef36258ee95

diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 66d21f0..d9ca6e1 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -299,7 +299,11 @@ namespace drawinglayer
 {
 }
 
-bool SvgGradientHelper::equalTo(const SvgGradientHelper 
rSvgGradientHelper) const
+SvgGradientHelper::~SvgGradientHelper()
+{
+}
+
+bool SvgGradientHelper::operator==(const SvgGradientHelper 
rSvgGradientHelper) const
 {
 const SvgGradientHelper rCompare = static_cast const 
SvgGradientHelper (rSvgGradientHelper);
 
@@ -578,7 +582,7 @@ namespace drawinglayer
 {
 const SvgGradientHelper* pSvgGradientHelper = dynamic_cast const 
SvgGradientHelper* (rPrimitive);
 
-if(pSvgGradientHelper  
SvgGradientHelper::equalTo(*pSvgGradientHelper))
+if(pSvgGradientHelper  
SvgGradientHelper::operator==(*pSvgGradientHelper))
 {
 const SvgLinearGradientPrimitive2D rCompare = static_cast 
const SvgLinearGradientPrimitive2D (rPrimitive);
 
@@ -878,7 +882,7 @@ namespace drawinglayer
 {
 const SvgGradientHelper* pSvgGradientHelper = dynamic_cast const 
SvgGradientHelper* (rPrimitive);
 
-if(pSvgGradientHelper  
SvgGradientHelper::equalTo(*pSvgGradientHelper))
+if(pSvgGradientHelper  
SvgGradientHelper::operator==(*pSvgGradientHelper))
 {
 const SvgRadialGradientPrimitive2D rCompare = static_cast 
const SvgRadialGradientPrimitive2D (rPrimitive);
 
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 1ec9f50..86c51b2 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -1396,8 +1396,10 @@ namespace drawinglayer
 {
 const basegfx::BColor 
aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
 const basegfx::BColor 
aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
+
+// calculate discrete unit in WorldCoordinates; use diagonal 
(1.0, 1.0) and divide by sqrt(2)
 const basegfx::B2DVector 
aDiscreteVector(getViewInformation2D().getInverseObjectToViewTransformation() * 
basegfx::B2DVector(1.0, 1.0));
-const double 
fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), 
fabs(aDiscreteVector.getY(;
+const double fDiscreteUnit(aDiscreteVector.getLength() * (1.0 
/ 1.414213562373));
 
 // use color distance and discrete lengths to calculate step 
count
 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, 
aColorB, fDelta, fDiscreteUnit));
@@ -1439,8 +1441,10 @@ namespace drawinglayer
 {
 const basegfx::BColor 
aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
 const basegfx::BColor 
aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
+
+// calculate discrete unit in WorldCoordinates; use diagonal 
(1.0, 1.0) and divide by sqrt(2)
 const basegfx::B2DVector 
aDiscreteVector(getViewInformation2D().getInverseObjectToViewTransformation() * 
basegfx::B2DVector(1.0, 1.0));
-const double 
fDiscreteUnit(std::min(fabs(aDiscreteVector.getX()), 
fabs(aDiscreteVector.getY(;
+const double fDiscreteUnit(aDiscreteVector.getLength() * (1.0 
/ 1.414213562373));
 
 // use color distance and discrete lengths to calculate step 
count
 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, 
aColorB, fDeltaScale, fDiscreteUnit));
diff --git a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx 
b/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
index dc6aa42..db45d60 100644
--- a/include/drawinglayer/primitive2d/svggradientprimitive2d.hxx
+++ 

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

2013-06-17 Thread Armin Le Grand
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx  |   25 +
 include/drawinglayer/primitive2d/svggradientprimitive2d.hxx |7 
 svgio/inc/svgio/svgreader/svgnode.hxx   |5 
 svgio/source/svgreader/svggnode.cxx |2 
 svgio/source/svgreader/svgnode.cxx  |  193 ++--
 svgio/source/svgreader/svgstyleattributes.cxx   |   17 -
 6 files changed, 152 insertions(+), 97 deletions(-)

New commits:
commit b7a425aab6122b5848362815e5fe665c7e38da05
Author: Armin Le Grand a...@apache.org
Date:   Wed May 15 08:47:52 2013 +

Resolves: #i121801# Corrected handling of gradient transformations

(cherry picked from commit 4f49f1d95e8d0be7df259ad1458441fd858be735)

Conflicts:
drawinglayer/inc/drawinglayer/primitive2d/svggradientprimitive2d.hxx
svgio/source/svgreader/svgnode.cxx
svgio/source/svgreader/svgstyleattributes.cxx

Change-Id: I155854692a9d1771826867d2666fc6174e2c9256

diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 0328070..756f7b0 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -280,12 +280,14 @@ namespace drawinglayer
 }
 
 SvgGradientHelper::SvgGradientHelper(
+const basegfx::B2DHomMatrix rGradientTransform,
 const basegfx::B2DPolyPolygon rPolyPolygon,
 const SvgGradientEntryVector rGradientEntries,
 const basegfx::B2DPoint rStart,
 bool bUseUnitCoordinates,
 SpreadMethod aSpreadMethod)
-:   maPolyPolygon(rPolyPolygon),
+:   maGradientTransform(rGradientTransform),
+maPolyPolygon(rPolyPolygon),
 maGradientEntries(rGradientEntries),
 maStart(rStart),
 maSpreadMethod(aSpreadMethod),
@@ -301,7 +303,8 @@ namespace drawinglayer
 {
 const SvgGradientHelper rCompare = static_cast const 
SvgGradientHelper (rSvgGradientHelper);
 
-return (getPolyPolygon() == rCompare.getPolyPolygon()
+return (getGradientTransform() == rCompare.getGradientTransform()
+ getPolyPolygon() == rCompare.getPolyPolygon()
  getGradientEntries() == rCompare.getGradientEntries()
  getStart() == rCompare.getStart()
  getUseUnitCoordinates() == rCompare.getUseUnitCoordinates()
@@ -427,6 +430,11 @@ namespace drawinglayer
 aUnitGradientToObject.translate(aStart.getX(), 
aStart.getY());
 }
 
+if(!getGradientTransform().isIdentity())
+{
+aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
+}
+
 // create inverse from it
 basegfx::B2DHomMatrix 
aObjectToUnitGradient(aUnitGradientToObject);
 aObjectToUnitGradient.invert();
@@ -545,6 +553,7 @@ namespace drawinglayer
 }
 
 SvgLinearGradientPrimitive2D::SvgLinearGradientPrimitive2D(
+const basegfx::B2DHomMatrix rGradientTransform,
 const basegfx::B2DPolyPolygon rPolyPolygon,
 const SvgGradientEntryVector rGradientEntries,
 const basegfx::B2DPoint rStart,
@@ -552,7 +561,7 @@ namespace drawinglayer
 bool bUseUnitCoordinates,
 SpreadMethod aSpreadMethod)
 :   BufferedDecompositionPrimitive2D(),
-SvgGradientHelper(rPolyPolygon, rGradientEntries, rStart, 
bUseUnitCoordinates, aSpreadMethod),
+SvgGradientHelper(rGradientTransform, rPolyPolygon, 
rGradientEntries, rStart, bUseUnitCoordinates, aSpreadMethod),
 maEnd(rEnd)
 {
 }
@@ -748,6 +757,8 @@ namespace drawinglayer
 else
 {
 // interpret in object coordinate system - object aspect 
ratio will not scale result
+// use X-Axis with radius, it was already made relative to 
object width when coming from
+// SVG import
 const double fRadius((aObjectTransform * 
basegfx::B2DVector(getRadius(), 0.0)).getLength());
 const basegfx::B2DPoint aStart(aObjectTransform * 
getStart());
 
@@ -755,6 +766,11 @@ namespace drawinglayer
 aUnitGradientToObject.translate(aStart.getX(), 
aStart.getY());
 }
 
+if(!getGradientTransform().isIdentity())
+{
+aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
+}
+
 // create inverse from it
 basegfx::B2DHomMatrix 
aObjectToUnitGradient(aUnitGradientToObject);
 aObjectToUnitGradient.invert();
@@ -822,6 +838,7 @@ namespace drawinglayer
 

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

2013-05-02 Thread Armin Le Grand
 drawinglayer/source/attribute/fillhatchattribute.cxx  |   17 +
 drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx  |   42 --
 drawinglayer/source/primitive2d/metafileprimitive2d.cxx   |1 
 drawinglayer/source/primitive2d/primitivetools2d.cxx  |2 
 include/drawinglayer/attribute/fillhatchattribute.hxx |   14 
 include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx |   11 +++
 include/drawinglayer/primitive2d/primitivetools2d.hxx |7 ++
 svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx  |1 
 svx/source/sdr/overlay/overlaytools.cxx   |1 
 svx/source/sdr/primitive2d/sdrattributecreator.cxx|1 
 10 files changed, 88 insertions(+), 9 deletions(-)

New commits:
commit 8f43c78e9a607df8c72232f03be4f9a7c80538de
Author: Armin Le Grand a...@apache.org
Date:   Mon Jul 23 15:40:53 2012 +

Resolves: #i120230# Adapt hatch processing for a more pleasant visualisation

Adapt hatch processing to keep a view-dependent minimal distance for a more
pleasant visualisation

(cherry picked from commit 6a036e7ac17a1d4394d60471bd8931d9b16b7bb4)

Conflicts:
drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx
drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx
drawinglayer/source/attribute/fillhatchattribute.cxx

Change-Id: I15cd784ef7d3e47a20308f16d370c24ef46d2f22

diff --git a/drawinglayer/source/attribute/fillhatchattribute.cxx 
b/drawinglayer/source/attribute/fillhatchattribute.cxx
index e89628b..1d56bad 100644
--- a/drawinglayer/source/attribute/fillhatchattribute.cxx
+++ b/drawinglayer/source/attribute/fillhatchattribute.cxx
@@ -35,6 +35,7 @@ namespace drawinglayer
 double  mfDistance;
 double  mfAngle;
 basegfx::BColor maColor;
+sal_uInt32  mnMinimalDiscreteDistance;
 
 // bitfield
 unsignedmbFillBackground : 1;
@@ -44,11 +45,13 @@ namespace drawinglayer
 double fDistance,
 double fAngle,
 const basegfx::BColor rColor,
+sal_uInt32 nMinimalDiscreteDistance,
 bool bFillBackground)
 :   meStyle(eStyle),
 mfDistance(fDistance),
 mfAngle(fAngle),
 maColor(rColor),
+mnMinimalDiscreteDistance(nMinimalDiscreteDistance),
 mbFillBackground(bFillBackground)
 {
 }
@@ -58,6 +61,7 @@ namespace drawinglayer
 mfDistance(0.0),
 mfAngle(0.0),
 maColor(basegfx::BColor()),
+mnMinimalDiscreteDistance(3), // same as VCL
 mbFillBackground(false)
 {
 }
@@ -67,6 +71,7 @@ namespace drawinglayer
 double getDistance() const { return mfDistance; }
 double getAngle() const { return mfAngle; }
 const basegfx::BColor getColor() const { return maColor; }
+sal_uInt32 getMinimalDiscreteDistance() const { return 
mnMinimalDiscreteDistance; }
 bool isFillBackground() const { return mbFillBackground; }
 
 bool operator==(const ImpFillHatchAttribute rCandidate) const
@@ -75,7 +80,8 @@ namespace drawinglayer
  getDistance() == rCandidate.getDistance()
  getAngle() == rCandidate.getAngle()
  getColor() == rCandidate.getColor()
- isFillBackground()  == rCandidate.isFillBackground());
+ getMinimalDiscreteDistance() == 
rCandidate.getMinimalDiscreteDistance()
+ isFillBackground() == rCandidate.isFillBackground());
 }
 };
 
@@ -90,9 +96,11 @@ namespace drawinglayer
 double fDistance,
 double fAngle,
 const basegfx::BColor rColor,
+sal_uInt32 nMinimalDiscreteDistance,
 bool bFillBackground)
 :   mpFillHatchAttribute(ImpFillHatchAttribute(
-eStyle, fDistance, fAngle, rColor, bFillBackground))
+eStyle, fDistance, fAngle, rColor,
+nMinimalDiscreteDistance, bFillBackground))
 {
 }
 
@@ -147,6 +155,11 @@ namespace drawinglayer
 return mpFillHatchAttribute-getColor();
 }
 
+sal_uInt32 FillHatchAttribute::getMinimalDiscreteDistance() const
+{
+return mpFillHatchAttribute-getMinimalDiscreteDistance();
+}
+
 bool FillHatchAttribute::isFillBackground() const
 {
 return mpFillHatchAttribute-isFillBackground();
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx