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>
This commit is contained in:
@@ -2409,7 +2409,7 @@ namespace cppcanvas::internal
|
||||
|
||||
// TODO(P2): Use native canvas gradients here (saves a lot of UNO calls)
|
||||
internal::GradientAutoPtr pGradient(
|
||||
new Gradient( pAct->GetGradient() ) );
|
||||
pAct->GetGradient() );
|
||||
|
||||
DBG_TESTSOLARMUTEX();
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cppcanvas/canvas.hxx>
|
||||
#include <vcl/gradient.hxx>
|
||||
#include <action.hxx>
|
||||
|
||||
#include <memory>
|
||||
@@ -30,7 +31,6 @@ namespace basegfx {
|
||||
}
|
||||
|
||||
class GDIMetaFile;
|
||||
class Gradient;
|
||||
|
||||
|
||||
/* Definition of internal::TransparencyGroupActionFactory */
|
||||
@@ -40,7 +40,7 @@ namespace cppcanvas::internal
|
||||
struct OutDevState;
|
||||
|
||||
typedef std::unique_ptr< GDIMetaFile > MtfAutoPtr;
|
||||
typedef std::unique_ptr< Gradient > GradientAutoPtr;
|
||||
typedef std::optional< Gradient > GradientAutoPtr;
|
||||
|
||||
/** Transparency group action.
|
||||
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user