diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-23 14:04:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-23 19:49:43 +0200 |
commit | d4248915d7db69aa7bf31d9d6189b7375aca70ed (patch) | |
tree | 03e53496dd63b2a9725ede707c78cc02079d1018 /svx/source/unodraw | |
parent | 3cbcaa8d36ef889a28d790e18d68b838cfc46bb2 (diff) |
pass SvxBrushItem around by unique_ptr
we never create an object that is actually shared, so this is wasted
Note1: in
IMPL_LINK_NOARG(SwEditRegionDlg, OkHdl, weld::Button&, void)
there was a comparison
if( aBrush != pRepr->GetBackground() || ...
which I removed
Note2: In
bool SwDoc::GetBoxAttr( const SwCursor& rCursor, std::shared_ptr<SfxPoolItem>& rToFill )
which had a condition
else if( rToFill != xBack )
I changed to compare contents
Change-Id: Idd769f44917c5ccc7e9f4bfbaddf12f9cd4151cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92791
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/unodraw')
-rw-r--r-- | svx/source/unodraw/unobrushitemhelper.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx index f62356026efa..e6c5758db9c1 100644 --- a/svx/source/unodraw/unobrushitemhelper.cxx +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -167,7 +167,7 @@ static sal_uInt16 getTransparenceForSvxBrushItem(const SfxItemSet& rSourceSet, b return nFillTransparence; } -static std::shared_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID) +static std::unique_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& rSourceSet, bool bSearchInParents, sal_uInt16 nBackgroundID) { Color aFillColor(rSourceSet.Get(XATTR_FILLCOLOR, bSearchInParents).GetColorValue()); @@ -184,10 +184,10 @@ static std::shared_ptr<SvxBrushItem> getSvxBrushItemForSolid(const SfxItemSet& r aFillColor.SetTransparency(aTargetTrans); } - return std::make_shared<SvxBrushItem>(aFillColor, nBackgroundID); + return std::make_unique<SvxBrushItem>(aFillColor, nBackgroundID); } -std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack) +std::unique_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt16 nBackgroundID, bool bSearchInParents, bool bXMLImportHack) { const XFillStyleItem* pXFillStyleItem(rSourceSet.GetItem<XFillStyleItem>(XATTR_FILLSTYLE, bSearchInParents)); @@ -202,10 +202,10 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo aFillColor.SetTransparency(0xff); - return std::make_shared<SvxBrushItem>(aFillColor, nBackgroundID); + return std::make_unique<SvxBrushItem>(aFillColor, nBackgroundID); } - auto aRetval = std::make_shared<SvxBrushItem>(nBackgroundID); + auto aRetval = std::make_unique<SvxBrushItem>(nBackgroundID); switch(pXFillStyleItem->GetValue()) { @@ -244,7 +244,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo aMixedColor.SetTransparency(aTargetTrans); } - aRetval = std::make_shared<SvxBrushItem>(aMixedColor, nBackgroundID); + aRetval = std::make_unique<SvxBrushItem>(aMixedColor, nBackgroundID); break; } case drawing::FillStyle_HATCH: @@ -276,7 +276,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo const sal_uInt8 aTargetTrans(std::min(sal_uInt8(0xfe), static_cast< sal_uInt8 >((nFillTransparence * 254) / 100))); aHatchColor.SetTransparency(aTargetTrans); - aRetval = std::make_shared<SvxBrushItem>(aHatchColor, nBackgroundID); + aRetval = std::make_unique<SvxBrushItem>(aHatchColor, nBackgroundID); } break; @@ -319,7 +319,7 @@ std::shared_ptr<SvxBrushItem> getSvxBrushItemFromSourceSet(const SfxItemSet& rSo } // create with given graphic and position - aRetval = std::make_shared<SvxBrushItem>(aGraphic, aSvxGraphicPosition, nBackgroundID); + aRetval = std::make_unique<SvxBrushItem>(aGraphic, aSvxGraphicPosition, nBackgroundID); // get evtl. mixed transparence const sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); |