summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-03-01 11:51:07 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-03-01 13:07:33 +0000
commit6ca077ee7156123ec38a6cfdde7168749589d0ff (patch)
tree9701a7ffc85dc58f3af1aebc35427263cc9be7e1 /filter
parent6e8c67580974484c790f52991de26298ce8e7e1c (diff)
no need to allocate Gradient separately
it is only one pointer big Change-Id: I21afdeb8015c658c7b9d5db24bceeb8e43694272 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148038 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/svg/svgwriter.cxx15
-rw-r--r--filter/source/svg/svgwriter.hxx2
2 files changed, 9 insertions, 8 deletions
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index e4420dc27e71..d6909bcdb070 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -2119,10 +2119,11 @@ void SVGActionWriter::ImplWriteShape( const SVGShapeDescriptor& rShape )
ImplMap( rShape.maShapePolyPoly, aPolyPoly );
const bool bLineOnly
- = (rShape.maShapeFillColor == COL_TRANSPARENT) && (!rShape.mapShapeGradient);
+ = (rShape.maShapeFillColor == COL_TRANSPARENT) && (!rShape.moShapeGradient);
tools::Rectangle aBoundRect( aPolyPoly.GetBoundRect() );
- maAttributeWriter.AddPaintAttr( rShape.maShapeLineColor, rShape.maShapeFillColor, &aBoundRect, rShape.mapShapeGradient.get() );
+ maAttributeWriter.AddPaintAttr( rShape.maShapeLineColor, rShape.maShapeFillColor, &aBoundRect,
+ rShape.moShapeGradient ? &*rShape.moShapeGradient : nullptr );
if( !rShape.maId.isEmpty() )
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrId, rShape.maId );
@@ -3440,7 +3441,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
if( bGradient )
{
// step through following actions until the first Gradient/GradientEx action is found
- while (!mapCurShape->mapShapeGradient && bSkip
+ while (!mapCurShape->moShapeGradient && bSkip
&& (++nCurAction < nCount))
{
pAction = rMtf.GetAction( nCurAction );
@@ -3453,13 +3454,13 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
}
else if( pAction->GetType() == MetaActionType::GRADIENTEX )
{
- mapCurShape->mapShapeGradient.reset( new Gradient(
- static_cast< const MetaGradientExAction* >( pAction )->GetGradient() ) );
+ mapCurShape->moShapeGradient.emplace(
+ static_cast< const MetaGradientExAction* >( pAction )->GetGradient() );
}
else if( pAction->GetType() == MetaActionType::GRADIENT )
{
- mapCurShape->mapShapeGradient.reset( new Gradient(
- static_cast< const MetaGradientAction* >( pAction )->GetGradient() ) );
+ mapCurShape->moShapeGradient.emplace(
+ static_cast< const MetaGradientAction* >( pAction )->GetGradient() );
}
}
}
diff --git a/filter/source/svg/svgwriter.hxx b/filter/source/svg/svgwriter.hxx
index 022c2585c5ab..16ac77a20026 100644
--- a/filter/source/svg/svgwriter.hxx
+++ b/filter/source/svg/svgwriter.hxx
@@ -164,7 +164,7 @@ struct SVGShapeDescriptor
Color maShapeLineColor;
sal_Int32 mnStrokeWidth;
SvtGraphicStroke::DashArray maDashArray;
- ::std::unique_ptr< Gradient > mapShapeGradient;
+ ::std::optional< Gradient > moShapeGradient;
OUString maId;
basegfx::B2DLineJoin maLineJoin;
css::drawing::LineCap maLineCap;