[Libreoffice-commits] core.git: drawinglayer/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Apr 19 10:24:23 UTC 2020
drawinglayer/source/geometry/viewinformation2d.cxx | 107 -
drawinglayer/source/geometry/viewinformation3d.cxx | 164 +-
drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx | 120 -
drawinglayer/source/primitive2d/animatedprimitive2d.cxx | 22
drawinglayer/source/primitive2d/borderlineprimitive2d.cxx | 208 +-
drawinglayer/source/primitive2d/controlprimitive2d.cxx | 46
drawinglayer/source/primitive2d/cropprimitive2d.cxx | 150 +-
drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx | 74
drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx | 198 +-
drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx | 42
drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx | 94 -
drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx | 152 +-
drawinglayer/source/primitive2d/glowprimitive2d.cxx | 21
drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx | 250 +--
drawinglayer/source/primitive2d/gridprimitive2d.cxx | 350 ++--
drawinglayer/source/primitive2d/helplineprimitive2d.cxx | 152 +-
drawinglayer/source/primitive2d/markerarrayprimitive2d.cxx | 56
drawinglayer/source/primitive2d/pagepreviewprimitive2d.cxx | 120 -
drawinglayer/source/primitive2d/patternfillprimitive2d.cxx | 147 -
drawinglayer/source/primitive2d/polygonprimitive2d.cxx | 138 -
drawinglayer/source/primitive2d/sceneprimitive2d.cxx | 430 ++---
drawinglayer/source/primitive2d/shadowprimitive2d.cxx | 28
drawinglayer/source/primitive2d/svggradientprimitive2d.cxx | 216 +-
drawinglayer/source/primitive2d/textbreakuphelper.cxx | 316 ++--
drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx | 160 +-
drawinglayer/source/primitive2d/textlineprimitive2d.cxx | 376 ++---
drawinglayer/source/primitive2d/textprimitive2d.cxx | 136 -
drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx | 620 ++++----
drawinglayer/source/processor2d/baseprocessor2d.cxx | 40
drawinglayer/source/processor2d/objectinfoextractor2d.cxx | 50
drawinglayer/source/processor2d/vclhelperbufferdevice.cxx | 180 +-
drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 748 +++++-----
drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 180 +-
drawinglayer/source/processor2d/vclprocessor2d.cxx | 577 +++----
drawinglayer/source/processor3d/baseprocessor3d.cxx | 38
drawinglayer/source/processor3d/defaultprocessor3d.cxx | 600 ++++----
drawinglayer/source/processor3d/shadow3dextractor.cxx | 32
drawinglayer/source/processor3d/zbufferprocessor3d.cxx | 200 +-
drawinglayer/source/texture/texture.cxx | 366 ++--
drawinglayer/source/tools/emfpfont.cxx | 20
drawinglayer/source/tools/emfphelperdata.cxx | 338 ++--
drawinglayer/source/tools/wmfemfhelper.cxx | 562 +++----
42 files changed, 4408 insertions(+), 4416 deletions(-)
New commits:
commit 2ee60f02c456f39a80edb2dbfed48c3e0147a7f7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Apr 19 11:10:43 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Apr 19 12:23:46 2020 +0200
loplugin:flatten in drawinglayer
Change-Id: Ieb5f682ec627c8d8ddfc286ec0e4422104b4d847
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92494
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/drawinglayer/source/geometry/viewinformation2d.cxx b/drawinglayer/source/geometry/viewinformation2d.cxx
index a88757416b1b..08a88b23d564 100644
--- a/drawinglayer/source/geometry/viewinformation2d.cxx
+++ b/drawinglayer/source/geometry/viewinformation2d.cxx
@@ -86,66 +86,65 @@ protected:
void impInterpretPropertyValues(const uno::Sequence<beans::PropertyValue>& rViewParameters)
{
- if (rViewParameters.hasElements())
+ 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 sal_Int32 nCount(rViewParameters.getLength());
- sal_Int32 nExtendedInsert(0);
+ const beans::PropertyValue& rProp = rViewParameters[a];
- // prepare extended information for filtering. Maximum size is nCount
- mxExtendedInformation.realloc(nCount);
+ if (rProp.Name == g_PropertyName_ReducedDisplayQuality)
+ {
+ // extra information; add to filtered information
+ mxExtendedInformation[nExtendedInsert++] = rProp;
- for (sal_Int32 a(0); a < nCount; a++)
+ // for performance reasons, also cache content locally
+ bool bSalBool(false);
+ rProp.Value >>= bSalBool;
+ mbReducedDisplayQuality = bSalBool;
+ }
+ else if (rProp.Name == g_PropertyName_ObjectTransformation)
{
- 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 (rProp.Name == g_PropertyName_VisualizedPage)
- {
- rProp.Value >>= mxVisualizedPage;
- }
- else
- {
- // extra information; add to filtered information
- mxExtendedInformation[nExtendedInsert++] = rProp;
- }
+ 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 (rProp.Name == g_PropertyName_VisualizedPage)
+ {
+ rProp.Value >>= mxVisualizedPage;
+ }
+ else
+ {
+ // extra information; add to filtered information
+ mxExtendedInformation[nExtendedInsert++] = rProp;
}
-
- // extra information size is now known; realloc to final size
- mxExtendedInformation.realloc(nExtendedInsert);
}
+
+ // extra information size is now known; realloc to final size
+ mxExtendedInformation.realloc(nExtendedInsert);
}
void impFillViewInformationFromContent()
diff --git a/drawinglayer/source/geometry/viewinformation3d.cxx b/drawinglayer/source/geometry/viewinformation3d.cxx
index f59a88fa0071..b3e75bffa6dd 100644
--- a/drawinglayer/source/geometry/viewinformation3d.cxx
+++ b/drawinglayer/source/geometry/viewinformation3d.cxx
@@ -122,93 +122,93 @@ namespace drawinglayer::geometry
// all ViewParameters using UNO API
void impInterpretPropertyValues(const uno::Sequence< beans::PropertyValue >& rViewParameters)
{
- if(rViewParameters.hasElements())
- {
- const sal_Int32 nCount(rViewParameters.getLength());
- sal_Int32 nExtendedInsert(0);
+ 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);
- // 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];
- for(sal_Int32 a(0); a < nCount; a++)
+ if(rProp.Name == getNamePropertyObjectTransformation())
{
- const beans::PropertyValue& rProp = rViewParameters[a];
-
- if(rProp.Name == getNamePropertyObjectTransformation())
- {
- css::geometry::AffineMatrix3D aAffineMatrix3D;
- rProp.Value >>= aAffineMatrix3D;
- maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
- }
- else if(rProp.Name == getNamePropertyOrientation())
- {
- css::geometry::AffineMatrix3D aAffineMatrix3D;
- rProp.Value >>= aAffineMatrix3D;
- maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
- }
- else if(rProp.Name == getNamePropertyProjection())
- {
- // projection may be defined using a frustum in which case the last line of
- // the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that,
- // these four values need to be treated extra
- const double f_30(maProjection.get(3, 0));
- const double f_31(maProjection.get(3, 1));
- const double f_32(maProjection.get(3, 2));
- const double f_33(maProjection.get(3, 3));
-
- css::geometry::AffineMatrix3D aAffineMatrix3D;
- rProp.Value >>= aAffineMatrix3D;
- maProjection = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
-
- maProjection.set(3, 0, f_30);
- maProjection.set(3, 1, f_31);
- maProjection.set(3, 2, f_32);
- maProjection.set(3, 3, f_33);
- }
- else if(rProp.Name == getNamePropertyProjection_30())
- {
- double f_30(0.0);
- rProp.Value >>= f_30;
- maProjection.set(3, 0, f_30);
- }
- else if(rProp.Name == getNamePropertyProjection_31())
- {
- double f_31(0.0);
- rProp.Value >>= f_31;
- maProjection.set(3, 1, f_31);
- }
- else if(rProp.Name == getNamePropertyProjection_32())
- {
- double f_32(0.0);
- rProp.Value >>= f_32;
- maProjection.set(3, 2, f_32);
- }
- else if(rProp.Name == getNamePropertyProjection_33())
- {
- double f_33(1.0);
- rProp.Value >>= f_33;
- maProjection.set(3, 3, f_33);
- }
- else if(rProp.Name == getNamePropertyDeviceToView())
- {
- css::geometry::AffineMatrix3D aAffineMatrix3D;
- rProp.Value >>= aAffineMatrix3D;
- maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
- }
- else if(rProp.Name == getNamePropertyTime())
- {
- rProp.Value >>= mfViewTime;
- }
- else
- {
- // extra information; add to filtered information
- mxExtendedInformation[nExtendedInsert++] = rProp;
- }
+ css::geometry::AffineMatrix3D aAffineMatrix3D;
+ rProp.Value >>= aAffineMatrix3D;
+ maObjectTransformation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
+ }
+ else if(rProp.Name == getNamePropertyOrientation())
+ {
+ css::geometry::AffineMatrix3D aAffineMatrix3D;
+ rProp.Value >>= aAffineMatrix3D;
+ maOrientation = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
+ }
+ else if(rProp.Name == getNamePropertyProjection())
+ {
+ // projection may be defined using a frustum in which case the last line of
+ // the 4x4 matrix is not (0,0,0,1). Since AffineMatrix3D does not support that,
+ // these four values need to be treated extra
+ const double f_30(maProjection.get(3, 0));
+ const double f_31(maProjection.get(3, 1));
+ const double f_32(maProjection.get(3, 2));
+ const double f_33(maProjection.get(3, 3));
+
+ css::geometry::AffineMatrix3D aAffineMatrix3D;
+ rProp.Value >>= aAffineMatrix3D;
+ maProjection = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
+
+ maProjection.set(3, 0, f_30);
+ maProjection.set(3, 1, f_31);
+ maProjection.set(3, 2, f_32);
+ maProjection.set(3, 3, f_33);
+ }
+ else if(rProp.Name == getNamePropertyProjection_30())
+ {
+ double f_30(0.0);
+ rProp.Value >>= f_30;
+ maProjection.set(3, 0, f_30);
+ }
+ else if(rProp.Name == getNamePropertyProjection_31())
+ {
+ double f_31(0.0);
+ rProp.Value >>= f_31;
+ maProjection.set(3, 1, f_31);
+ }
+ else if(rProp.Name == getNamePropertyProjection_32())
+ {
+ double f_32(0.0);
+ rProp.Value >>= f_32;
+ maProjection.set(3, 2, f_32);
+ }
+ else if(rProp.Name == getNamePropertyProjection_33())
+ {
+ double f_33(1.0);
+ rProp.Value >>= f_33;
+ maProjection.set(3, 3, f_33);
+ }
+ else if(rProp.Name == getNamePropertyDeviceToView())
+ {
+ css::geometry::AffineMatrix3D aAffineMatrix3D;
+ rProp.Value >>= aAffineMatrix3D;
+ maDeviceToView = basegfx::unotools::homMatrixFromAffineMatrix3D(aAffineMatrix3D);
+ }
+ else if(rProp.Name == getNamePropertyTime())
+ {
+ rProp.Value >>= mfViewTime;
+ }
+ else
+ {
+ // extra information; add to filtered information
+ mxExtendedInformation[nExtendedInsert++] = rProp;
}
-
- // extra information size is now known; realloc to final size
- mxExtendedInformation.realloc(nExtendedInsert);
}
+
+ // extra information size is now known; realloc to final size
+ mxExtendedInformation.realloc(nExtendedInsert);
}
// central method to create a Sequence of PropertyValues containing he complete
diff --git a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
index 00bea0ab10ea..2a1aefafa275 100644
--- a/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/PolyPolygonGraphicPrimitive2D.cxx
@@ -33,70 +33,66 @@ namespace drawinglayer::primitive2d
void PolyPolygonGraphicPrimitive2D::create2DDecomposition(
Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- if (!getFillGraphic().isDefault())
+ if (getFillGraphic().isDefault())
+ return;
+
+ const Graphic& rGraphic = getFillGraphic().getGraphic();
+ const GraphicType aType(rGraphic.GetType());
+
+ // is there a bitmap or a metafile (do we have content)?
+ if (!(GraphicType::Bitmap == aType || GraphicType::GdiMetafile == aType))
+ return;
+
+ const Size aPrefSize(rGraphic.GetPrefSize());
+
+ // does content have a size?
+ if (!(aPrefSize.Width() && aPrefSize.Height()))
+ return;
+
+ // create SubSequence with FillGraphicPrimitive2D based on polygon range
+ const basegfx::B2DRange aOutRange(getB2DPolyPolygon().getB2DRange());
+ const basegfx::B2DHomMatrix aNewObjectTransform(
+ basegfx::utils::createScaleTranslateB2DHomMatrix(aOutRange.getRange(),
+ aOutRange.getMinimum()));
+ Primitive2DReference xSubRef;
+
+ if (aOutRange != getDefinitionRange())
{
- const Graphic& rGraphic = getFillGraphic().getGraphic();
- const GraphicType aType(rGraphic.GetType());
-
- // is there a bitmap or a metafile (do we have content)?
- if (GraphicType::Bitmap == aType || GraphicType::GdiMetafile == aType)
- {
- const Size aPrefSize(rGraphic.GetPrefSize());
-
- // does content have a size?
- if (aPrefSize.Width() && aPrefSize.Height())
- {
- // create SubSequence with FillGraphicPrimitive2D based on polygon range
- const basegfx::B2DRange aOutRange(getB2DPolyPolygon().getB2DRange());
- const basegfx::B2DHomMatrix aNewObjectTransform(
- basegfx::utils::createScaleTranslateB2DHomMatrix(aOutRange.getRange(),
- aOutRange.getMinimum()));
- Primitive2DReference xSubRef;
-
- if (aOutRange != getDefinitionRange())
- {
- // we want to paint (tiled) content which is defined relative to DefinitionRange
- // with the same tiling and offset(s) in the target range of the geometry (the
- // polygon). The range given in the local FillGraphicAttribute defines the position
- // of the graphic in unit coordinates relative to the DefinitionRange. Transform
- // this using DefinitionRange to get to the global definition and then with the
- // inverse transformation from the target range to go to unit coordinates relative
- // to that target coordinate system.
- basegfx::B2DRange aAdaptedRange(getFillGraphic().getGraphicRange());
-
- const basegfx::B2DHomMatrix aFromDefinitionRangeToGlobal(
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- getDefinitionRange().getRange(), getDefinitionRange().getMinimum()));
-
- aAdaptedRange.transform(aFromDefinitionRangeToGlobal);
-
- basegfx::B2DHomMatrix aFromGlobalToOutRange(
- basegfx::utils::createScaleTranslateB2DHomMatrix(aOutRange.getRange(),
- aOutRange.getMinimum()));
- aFromGlobalToOutRange.invert();
-
- aAdaptedRange.transform(aFromGlobalToOutRange);
-
- const drawinglayer::attribute::FillGraphicAttribute
- aAdaptedFillGraphicAttribute(getFillGraphic().getGraphic(), aAdaptedRange,
- getFillGraphic().getTiling(),
- getFillGraphic().getOffsetX(),
- getFillGraphic().getOffsetY());
-
- xSubRef = new FillGraphicPrimitive2D(aNewObjectTransform,
- aAdaptedFillGraphicAttribute);
- }
- else
- {
- xSubRef = new FillGraphicPrimitive2D(aNewObjectTransform, getFillGraphic());
- }
-
- // embed to mask primitive
- rContainer.push_back(
- new MaskPrimitive2D(getB2DPolyPolygon(), Primitive2DContainer{ xSubRef }));
- }
- }
+ // we want to paint (tiled) content which is defined relative to DefinitionRange
+ // with the same tiling and offset(s) in the target range of the geometry (the
+ // polygon). The range given in the local FillGraphicAttribute defines the position
+ // of the graphic in unit coordinates relative to the DefinitionRange. Transform
+ // this using DefinitionRange to get to the global definition and then with the
+ // inverse transformation from the target range to go to unit coordinates relative
+ // to that target coordinate system.
+ basegfx::B2DRange aAdaptedRange(getFillGraphic().getGraphicRange());
+
+ const basegfx::B2DHomMatrix aFromDefinitionRangeToGlobal(
+ basegfx::utils::createScaleTranslateB2DHomMatrix(getDefinitionRange().getRange(),
+ getDefinitionRange().getMinimum()));
+
+ aAdaptedRange.transform(aFromDefinitionRangeToGlobal);
+
+ basegfx::B2DHomMatrix aFromGlobalToOutRange(
+ basegfx::utils::createScaleTranslateB2DHomMatrix(aOutRange.getRange(),
+ aOutRange.getMinimum()));
+ aFromGlobalToOutRange.invert();
+
+ aAdaptedRange.transform(aFromGlobalToOutRange);
+
+ const drawinglayer::attribute::FillGraphicAttribute aAdaptedFillGraphicAttribute(
+ getFillGraphic().getGraphic(), aAdaptedRange, getFillGraphic().getTiling(),
+ getFillGraphic().getOffsetX(), getFillGraphic().getOffsetY());
+
+ xSubRef = new FillGraphicPrimitive2D(aNewObjectTransform, aAdaptedFillGraphicAttribute);
}
+ else
+ {
+ xSubRef = new FillGraphicPrimitive2D(aNewObjectTransform, getFillGraphic());
+ }
+
+ // embed to mask primitive
+ rContainer.push_back(new MaskPrimitive2D(getB2DPolyPolygon(), Primitive2DContainer{ xSubRef }));
}
PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
diff --git a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
index 19e586359395..d2c8d4a6571a 100644
--- a/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/animatedprimitive2d.cxx
@@ -64,20 +64,20 @@ namespace drawinglayer::primitive2d
void AnimatedSwitchPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- if(!getChildren().empty())
- {
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
- const sal_uInt32 nLen(getChildren().size());
- sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
+ if(getChildren().empty())
+ return;
- if(nIndex >= nLen)
- {
- nIndex = nLen - 1;
- }
+ const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const sal_uInt32 nLen(getChildren().size());
+ sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
- const Primitive2DReference xRef(getChildren()[nIndex], uno::UNO_SET_THROW);
- rVisitor.append(xRef);
+ if(nIndex >= nLen)
+ {
+ nIndex = nLen - 1;
}
+
+ const Primitive2DReference xRef(getChildren()[nIndex], uno::UNO_SET_THROW);
+ rVisitor.append(xRef);
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 71dfe1629085..32c95fb02a66 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -113,138 +113,138 @@ namespace drawinglayer::primitive2d
void BorderLinePrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- if (!getStart().equal(getEnd()) && !getBorderLines().empty())
+ if (getStart().equal(getEnd()) || getBorderLines().empty())
+ return;
+
+ // get data and vectors
+ basegfx::B2DVector aVector(getEnd() - getStart());
+ aVector.normalize();
+ const basegfx::B2DVector aPerpendicular(basegfx::getPerpendicular(aVector));
+ const double fFullWidth(getFullWidth());
+ double fOffset(fFullWidth * -0.5);
+
+ for(const auto& candidate : maBorderLines)
{
- // get data and vectors
- basegfx::B2DVector aVector(getEnd() - getStart());
- aVector.normalize();
- const basegfx::B2DVector aPerpendicular(basegfx::getPerpendicular(aVector));
- const double fFullWidth(getFullWidth());
- double fOffset(fFullWidth * -0.5);
-
- for(const auto& candidate : maBorderLines)
+ const double fWidth(candidate.getLineAttribute().getWidth());
+
+ if(!candidate.isGap())
{
- const double fWidth(candidate.getLineAttribute().getWidth());
+ const basegfx::B2DVector aDeltaY(aPerpendicular * (fOffset + (fWidth * 0.5)));
+ const basegfx::B2DPoint aStart(getStart() + aDeltaY);
+ const basegfx::B2DPoint aEnd(getEnd() + aDeltaY);
+ const bool bStartPerpendicular(rtl::math::approxEqual(candidate.getStartLeft(), candidate.getStartRight()));
+ const bool bEndPerpendicular(rtl::math::approxEqual(candidate.getEndLeft(), candidate.getEndRight()));
- if(!candidate.isGap())
+ if(bStartPerpendicular && bEndPerpendicular)
{
- const basegfx::B2DVector aDeltaY(aPerpendicular * (fOffset + (fWidth * 0.5)));
- const basegfx::B2DPoint aStart(getStart() + aDeltaY);
- const basegfx::B2DPoint aEnd(getEnd() + aDeltaY);
- const bool bStartPerpendicular(rtl::math::approxEqual(candidate.getStartLeft(), candidate.getStartRight()));
- const bool bEndPerpendicular(rtl::math::approxEqual(candidate.getEndLeft(), candidate.getEndRight()));
-
- if(bStartPerpendicular && bEndPerpendicular)
+ // start and end extends lead to an edge perpendicular to the line, so we can just use
+ // a PolygonStrokePrimitive2D for representation
+ addPolygonStrokePrimitive2D(
+ rContainer,
+ aStart - (aVector * candidate.getStartLeft()),
+ aEnd + (aVector * candidate.getEndLeft()),
+ candidate.getLineAttribute(),
+ getStrokeAttribute());
+ }
+ else
+ {
+ // start and/or end extensions lead to a lineStart/End that is *not*
+ // perpendicular to the line itself
+ if(getStrokeAttribute().isDefault() || 0.0 == getStrokeAttribute().getFullDotDashLen())
{
- // start and end extends lead to an edge perpendicular to the line, so we can just use
- // a PolygonStrokePrimitive2D for representation
- addPolygonStrokePrimitive2D(
- rContainer,
- aStart - (aVector * candidate.getStartLeft()),
- aEnd + (aVector * candidate.getEndLeft()),
- candidate.getLineAttribute(),
- getStrokeAttribute());
+ // without stroke, we can simply represent that using a filled polygon
+ const basegfx::B2DVector aHalfLineOffset(aPerpendicular * (candidate.getLineAttribute().getWidth() * 0.5));
+ basegfx::B2DPolygon aPolygon;
+
+ aPolygon.append(aStart - aHalfLineOffset - (aVector * candidate.getStartLeft()));
+ aPolygon.append(aEnd - aHalfLineOffset + (aVector * candidate.getEndLeft()));
+ aPolygon.append(aEnd + aHalfLineOffset + (aVector * candidate.getEndRight()));
+ aPolygon.append(aStart + aHalfLineOffset - (aVector * candidate.getStartRight()));
+
+ rContainer.push_back(
+ new PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ candidate.getLineAttribute().getColor()));
}
else
{
- // start and/or end extensions lead to a lineStart/End that is *not*
- // perpendicular to the line itself
- if(getStrokeAttribute().isDefault() || 0.0 == getStrokeAttribute().getFullDotDashLen())
+ // with stroke, we have a problem - a filled polygon would lose the
+ // stroke. Let's represent the start and/or end as triangles, the main
+ // line still as PolygonStrokePrimitive2D.
+ // Fill default line Start/End for stroke, so we need no adaptations in else paths
+ basegfx::B2DPoint aStrokeStart(aStart - (aVector * candidate.getStartLeft()));
+ basegfx::B2DPoint aStrokeEnd(aEnd + (aVector * candidate.getEndLeft()));
+ const basegfx::B2DVector aHalfLineOffset(aPerpendicular * (candidate.getLineAttribute().getWidth() * 0.5));
+
+ if(!bStartPerpendicular)
{
- // without stroke, we can simply represent that using a filled polygon
- const basegfx::B2DVector aHalfLineOffset(aPerpendicular * (candidate.getLineAttribute().getWidth() * 0.5));
+ const double fMin(std::min(candidate.getStartLeft(), candidate.getStartRight()));
+ const double fMax(std::max(candidate.getStartLeft(), candidate.getStartRight()));
basegfx::B2DPolygon aPolygon;
- aPolygon.append(aStart - aHalfLineOffset - (aVector * candidate.getStartLeft()));
- aPolygon.append(aEnd - aHalfLineOffset + (aVector * candidate.getEndLeft()));
- aPolygon.append(aEnd + aHalfLineOffset + (aVector * candidate.getEndRight()));
- aPolygon.append(aStart + aHalfLineOffset - (aVector * candidate.getStartRight()));
+ // create a triangle with min/max values for LineStart and add
+ if(rtl::math::approxEqual(candidate.getStartLeft(), fMax))
+ {
+ aPolygon.append(aStart - aHalfLineOffset - (aVector * candidate.getStartLeft()));
+ }
+
+ aPolygon.append(aStart - aHalfLineOffset - (aVector * fMin));
+ aPolygon.append(aStart + aHalfLineOffset - (aVector * fMin));
+
+ if(rtl::math::approxEqual(candidate.getStartRight(), fMax))
+ {
+ aPolygon.append(aStart + aHalfLineOffset - (aVector * candidate.getStartRight()));
+ }
rContainer.push_back(
new PolyPolygonColorPrimitive2D(
basegfx::B2DPolyPolygon(aPolygon),
candidate.getLineAttribute().getColor()));
+
+ // Adapt StrokeStart accordingly
+ aStrokeStart = aStart - (aVector * fMin);
}
- else
+
+ if(!bEndPerpendicular)
{
- // with stroke, we have a problem - a filled polygon would lose the
- // stroke. Let's represent the start and/or end as triangles, the main
- // line still as PolygonStrokePrimitive2D.
- // Fill default line Start/End for stroke, so we need no adaptations in else paths
- basegfx::B2DPoint aStrokeStart(aStart - (aVector * candidate.getStartLeft()));
- basegfx::B2DPoint aStrokeEnd(aEnd + (aVector * candidate.getEndLeft()));
- const basegfx::B2DVector aHalfLineOffset(aPerpendicular * (candidate.getLineAttribute().getWidth() * 0.5));
-
- if(!bStartPerpendicular)
+ const double fMin(std::min(candidate.getEndLeft(), candidate.getEndRight()));
+ const double fMax(std::max(candidate.getEndLeft(), candidate.getEndRight()));
+ basegfx::B2DPolygon aPolygon;
+
+ // create a triangle with min/max values for LineEnd and add
+ if(rtl::math::approxEqual(candidate.getEndLeft(), fMax))
{
- const double fMin(std::min(candidate.getStartLeft(), candidate.getStartRight()));
- const double fMax(std::max(candidate.getStartLeft(), candidate.getStartRight()));
- basegfx::B2DPolygon aPolygon;
-
- // create a triangle with min/max values for LineStart and add
- if(rtl::math::approxEqual(candidate.getStartLeft(), fMax))
- {
- aPolygon.append(aStart - aHalfLineOffset - (aVector * candidate.getStartLeft()));
- }
-
- aPolygon.append(aStart - aHalfLineOffset - (aVector * fMin));
- aPolygon.append(aStart + aHalfLineOffset - (aVector * fMin));
-
- if(rtl::math::approxEqual(candidate.getStartRight(), fMax))
- {
- aPolygon.append(aStart + aHalfLineOffset - (aVector * candidate.getStartRight()));
- }
-
- rContainer.push_back(
- new PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(aPolygon),
- candidate.getLineAttribute().getColor()));
-
- // Adapt StrokeStart accordingly
- aStrokeStart = aStart - (aVector * fMin);
+ aPolygon.append(aEnd - aHalfLineOffset + (aVector * candidate.getEndLeft()));
}
- if(!bEndPerpendicular)
+ if(rtl::math::approxEqual(candidate.getEndRight(), fMax))
{
- const double fMin(std::min(candidate.getEndLeft(), candidate.getEndRight()));
- const double fMax(std::max(candidate.getEndLeft(), candidate.getEndRight()));
- basegfx::B2DPolygon aPolygon;
-
- // create a triangle with min/max values for LineEnd and add
- if(rtl::math::approxEqual(candidate.getEndLeft(), fMax))
- {
- aPolygon.append(aEnd - aHalfLineOffset + (aVector * candidate.getEndLeft()));
- }
-
- if(rtl::math::approxEqual(candidate.getEndRight(), fMax))
- {
- aPolygon.append(aEnd + aHalfLineOffset + (aVector * candidate.getEndRight()));
- }
-
- aPolygon.append(aEnd + aHalfLineOffset + (aVector * fMin));
- aPolygon.append(aEnd - aHalfLineOffset + (aVector * fMin));
-
- rContainer.push_back(
- new PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(aPolygon),
- candidate.getLineAttribute().getColor()));
-
- // Adapt StrokeEnd accordingly
- aStrokeEnd = aEnd + (aVector * fMin);
+ aPolygon.append(aEnd + aHalfLineOffset + (aVector * candidate.getEndRight()));
}
- addPolygonStrokePrimitive2D(
- rContainer,
- aStrokeStart,
- aStrokeEnd,
- candidate.getLineAttribute(),
- getStrokeAttribute());
+ aPolygon.append(aEnd + aHalfLineOffset + (aVector * fMin));
+ aPolygon.append(aEnd - aHalfLineOffset + (aVector * fMin));
+
+ rContainer.push_back(
+ new PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(aPolygon),
+ candidate.getLineAttribute().getColor()));
+
+ // Adapt StrokeEnd accordingly
+ aStrokeEnd = aEnd + (aVector * fMin);
}
+
+ addPolygonStrokePrimitive2D(
+ rContainer,
+ aStrokeStart,
+ aStrokeEnd,
+ candidate.getLineAttribute(),
+ getStrokeAttribute());
}
}
-
- fOffset += fWidth;
}
+
+ fOffset += fWidth;
}
}
diff --git a/drawinglayer/source/primitive2d/controlprimitive2d.cxx b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
index 600bb4be8a3f..c3b030dcf1ac 100644
--- a/drawinglayer/source/primitive2d/controlprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/controlprimitive2d.cxx
@@ -45,33 +45,33 @@ namespace drawinglayer::primitive2d
{
void ControlPrimitive2D::createXControl()
{
- if(!mxXControl.is() && getControlModel().is())
- {
- uno::Reference< beans::XPropertySet > xSet(getControlModel(), uno::UNO_QUERY);
+ if(!(!mxXControl.is() && getControlModel().is()))
+ return;
- if(xSet.is())
- {
- uno::Any aValue(xSet->getPropertyValue("DefaultControl"));
- OUString aUnoControlTypeName;
+ uno::Reference< beans::XPropertySet > xSet(getControlModel(), uno::UNO_QUERY);
- if(aValue >>= aUnoControlTypeName)
- {
- if(!aUnoControlTypeName.isEmpty())
- {
- uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- uno::Reference< awt::XControl > xXControl(
- xContext->getServiceManager()->createInstanceWithContext(aUnoControlTypeName, xContext), uno::UNO_QUERY);
+ if(!xSet.is())
+ return;
- if(xXControl.is())
- {
- xXControl->setModel(getControlModel());
+ uno::Any aValue(xSet->getPropertyValue("DefaultControl"));
+ OUString aUnoControlTypeName;
- // remember XControl
- mxXControl = xXControl;
- }
- }
- }
- }
+ if(!(aValue >>= aUnoControlTypeName))
+ return;
+
+ if(aUnoControlTypeName.isEmpty())
+ return;
+
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference< awt::XControl > xXControl(
+ xContext->getServiceManager()->createInstanceWithContext(aUnoControlTypeName, xContext), uno::UNO_QUERY);
+
+ if(xXControl.is())
+ {
+ xXControl->setModel(getControlModel());
+
+ // remember XControl
+ mxXControl = xXControl;
}
}
diff --git a/drawinglayer/source/primitive2d/cropprimitive2d.cxx b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
index 5dbc13ff4119..2d780ac2645c 100644
--- a/drawinglayer/source/primitive2d/cropprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/cropprimitive2d.cxx
@@ -65,82 +65,82 @@ namespace drawinglayer::primitive2d
void CropPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- if(!getChildren().empty())
+ if(getChildren().empty())
+ return;
+
+ // get original object scale in unit coordinates (no mirroring)
+ const basegfx::B2DVector aObjectScale(basegfx::absolute(getTransformation() * basegfx::B2DVector(1.0, 1.0)));
+
+ // we handle cropping, so when no width or no height, content will be empty,
+ // so only do something when we have a width and a height
+ if(aObjectScale.equalZero())
+ return;
+
+ // calculate crop distances in unit coordinates. They are already combined with CropScaleFactor, thus
+ // are relative only to object scale
+ const double fBackScaleX(basegfx::fTools::equalZero(aObjectScale.getX()) ? 1.0 : 1.0 / fabs(aObjectScale.getX()));
+ const double fBackScaleY(basegfx::fTools::equalZero(aObjectScale.getY()) ? 1.0 : 1.0 / fabs(aObjectScale.getY()));
+ const double fLeft(getCropLeft() * fBackScaleX);
+ const double fTop(getCropTop() * fBackScaleY);
+ const double fRight(getCropRight() * fBackScaleX);
+ const double fBottom(getCropBottom() * fBackScaleY);
+
+ // calc new unit range for comparisons; the original range is the unit range
+ const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
+ const basegfx::B2DRange aNewRange(
+ -fLeft,
+ -fTop,
+ 1.0 + fRight,
+ 1.0 + fBottom);
+
+ // if we have no overlap the crop has removed everything, so we do only
+ // have to create content if this is not the case
+ if(!aNewRange.overlaps(aUnitRange))
+ return;
+
+ // create new transform; first take out old transform to get
+ // to unit coordinates by inverting. Inverting should be flawless
+ // since we already checked that object size is not zero in X or Y
+ basegfx::B2DHomMatrix aNewTransform(getTransformation());
+
+ aNewTransform.invert();
+
+ // apply crop enlargement in unit coordinates
+ aNewTransform = basegfx::utils::createScaleTranslateB2DHomMatrix(
+ aNewRange.getRange(),
+ aNewRange.getMinimum()) * aNewTransform;
+
+ // apply original transformation. Since we have manipulated the crop
+ // in unit coordinates we do not need to care about mirroring or
+ // a corrected point for a possible shear or rotation, this all comes for
+ // free
+ aNewTransform = getTransformation() * aNewTransform;
+
+ // prepare TransformPrimitive2D with xPrimitive
+ const Primitive2DReference xTransformPrimitive(
+ new TransformPrimitive2D(
+ aNewTransform,
+ getChildren()));
+
+ if(aUnitRange.isInside(aNewRange))
{
- // get original object scale in unit coordinates (no mirroring)
- const basegfx::B2DVector aObjectScale(basegfx::absolute(getTransformation() * basegfx::B2DVector(1.0, 1.0)));
-
- // we handle cropping, so when no width or no height, content will be empty,
- // so only do something when we have a width and a height
- if(!aObjectScale.equalZero())
- {
- // calculate crop distances in unit coordinates. They are already combined with CropScaleFactor, thus
- // are relative only to object scale
- const double fBackScaleX(basegfx::fTools::equalZero(aObjectScale.getX()) ? 1.0 : 1.0 / fabs(aObjectScale.getX()));
- const double fBackScaleY(basegfx::fTools::equalZero(aObjectScale.getY()) ? 1.0 : 1.0 / fabs(aObjectScale.getY()));
- const double fLeft(getCropLeft() * fBackScaleX);
- const double fTop(getCropTop() * fBackScaleY);
- const double fRight(getCropRight() * fBackScaleX);
- const double fBottom(getCropBottom() * fBackScaleY);
-
- // calc new unit range for comparisons; the original range is the unit range
- const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
- const basegfx::B2DRange aNewRange(
- -fLeft,
- -fTop,
- 1.0 + fRight,
- 1.0 + fBottom);
-
- // if we have no overlap the crop has removed everything, so we do only
- // have to create content if this is not the case
- if(aNewRange.overlaps(aUnitRange))
- {
- // create new transform; first take out old transform to get
- // to unit coordinates by inverting. Inverting should be flawless
- // since we already checked that object size is not zero in X or Y
- basegfx::B2DHomMatrix aNewTransform(getTransformation());
-
- aNewTransform.invert();
-
- // apply crop enlargement in unit coordinates
- aNewTransform = basegfx::utils::createScaleTranslateB2DHomMatrix(
- aNewRange.getRange(),
- aNewRange.getMinimum()) * aNewTransform;
-
- // apply original transformation. Since we have manipulated the crop
- // in unit coordinates we do not need to care about mirroring or
- // a corrected point for a possible shear or rotation, this all comes for
- // free
- aNewTransform = getTransformation() * aNewTransform;
-
- // prepare TransformPrimitive2D with xPrimitive
- const Primitive2DReference xTransformPrimitive(
- new TransformPrimitive2D(
- aNewTransform,
- getChildren()));
-
- if(aUnitRange.isInside(aNewRange))
- {
- // the new range is completely inside the old range (unit range),
- // so no masking is needed
- rVisitor.append(xTransformPrimitive);
- }
- else
- {
- // mask with original object's bounds
- basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::utils::createUnitPolygon());
- aMaskPolyPolygon.transform(getTransformation());
-
- // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector
- const Primitive2DReference xMask(
- new MaskPrimitive2D(
- aMaskPolyPolygon,
- Primitive2DContainer { xTransformPrimitive }));
-
- rVisitor.append(xMask);
- }
- }
- }
+ // the new range is completely inside the old range (unit range),
+ // so no masking is needed
+ rVisitor.append(xTransformPrimitive);
+ }
+ else
+ {
+ // mask with original object's bounds
+ basegfx::B2DPolyPolygon aMaskPolyPolygon(basegfx::utils::createUnitPolygon());
+ aMaskPolyPolygon.transform(getTransformation());
+
+ // create maskPrimitive with aMaskPolyPolygon and aMaskContentVector
+ const Primitive2DReference xMask(
+ new MaskPrimitive2D(
+ aMaskPolyPolygon,
+ Primitive2DContainer { xTransformPrimitive }));
+
+ rVisitor.append(xMask);
}
}
diff --git a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
index bb73067a7d36..17d6f2301a43 100644
--- a/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discretebitmapprimitive2d.cxx
@@ -31,43 +31,43 @@ namespace drawinglayer::primitive2d
// ObjectAndViewTransformationDependentPrimitive2D to create a BitmapPrimitive2D
// with the correct mapping
- if(!getBitmapEx().IsEmpty())
- {
- // get discrete size
- const Size& rSizePixel = getBitmapEx().GetSizePixel();
- const basegfx::B2DVector aDiscreteSize(rSizePixel.Width(), rSizePixel.Height());
-
- // get inverse ViewTransformation
- basegfx::B2DHomMatrix aInverseViewTransformation(getViewTransformation());
- aInverseViewTransformation.invert();
-
- // get size and position in world coordinates
- const basegfx::B2DVector aWorldSize(aInverseViewTransformation * aDiscreteSize);
- const basegfx::B2DPoint aWorldTopLeft(getObjectTransformation() * getTopLeft());
-
- // build object matrix in world coordinates so that the top-left
- // position remains, but possible transformations (e.g. rotations)
- // in the ObjectToView stack remain and get correctly applied
- basegfx::B2DHomMatrix aObjectTransform;
-
- aObjectTransform.set(0, 0, aWorldSize.getX());
- aObjectTransform.set(1, 1, aWorldSize.getY());
- aObjectTransform.set(0, 2, aWorldTopLeft.getX());
- aObjectTransform.set(1, 2, aWorldTopLeft.getY());
-
- // get inverse ObjectTransformation
- basegfx::B2DHomMatrix aInverseObjectTransformation(getObjectTransformation());
- aInverseObjectTransformation.invert();
-
- // transform to object coordinate system
- aObjectTransform = aInverseObjectTransformation * aObjectTransform;
-
- // create BitmapPrimitive2D with now object-local coordinate data
- rContainer.push_back(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getBitmapEx()),
- aObjectTransform));
- }
+ if(getBitmapEx().IsEmpty())
+ return;
+
+ // get discrete size
+ const Size& rSizePixel = getBitmapEx().GetSizePixel();
+ const basegfx::B2DVector aDiscreteSize(rSizePixel.Width(), rSizePixel.Height());
+
+ // get inverse ViewTransformation
+ basegfx::B2DHomMatrix aInverseViewTransformation(getViewTransformation());
+ aInverseViewTransformation.invert();
+
+ // get size and position in world coordinates
+ const basegfx::B2DVector aWorldSize(aInverseViewTransformation * aDiscreteSize);
+ const basegfx::B2DPoint aWorldTopLeft(getObjectTransformation() * getTopLeft());
+
+ // build object matrix in world coordinates so that the top-left
+ // position remains, but possible transformations (e.g. rotations)
+ // in the ObjectToView stack remain and get correctly applied
+ basegfx::B2DHomMatrix aObjectTransform;
+
+ aObjectTransform.set(0, 0, aWorldSize.getX());
+ aObjectTransform.set(1, 1, aWorldSize.getY());
+ aObjectTransform.set(0, 2, aWorldTopLeft.getX());
+ aObjectTransform.set(1, 2, aWorldTopLeft.getY());
+
+ // get inverse ObjectTransformation
+ basegfx::B2DHomMatrix aInverseObjectTransformation(getObjectTransformation());
+ aInverseObjectTransformation.invert();
+
+ // transform to object coordinate system
+ aObjectTransform = aInverseObjectTransformation * aObjectTransform;
+
+ // create BitmapPrimitive2D with now object-local coordinate data
+ rContainer.push_back(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getBitmapEx()),
+ aObjectTransform));
}
DiscreteBitmapPrimitive2D::DiscreteBitmapPrimitive2D(
diff --git a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
index 116389383b4c..3100db147345 100644
--- a/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/discreteshadowprimitive2d.cxx
@@ -161,105 +161,105 @@ namespace drawinglayer::primitive2d
{
Primitive2DContainer xRetval;
- if(!getDiscreteShadow().getBitmapEx().IsEmpty())
- {
- const sal_Int32 nQuarter((getDiscreteShadow().getBitmapEx().GetSizePixel().Width() - 3) >> 2);
- const basegfx::B2DVector aScale(getTransform() * basegfx::B2DVector(1.0, 1.0));
- const double fSingleX(getDiscreteUnit() / aScale.getX());
- const double fSingleY(getDiscreteUnit() / aScale.getY());
- const double fBorderX(fSingleX * nQuarter);
- const double fBorderY(fSingleY * nQuarter);
- const double fBigLenX((fBorderX * 2.0) + fSingleX);
- const double fBigLenY((fBorderY * 2.0) + fSingleY);
-
- xRetval.resize(8);
-
- // TopLeft
- xRetval[0] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTopLeft()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- fBigLenX,
- fBigLenY,
- -fBorderX,
- -fBorderY)));
-
- // Top
- xRetval[1] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTop()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX,
- fBorderY,
- fBorderX + fSingleX,
- -fBorderY)));
-
- // TopRight
- xRetval[2] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTopRight()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- fBigLenX,
- fBigLenY,
- 1.0 - fBorderX,
- -fBorderY)));
-
- // Right
- xRetval[3] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getRight()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- fBorderX,
- 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY,
- 1.0 + fSingleX,
- fBorderY + fSingleY)));
-
- // BottomRight
- xRetval[4] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottomRight()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- fBigLenX,
- fBigLenY,
- 1.0 - (fBorderX + fSingleX) + fSingleX,
- 1.0 - (fBorderY + fSingleY) + fSingleY)));
-
- // Bottom
- xRetval[5] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottom()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX,
- fBorderY,
- fBorderX + fSingleX,
- 1.0 + fSingleY)));
-
- // BottomLeft
- xRetval[6] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottomLeft()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- fBigLenX,
- fBigLenY,
- -fBorderX,
- 1.0 - fBorderY)));
-
- // Left
- xRetval[7] = Primitive2DReference(
- new BitmapPrimitive2D(
- VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getLeft()),
- basegfx::utils::createScaleTranslateB2DHomMatrix(
- fBorderX,
- 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY,
- -fBorderX,
- fBorderY + fSingleY)));
-
- // put all in object transformation to get to target positions
- rContainer.push_back(
- new TransformPrimitive2D(
- getTransform(),
- xRetval));
- }
+ if(getDiscreteShadow().getBitmapEx().IsEmpty())
+ return;
+
+ const sal_Int32 nQuarter((getDiscreteShadow().getBitmapEx().GetSizePixel().Width() - 3) >> 2);
+ const basegfx::B2DVector aScale(getTransform() * basegfx::B2DVector(1.0, 1.0));
+ const double fSingleX(getDiscreteUnit() / aScale.getX());
+ const double fSingleY(getDiscreteUnit() / aScale.getY());
+ const double fBorderX(fSingleX * nQuarter);
+ const double fBorderY(fSingleY * nQuarter);
+ const double fBigLenX((fBorderX * 2.0) + fSingleX);
+ const double fBigLenY((fBorderY * 2.0) + fSingleY);
+
+ xRetval.resize(8);
+
+ // TopLeft
+ xRetval[0] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTopLeft()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ -fBorderX,
+ -fBorderY)));
+
+ // Top
+ xRetval[1] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTop()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX,
+ fBorderY,
+ fBorderX + fSingleX,
+ -fBorderY)));
+
+ // TopRight
+ xRetval[2] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getTopRight()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ 1.0 - fBorderX,
+ -fBorderY)));
+
+ // Right
+ xRetval[3] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getRight()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ fBorderX,
+ 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY,
+ 1.0 + fSingleX,
+ fBorderY + fSingleY)));
+
+ // BottomRight
+ xRetval[4] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottomRight()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ 1.0 - (fBorderX + fSingleX) + fSingleX,
+ 1.0 - (fBorderY + fSingleY) + fSingleY)));
+
+ // Bottom
+ xRetval[5] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottom()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ 1.0 - (2.0 * (fBorderX + fSingleX)) + fSingleX,
+ fBorderY,
+ fBorderX + fSingleX,
+ 1.0 + fSingleY)));
+
+ // BottomLeft
+ xRetval[6] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getBottomLeft()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ fBigLenX,
+ fBigLenY,
+ -fBorderX,
+ 1.0 - fBorderY)));
+
+ // Left
+ xRetval[7] = Primitive2DReference(
+ new BitmapPrimitive2D(
+ VCLUnoHelper::CreateVCLXBitmap(getDiscreteShadow().getLeft()),
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ fBorderX,
+ 1.0 - (2.0 * (fBorderY + fSingleY)) + fSingleY,
+ -fBorderX,
+ fBorderY + fSingleY)));
+
+ // put all in object transformation to get to target positions
+ rContainer.push_back(
+ new TransformPrimitive2D(
+ getTransform(),
+ xRetval));
}
DiscreteShadowPrimitive2D::DiscreteShadowPrimitive2D(
diff --git a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
index 5368016069a9..fba740e833c5 100644
--- a/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgradientprimitive2d.cxx
@@ -201,35 +201,35 @@ namespace drawinglayer::primitive2d
aCombinedPolyPoly,
rOuterColor));
- if(!rEntries.empty())
- {
- // reuse first polygon, it's the second one
- aCombinedPolyPoly.remove(0);
+ if(rEntries.empty())
+ return;
- for(size_t a(0); a < rEntries.size() - 1; a++)
- {
- // create next inner polygon, combined with last one
- basegfx::B2DPolygon aNextPoly(rUnitPolygon);
+ // reuse first polygon, it's the second one
+ aCombinedPolyPoly.remove(0);
- aNextPoly.transform(rEntries[a + 1].maB2DHomMatrix);
- aCombinedPolyPoly.append(aNextPoly);
-
- // create primitive with correct color
- rContainer.push_back(
- new PolyPolygonColorPrimitive2D(
- aCombinedPolyPoly,
- rEntries[a].maBColor));
+ for(size_t a(0); a < rEntries.size() - 1; a++)
+ {
+ // create next inner polygon, combined with last one
+ basegfx::B2DPolygon aNextPoly(rUnitPolygon);
- // reuse inner polygon, it's the 2nd one
- aCombinedPolyPoly.remove(0);
- }
+ aNextPoly.transform(rEntries[a + 1].maB2DHomMatrix);
+ aCombinedPolyPoly.append(aNextPoly);
- // add last inner polygon with last color
+ // create primitive with correct color
rContainer.push_back(
new PolyPolygonColorPrimitive2D(
aCombinedPolyPoly,
- rEntries[rEntries.size() - 1].maBColor));
+ rEntries[a].maBColor));
+
+ // reuse inner polygon, it's the 2nd one
+ aCombinedPolyPoly.remove(0);
}
+
+ // add last inner polygon with last color
+ rContainer.push_back(
+ new PolyPolygonColorPrimitive2D(
+ aCombinedPolyPoly,
+ rEntries[rEntries.size() - 1].maBColor));
}
void FillGradientPrimitive2D::createFill(Primitive2DContainer& rContainer, bool bOverlapping) const
diff --git a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
index af2c75a42720..1bfc47940a87 100644
--- a/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillgraphicprimitive2d.cxx
@@ -36,57 +36,57 @@ namespace drawinglayer::primitive2d
{
const attribute::FillGraphicAttribute& rAttribute = getFillGraphic();
- if(!rAttribute.isDefault())
- {
- const Graphic& rGraphic = rAttribute.getGraphic();
+ if(rAttribute.isDefault())
+ return;
+
+ const Graphic& rGraphic = rAttribute.getGraphic();
+
+ if(!(GraphicType::Bitmap == rGraphic.GetType() || GraphicType::GdiMetafile == rGraphic.GetType()))
+ return;
+
+ const Size aSize(rGraphic.GetPrefSize());
- if(GraphicType::Bitmap == rGraphic.GetType() || GraphicType::GdiMetafile == rGraphic.GetType())
+ if(!(aSize.Width() && aSize.Height()))
+ return;
+
+ // we have a graphic (bitmap or metafile) with some size
+ if(rAttribute.getTiling())
+ {
+ // get object range and create tiling matrices
+ std::vector< basegfx::B2DHomMatrix > aMatrices;
+ texture::GeoTexSvxTiled aTiling(
+ rAttribute.getGraphicRange(),
+ rAttribute.getOffsetX(),
+ rAttribute.getOffsetY());
+
+ // get matrices and realloc retval
+ aTiling.appendTransformations(aMatrices);
+
+ // prepare content primitive
+ Primitive2DContainer xSeq;
+ create2DDecompositionOfGraphic(xSeq,
+ rGraphic,
+ basegfx::B2DHomMatrix());
+
+ for(size_t a(0); a < aMatrices.size(); a++)
{
- const Size aSize(rGraphic.GetPrefSize());
-
- if(aSize.Width() && aSize.Height())
- {
- // we have a graphic (bitmap or metafile) with some size
- if(rAttribute.getTiling())
- {
- // get object range and create tiling matrices
- std::vector< basegfx::B2DHomMatrix > aMatrices;
- texture::GeoTexSvxTiled aTiling(
- rAttribute.getGraphicRange(),
- rAttribute.getOffsetX(),
- rAttribute.getOffsetY());
-
- // get matrices and realloc retval
- aTiling.appendTransformations(aMatrices);
-
- // prepare content primitive
- Primitive2DContainer xSeq;
- create2DDecompositionOfGraphic(xSeq,
- rGraphic,
- basegfx::B2DHomMatrix());
-
- for(size_t a(0); a < aMatrices.size(); a++)
- {
- rContainer.push_back(new TransformPrimitive2D(
- getTransformation() * aMatrices[a],
- xSeq));
- }
- }
- else
- {
- // add graphic without tiling
- const basegfx::B2DHomMatrix aObjectTransform(
- getTransformation() * basegfx::utils::createScaleTranslateB2DHomMatrix(
- rAttribute.getGraphicRange().getRange(),
- rAttribute.getGraphicRange().getMinimum()));
-
- create2DDecompositionOfGraphic(rContainer,
- rGraphic,
- aObjectTransform);
- }
- }
+ rContainer.push_back(new TransformPrimitive2D(
+ getTransformation() * aMatrices[a],
+ xSeq));
}
}
+ else
+ {
+ // add graphic without tiling
+ const basegfx::B2DHomMatrix aObjectTransform(
+ getTransformation() * basegfx::utils::createScaleTranslateB2DHomMatrix(
+ rAttribute.getGraphicRange().getRange(),
+ rAttribute.getGraphicRange().getMinimum()));
+
+ create2DDecompositionOfGraphic(rContainer,
+ rGraphic,
+ aObjectTransform);
+ }
}
FillGraphicPrimitive2D::FillGraphicPrimitive2D(
diff --git a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
index c408c04701b5..5919847ab33c 100644
--- a/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/fillhatchprimitive2d.cxx
@@ -34,96 +34,96 @@ namespace drawinglayer::primitive2d
{
void FillHatchPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- if(!getFillHatch().isDefault())
+ if(getFillHatch().isDefault())
+ return;
+
+ // create hatch
+ const basegfx::BColor aHatchColor(getFillHatch().getColor());
+ const double fAngle(getFillHatch().getAngle());
+ std::vector< basegfx::B2DHomMatrix > aMatrices;
+ double fDistance(getFillHatch().getDistance());
+ const bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
+
+ // #i120230# evtl. adapt distance
+ if(bAdaptDistance)
{
- // create hatch
- const basegfx::BColor aHatchColor(getFillHatch().getColor());
- const double fAngle(getFillHatch().getAngle());
- std::vector< basegfx::B2DHomMatrix > aMatrices;
- double fDistance(getFillHatch().getDistance());
- const bool bAdaptDistance(0 != getFillHatch().getMinimalDiscreteDistance());
-
- // #i120230# evtl. adapt distance
- if(bAdaptDistance)
- {
- const double fDiscreteDistance(getFillHatch().getDistance() / getDiscreteUnit());
+ const double fDiscreteDistance(getFillHatch().getDistance() / getDiscreteUnit());
- if(fDiscreteDistance < static_cast<double>(getFillHatch().getMinimalDiscreteDistance()))
- {
- fDistance = static_cast<double>(getFillHatch().getMinimalDiscreteDistance()) * getDiscreteUnit();
- }
+ if(fDiscreteDistance < static_cast<double>(getFillHatch().getMinimalDiscreteDistance()))
+ {
+ fDistance = static_cast<double>(getFillHatch().getMinimalDiscreteDistance()) * getDiscreteUnit();
}
+ }
- // get hatch transformations
- switch(getFillHatch().getStyle())
+ // get hatch transformations
+ switch(getFillHatch().getStyle())
+ {
+ case attribute::HatchStyle::Triple:
{
- case attribute::HatchStyle::Triple:
- {
- // rotated 45 degrees
- texture::GeoTexSvxHatch aHatch(
- getDefinitionRange(),
- getOutputRange(),
- fDistance,
- fAngle - F_PI4);
-
- aHatch.appendTransformations(aMatrices);
-
- [[fallthrough]];
- }
- case attribute::HatchStyle::Double:
- {
- // rotated 90 degrees
- texture::GeoTexSvxHatch aHatch(
- getDefinitionRange(),
- getOutputRange(),
- fDistance,
- fAngle - F_PI2);
-
- aHatch.appendTransformations(aMatrices);
-
- [[fallthrough]];
- }
- case attribute::HatchStyle::Single:
- {
- // angle as given
- texture::GeoTexSvxHatch aHatch(
- getDefinitionRange(),
- getOutputRange(),
- fDistance,
- fAngle);
-
- aHatch.appendTransformations(aMatrices);
- }
+ // rotated 45 degrees
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle - F_PI4);
+
+ aHatch.appendTransformations(aMatrices);
+
+ [[fallthrough]];
}
+ case attribute::HatchStyle::Double:
+ {
+ // rotated 90 degrees
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle - F_PI2);
- // prepare return value
- const bool bFillBackground(getFillHatch().isFillBackground());
+ aHatch.appendTransformations(aMatrices);
- // evtl. create filled background
- if(bFillBackground)
+ [[fallthrough]];
+ }
+ case attribute::HatchStyle::Single:
{
- // create primitive for background
- rContainer.push_back(
- new PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(
- basegfx::utils::createPolygonFromRect(getOutputRange())), getBColor()));
+ // angle as given
+ texture::GeoTexSvxHatch aHatch(
+ getDefinitionRange(),
+ getOutputRange(),
+ fDistance,
+ fAngle);
+
+ aHatch.appendTransformations(aMatrices);
}
+ }
- // create primitives
- const basegfx::B2DPoint aStart(0.0, 0.0);
- const basegfx::B2DPoint aEnd(1.0, 0.0);
+ // prepare return value
+ const bool bFillBackground(getFillHatch().isFillBackground());
- for(size_t a(0); a < aMatrices.size(); a++)
- {
- const basegfx::B2DHomMatrix& rMatrix = aMatrices[a];
- basegfx::B2DPolygon aNewLine;
+ // evtl. create filled background
+ if(bFillBackground)
+ {
+ // create primitive for background
+ rContainer.push_back(
+ new PolyPolygonColorPrimitive2D(
+ basegfx::B2DPolyPolygon(
+ basegfx::utils::createPolygonFromRect(getOutputRange())), getBColor()));
+ }
- aNewLine.append(rMatrix * aStart);
- aNewLine.append(rMatrix * aEnd);
+ // create primitives
+ const basegfx::B2DPoint aStart(0.0, 0.0);
+ const basegfx::B2DPoint aEnd(1.0, 0.0);
- // create hairline
- rContainer.push_back(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor));
- }
+ for(size_t a(0); a < aMatrices.size(); a++)
+ {
+ const basegfx::B2DHomMatrix& rMatrix = aMatrices[a];
+ basegfx::B2DPolygon aNewLine;
+
+ aNewLine.append(rMatrix * aStart);
+ aNewLine.append(rMatrix * aEnd);
+
+ // create hairline
+ rContainer.push_back(new PolygonHairlinePrimitive2D(aNewLine, aHatchColor));
}
}
diff --git a/drawinglayer/source/primitive2d/glowprimitive2d.cxx b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
index 1fc035bf5279..7d6c23a322ad 100644
--- a/drawinglayer/source/primitive2d/glowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/glowprimitive2d.cxx
@@ -64,19 +64,18 @@ void GlowPrimitive2D::get2DDecomposition(
Primitive2DDecompositionVisitor& rVisitor,
const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- if (!getChildren().empty())
- {
- // create a modifiedColorPrimitive containing the Glow color and the content
- basegfx::BColorModifierSharedPtr aBColorModifier
- = std::make_shared<basegfx::BColorModifier_replace>(getGlowColor());
+ if (getChildren().empty())
+ return;
- const Primitive2DReference xRefA(
- new ModifiedColorPrimitive2D(getChildren(), aBColorModifier));
- const Primitive2DContainer aSequenceB{ xRefA };
+ // create a modifiedColorPrimitive containing the Glow color and the content
+ basegfx::BColorModifierSharedPtr aBColorModifier
+ = std::make_shared<basegfx::BColorModifier_replace>(getGlowColor());
- // build transformed primitiveVector with Glow offset and add to target
- rVisitor.append(new TransformPrimitive2D(getGlowTransform(), aSequenceB));
- }
+ const Primitive2DReference xRefA(new ModifiedColorPrimitive2D(getChildren(), aBColorModifier));
+ const Primitive2DContainer aSequenceB{ xRefA };
+
+ // build transformed primitiveVector with Glow offset and add to target
+ rVisitor.append(new TransformPrimitive2D(getGlowTransform(), aSequenceB));
}
// provide unique ID
diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
index d301adc16a9c..69caa9956e96 100644
--- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
+++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx
@@ -90,26 +90,26 @@ namespace drawinglayer::primitive2d
void ensureVirtualDeviceSizeAndState()
{
- if (isValidData())
- {
- const Size aCurrent(maVirtualDevice->GetOutputSizePixel());
- const Size aTarget(maAnimation.GetDisplaySizePixel());
+ if (!isValidData())
+ return;
- if (aCurrent != aTarget)
- {
- maVirtualDevice->EnableMapMode(false);
- maVirtualDeviceMask->EnableMapMode(false);
- maVirtualDevice->SetOutputSizePixel(aTarget);
- maVirtualDeviceMask->SetOutputSizePixel(aTarget);
- }
+ const Size aCurrent(maVirtualDevice->GetOutputSizePixel());
+ const Size aTarget(maAnimation.GetDisplaySizePixel());
- maVirtualDevice->Erase();
- maVirtualDeviceMask->Erase();
- const ::tools::Rectangle aRect(Point(0, 0), aTarget);
- maVirtualDeviceMask->SetFillColor(COL_BLACK);
- maVirtualDeviceMask->SetLineColor();
- maVirtualDeviceMask->DrawRect(aRect);
+ if (aCurrent != aTarget)
+ {
+ maVirtualDevice->EnableMapMode(false);
+ maVirtualDeviceMask->EnableMapMode(false);
+ maVirtualDevice->SetOutputSizePixel(aTarget);
+ maVirtualDeviceMask->SetOutputSizePixel(aTarget);
}
+
+ maVirtualDevice->Erase();
+ maVirtualDeviceMask->Erase();
+ const ::tools::Rectangle aRect(Point(0, 0), aTarget);
+ maVirtualDeviceMask->SetFillColor(COL_BLACK);
+ maVirtualDeviceMask->SetLineColor();
+ maVirtualDeviceMask->DrawRect(aRect);
}
sal_uInt32 generateStepTime(sal_uInt32 nIndex) const
@@ -139,24 +139,24 @@ namespace drawinglayer::primitive2d
void createAndSetAnimationTiming()
{
- if (isValidData())
- {
- animation::AnimationEntryLoop aAnimationLoop(maAnimation.GetLoopCount() ? maAnimation.GetLoopCount() : 0xffff);
- const sal_uInt32 nCount(maAnimation.Count());
-
- for (sal_uInt32 a(0); a < nCount; a++)
- {
- const sal_uInt32 aStepTime(generateStepTime(a));
- const animation::AnimationEntryFixed aTime(static_cast<double>(aStepTime), static_cast<double>(a) / static_cast<double>(nCount));
+ if (!isValidData())
+ return;
- aAnimationLoop.append(aTime);
- }
+ animation::AnimationEntryLoop aAnimationLoop(maAnimation.GetLoopCount() ? maAnimation.GetLoopCount() : 0xffff);
+ const sal_uInt32 nCount(maAnimation.Count());
- animation::AnimationEntryList aAnimationEntryList;
- aAnimationEntryList.append(aAnimationLoop);
+ for (sal_uInt32 a(0); a < nCount; a++)
+ {
+ const sal_uInt32 aStepTime(generateStepTime(a));
+ const animation::AnimationEntryFixed aTime(static_cast<double>(aStepTime), static_cast<double>(a) / static_cast<double>(nCount));
- setAnimationEntry(aAnimationEntryList);
+ aAnimationLoop.append(aTime);
}
+
+ animation::AnimationEntryList aAnimationEntryList;
+ aAnimationEntryList.append(aAnimationLoop);
+
+ setAnimationEntry(aAnimationEntryList);
}
Primitive2DReference createFromBuffer() const
@@ -221,80 +221,80 @@ namespace drawinglayer::primitive2d
// mnNextFrameToPrepare is the target frame to create next (which implies that
// mnNextFrameToPrepare-1 *is* currently in the VirtualDevice when
// 0 != mnNextFrameToPrepare. nTarget is the target frame.
- if (isValidData())
+ if (!isValidData())
+ return;
+
+ if (mnNextFrameToPrepare > nTarget)
{
- if (mnNextFrameToPrepare > nTarget)
- {
- // we are ahead request, reset mechanism to start at frame zero
- ensureVirtualDeviceSizeAndState();
- mnNextFrameToPrepare = 0;
- }
+ // we are ahead request, reset mechanism to start at frame zero
+ ensureVirtualDeviceSizeAndState();
+ mnNextFrameToPrepare = 0;
+ }
- while (mnNextFrameToPrepare <= nTarget)
- {
- // prepare step
- const AnimationBitmap& rAnimationBitmap = maAnimation.Get(sal_uInt16(mnNextFrameToPrepare));
+ while (mnNextFrameToPrepare <= nTarget)
+ {
+ // prepare step
+ const AnimationBitmap& rAnimationBitmap = maAnimation.Get(sal_uInt16(mnNextFrameToPrepare));
- switch (rAnimationBitmap.meDisposal)
+ switch (rAnimationBitmap.meDisposal)
+ {
+ case Disposal::Not:
{
- case Disposal::Not:
- {
- maVirtualDevice->DrawBitmapEx(rAnimationBitmap.maPositionPixel, rAnimationBitmap.maBitmapEx);
- Bitmap aMask = rAnimationBitmap.maBitmapEx.GetMask();
-
- if (aMask.IsEmpty())
- {
- const Point aEmpty;
- const ::tools::Rectangle aRect(aEmpty, maVirtualDeviceMask->GetOutputSizePixel());
- const Wallpaper aWallpaper(COL_BLACK);
- maVirtualDeviceMask->DrawWallpaper(aRect, aWallpaper);
- }
- else
- {
- BitmapEx aExpandVisibilityMask(aMask, aMask);
- maVirtualDeviceMask->DrawBitmapEx(rAnimationBitmap.maPositionPixel, aExpandVisibilityMask);
- }
+ maVirtualDevice->DrawBitmapEx(rAnimationBitmap.maPositionPixel, rAnimationBitmap.maBitmapEx);
+ Bitmap aMask = rAnimationBitmap.maBitmapEx.GetMask();
- break;
+ if (aMask.IsEmpty())
+ {
+ const Point aEmpty;
+ const ::tools::Rectangle aRect(aEmpty, maVirtualDeviceMask->GetOutputSizePixel());
+ const Wallpaper aWallpaper(COL_BLACK);
+ maVirtualDeviceMask->DrawWallpaper(aRect, aWallpaper);
}
- case Disposal::Back:
+ else
{
- // #i70772# react on no mask, for primitives, too.
- const Bitmap & rMask(rAnimationBitmap.maBitmapEx.GetMask());
- const Bitmap & rContent(rAnimationBitmap.maBitmapEx.GetBitmap());
+ BitmapEx aExpandVisibilityMask(aMask, aMask);
+ maVirtualDeviceMask->DrawBitmapEx(rAnimationBitmap.maPositionPixel, aExpandVisibilityMask);
+ }
- maVirtualDeviceMask->Erase();
- maVirtualDevice->DrawBitmap(rAnimationBitmap.maPositionPixel, rContent);
+ break;
+ }
+ case Disposal::Back:
+ {
+ // #i70772# react on no mask, for primitives, too.
+ const Bitmap & rMask(rAnimationBitmap.maBitmapEx.GetMask());
+ const Bitmap & rContent(rAnimationBitmap.maBitmapEx.GetBitmap());
- if (rMask.IsEmpty())
- {
- const ::tools::Rectangle aRect(rAnimationBitmap.maPositionPixel, rContent.GetSizePixel());
- maVirtualDeviceMask->SetFillColor(COL_BLACK);
- maVirtualDeviceMask->SetLineColor();
- maVirtualDeviceMask->DrawRect(aRect);
- }
- else
- {
- BitmapEx aExpandVisibilityMask(rMask, rMask);
- maVirtualDeviceMask->DrawBitmapEx(rAnimationBitmap.maPositionPixel, aExpandVisibilityMask);
- }
+ maVirtualDeviceMask->Erase();
+ maVirtualDevice->DrawBitmap(rAnimationBitmap.maPositionPixel, rContent);
- break;
+ if (rMask.IsEmpty())
+ {
+ const ::tools::Rectangle aRect(rAnimationBitmap.maPositionPixel, rContent.GetSizePixel());
+ maVirtualDeviceMask->SetFillColor(COL_BLACK);
+ maVirtualDeviceMask->SetLineColor();
+ maVirtualDeviceMask->DrawRect(aRect);
}
- case Disposal::Previous:
+ else
{
- maVirtualDevice->DrawBitmapEx(rAnimationBitmap.maPositionPixel, rAnimationBitmap.maBitmapEx);
- BitmapEx aExpandVisibilityMask(rAnimationBitmap.maBitmapEx.GetMask(), rAnimationBitmap.maBitmapEx.GetMask());
+ BitmapEx aExpandVisibilityMask(rMask, rMask);
maVirtualDeviceMask->DrawBitmapEx(rAnimationBitmap.maPositionPixel, aExpandVisibilityMask);
- break;
}
+
+ break;
+ }
+ case Disposal::Previous:
+ {
+ maVirtualDevice->DrawBitmapEx(rAnimationBitmap.maPositionPixel, rAnimationBitmap.maBitmapEx);
+ BitmapEx aExpandVisibilityMask(rAnimationBitmap.maBitmapEx.GetMask(), rAnimationBitmap.maBitmapEx.GetMask());
+ maVirtualDeviceMask->DrawBitmapEx(rAnimationBitmap.maPositionPixel, aExpandVisibilityMask);
+ break;
}
+ }
- // to not waste created data, check adding to buffers
- checkSafeToBuffer(mnNextFrameToPrepare);
+ // to not waste created data, check adding to buffers
+ checkSafeToBuffer(mnNextFrameToPrepare);
- mnNextFrameToPrepare++;
- }
+ mnNextFrameToPrepare++;
}
}
@@ -409,53 +409,53 @@ namespace drawinglayer::primitive2d
void AnimatedGraphicPrimitive2D::get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const
{
- if (isValidData())
- {
- Primitive2DReference aRetval;
- const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
- const sal_uInt32 nLen(maAnimation.Count());
- sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
-
- // nIndex is the requested frame - it is in range [0..nLen[
- // create frame representation in VirtualDevices
- if (nIndex >= nLen)
- {
- nIndex = nLen - 1;
- }
+ if (!isValidData())
+ return;
- // check buffering shortcuts, may already be created
- aRetval = tryTogetFromBuffer(nIndex);
+ Primitive2DReference aRetval;
+ const double fState(getAnimationEntry().getStateAtTime(rViewInformation.getViewTime()));
+ const sal_uInt32 nLen(maAnimation.Count());
+ sal_uInt32 nIndex(basegfx::fround(fState * static_cast<double>(nLen)));
- if (aRetval.is())
- {
- rVisitor.append(aRetval);
- return;
- }
+ // nIndex is the requested frame - it is in range [0..nLen[
+ // create frame representation in VirtualDevices
+ if (nIndex >= nLen)
+ {
+ nIndex = nLen - 1;
+ }
- // if huge size (and not the buffered 1st frame) simply
- // create next frame
- if (mbHugeSize && 0 != nIndex && mnNextFrameToPrepare <= nIndex)
- {
- nIndex = mnNextFrameToPrepare % nLen;
- }
+ // check buffering shortcuts, may already be created
+ aRetval = tryTogetFromBuffer(nIndex);
- // frame not (yet) buffered or no buffering allowed, create it
- const_cast<AnimatedGraphicPrimitive2D*>(this)->createFrame(nIndex);
+ if (aRetval.is())
+ {
+ rVisitor.append(aRetval);
+ return;
+ }
- // try to get from buffer again, may have been added from createFrame
- aRetval = tryTogetFromBuffer(nIndex);
+ // if huge size (and not the buffered 1st frame) simply
+ // create next frame
+ if (mbHugeSize && 0 != nIndex && mnNextFrameToPrepare <= nIndex)
+ {
+ nIndex = mnNextFrameToPrepare % nLen;
+ }
- if (aRetval.is())
- {
- rVisitor.append(aRetval);
- return;
- }
+ // frame not (yet) buffered or no buffering allowed, create it
+ const_cast<AnimatedGraphicPrimitive2D*>(this)->createFrame(nIndex);
- // did not work (not buffered and not 1st frame), create from buffer
- aRetval = createFromBuffer();
+ // try to get from buffer again, may have been added from createFrame
+ aRetval = tryTogetFromBuffer(nIndex);
+ if (aRetval.is())
+ {
rVisitor.append(aRetval);
+ return;
}
+
+ // did not work (not buffered and not 1st frame), create from buffer
+ aRetval = createFromBuffer();
+
+ rVisitor.append(aRetval);
}
} // end of namespace
diff --git a/drawinglayer/source/primitive2d/gridprimitive2d.cxx b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
index 232c35fa66c2..66a747452103 100644
--- a/drawinglayer/source/primitive2d/gridprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/gridprimitive2d.cxx
@@ -32,221 +32,221 @@ namespace drawinglayer::primitive2d
{
void GridPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const
{
- if(!rViewInformation.getViewport().isEmpty() && getWidth() > 0.0 && getHeight() > 0.0)
+ if(!(!rViewInformation.getViewport().isEmpty() && getWidth() > 0.0 && getHeight() > 0.0))
+ return;
+
+ // decompose grid matrix to get logic size
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // create grid matrix which transforms from scaled logic to view
+ basegfx::B2DHomMatrix aRST(basegfx::utils::createShearXRotateTranslateB2DHomMatrix(
+ fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
+ aRST *= rViewInformation.getObjectToViewTransformation();
+
+ // get step widths
+ double fStepX(getWidth());
+ double fStepY(getHeight());
+ const double fMinimalStep(10.0);
+
+ // guarantee a step width of 10.0
+ if(basegfx::fTools::less(fStepX, fMinimalStep))
{
- // decompose grid matrix to get logic size
- basegfx::B2DVector aScale, aTranslate;
- double fRotate, fShearX;
- getTransform().decompose(aScale, aTranslate, fRotate, fShearX);
-
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list