summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-02-07 09:16:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-02-07 11:27:10 +0100
commitf9772bee2bc95a5b1880286dfb255e026cbd8a1e (patch)
treeed26a0b10d67e1bf24640d5664cdb8dc4bfad2dd /svx
parent10cc0f3d2ddaa5d7f6ee18042dacfc67c1be96af (diff)
simplify some Primitive2DContainer construction
Change-Id: Iced31da6891a5d218d63e9b59d48fb2645f39203 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163071 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/sdr/attribute/sdrallfillattributeshelper.cxx16
-rw-r--r--svx/source/sdr/overlay/overlaytools.cxx51
-rw-r--r--svx/source/svdraw/svdhdl.cxx4
-rw-r--r--svx/source/xoutdev/xtabgrdt.cxx7
-rw-r--r--svx/source/xoutdev/xtabhtch.cxx6
5 files changed, 38 insertions, 46 deletions
diff --git a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
index 25e44f942f76..fa0cf7a59c58 100644
--- a/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
+++ b/svx/source/sdr/attribute/sdrallfillattributeshelper.cxx
@@ -40,14 +40,14 @@ namespace drawinglayer::attribute
if(isUsed())
{
- maPrimitives.resize(1);
- maPrimitives[0] = drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
- basegfx::B2DPolyPolygon(
- basegfx::utils::createPolygonFromRect(
- maLastPaintRange)),
- maLastDefineRange,
- maFillAttribute ? *maFillAttribute : drawinglayer::attribute::SdrFillAttribute(),
- maFillGradientAttribute ? *maFillGradientAttribute : drawinglayer::attribute::FillGradientAttribute());
+ maPrimitives = drawinglayer::primitive2d::Primitive2DContainer {
+ drawinglayer::primitive2d::createPolyPolygonFillPrimitive(
+ basegfx::B2DPolyPolygon(
+ basegfx::utils::createPolygonFromRect(
+ maLastPaintRange)),
+ maLastDefineRange,
+ maFillAttribute ? *maFillAttribute : drawinglayer::attribute::SdrFillAttribute(),
+ maFillGradientAttribute ? *maFillGradientAttribute : drawinglayer::attribute::FillGradientAttribute()) };
}
}
diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx
index 7d4afca24205..89b8d422c5b3 100644
--- a/svx/source/sdr/overlay/overlaytools.cxx
+++ b/svx/source/sdr/overlay/overlaytools.cxx
@@ -55,7 +55,6 @@ OverlayStaticRectanglePrimitive::OverlayStaticRectanglePrimitive(
void OverlayStaticRectanglePrimitive::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
{
- Primitive2DContainer aPrimitive2DSequence;
const double fHalfWidth = maSize.getWidth() * getDiscreteUnit() / 2.0;
const double fHalfHeight = maSize.getHeight() * getDiscreteUnit() / 2.0;
@@ -63,39 +62,37 @@ void OverlayStaticRectanglePrimitive::create2DDecomposition(Primitive2DContainer
maPosition.getX() - fHalfWidth, maPosition.getY() - fHalfHeight,
maPosition.getX() + fHalfWidth, maPosition.getY() + fHalfHeight);
- if (basegfx::fTools::more(getDiscreteUnit(), 0.0) && mfTransparence <= 1.0)
- {
- basegfx::B2DPolygon aPolygon(
- basegfx::utils::createPolygonFromRect(aRange));
+ if (!basegfx::fTools::more(getDiscreteUnit(), 0.0) || mfTransparence > 1.0)
+ return;
- // create filled primitive
- basegfx::B2DPolyPolygon aPolyPolygon;
- aPolyPolygon.append(aPolygon);
+ basegfx::B2DPolygon aPolygon(
+ basegfx::utils::createPolygonFromRect(aRange));
- const attribute::LineAttribute aLineAttribute(maStrokeColor, 1.0);
+ // create filled primitive
+ basegfx::B2DPolyPolygon aPolyPolygon;
+ aPolyPolygon.append(aPolygon);
- // create data
- const Primitive2DReference aStroke(
- new PolyPolygonStrokePrimitive2D(aPolyPolygon, aLineAttribute));
+ const attribute::LineAttribute aLineAttribute(maStrokeColor, 1.0);
- // create fill primitive
- const Primitive2DReference aFill(
- new PolyPolygonColorPrimitive2D(std::move(aPolyPolygon), maFillColor));
+ // create data
+ const Primitive2DReference aStroke(
+ new PolyPolygonStrokePrimitive2D(aPolyPolygon, aLineAttribute));
- aPrimitive2DSequence = Primitive2DContainer(2);
- aPrimitive2DSequence[0] = aFill;
- aPrimitive2DSequence[1] = aStroke;
+ // create fill primitive
+ const Primitive2DReference aFill(
+ new PolyPolygonColorPrimitive2D(std::move(aPolyPolygon), maFillColor));
- // embed filled to transparency (if used)
- if (mfTransparence > 0.0)
- {
- const Primitive2DReference aFillTransparent(
- new UnifiedTransparencePrimitive2D(
- std::move(aPrimitive2DSequence),
- mfTransparence));
+ Primitive2DContainer aPrimitive2DSequence { aFill, aStroke };
- aPrimitive2DSequence = Primitive2DContainer { aFillTransparent };
- }
+ // embed filled to transparency (if used)
+ if (mfTransparence > 0.0)
+ {
+ const Primitive2DReference aFillTransparent(
+ new UnifiedTransparencePrimitive2D(
+ std::move(aPrimitive2DSequence),
+ mfTransparence));
+
+ aPrimitive2DSequence = Primitive2DContainer { aFillTransparent };
}
rContainer.append(std::move(aPrimitive2DSequence));
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 867afa6a90b8..ad50c7680a5e 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2628,9 +2628,7 @@ void SdrCropViewHdl::CreateB2dIAObject()
aHilightColor));
// combine these
- drawinglayer::primitive2d::Primitive2DContainer aCombination(2);
- aCombination[0] = aGraphic;
- aCombination[1] = aGraphicOutline;
+ drawinglayer::primitive2d::Primitive2DContainer aCombination { aGraphic, aGraphicOutline };
// embed to MaskPrimitive2D
const drawinglayer::primitive2d::Primitive2DReference aMaskedGraphic(
diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx
index 11c985b461ad..f7ad60771874 100644
--- a/svx/source/xoutdev/xtabgrdt.cxx
+++ b/svx/source/xoutdev/xtabgrdt.cxx
@@ -144,10 +144,9 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, const Size& rSize ) co
*pVirtualDevice,
aNewViewInformation2D));
- drawinglayer::primitive2d::Primitive2DContainer aSequence(2);
-
- aSequence[0] = aGradientPrimitive;
- aSequence[1] = aBlackRectanglePrimitive;
+ drawinglayer::primitive2d::Primitive2DContainer aSequence {
+ aGradientPrimitive,
+ aBlackRectanglePrimitive };
pProcessor2D->process(aSequence);
pProcessor2D.reset();
diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx
index 1a4219db898b..97cb500dc600 100644
--- a/svx/source/xoutdev/xtabhtch.cxx
+++ b/svx/source/xoutdev/xtabhtch.cxx
@@ -164,10 +164,8 @@ BitmapEx XHatchList::CreateBitmap( tools::Long nIndex, const Size& rSize) const
*pVirtualDevice,
aNewViewInformation2D));
- drawinglayer::primitive2d::Primitive2DContainer aSequence(2);
-
- aSequence[0] = aHatchPrimitive;
- aSequence[1] = aBlackRectanglePrimitive;
+ drawinglayer::primitive2d::Primitive2DContainer aSequence {
+ aHatchPrimitive, aBlackRectanglePrimitive };
pProcessor2D->process(aSequence);
pProcessor2D.reset();