[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer sc/source svx/source sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Jul 16 06:39:42 UTC 2018
drawinglayer/source/processor2d/processor2dtools.cxx | 9 +++---
drawinglayer/source/processor2d/processorfromoutputdevice.cxx | 7 ++---
drawinglayer/source/tools/converters.cxx | 4 +-
include/drawinglayer/processor2d/processor2dtools.hxx | 5 ++-
include/drawinglayer/processor2d/processorfromoutputdevice.hxx | 3 +-
sc/source/ui/inc/output.hxx | 2 -
sc/source/ui/view/output.cxx | 2 -
svx/source/dialog/pagectrl.cxx | 10 ++-----
sw/source/core/doc/notxtfrm.cxx | 6 +---
sw/source/core/inc/frame.hxx | 2 -
sw/source/core/layout/paintfrm.cxx | 14 ++--------
11 files changed, 29 insertions(+), 35 deletions(-)
New commits:
commit 03a651d48e7cb3b19c98bdf3ed0a1080b60974ae
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Sun Jul 15 12:05:08 2018 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 16 08:39:20 2018 +0200
return BaseProcessor2D by std::unique_ptr
Change-Id: Ibad6e989d2d7ba779e7557e41552d06c076f657b
Reviewed-on: https://gerrit.libreoffice.org/57448
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/drawinglayer/source/processor2d/processor2dtools.cxx b/drawinglayer/source/processor2d/processor2dtools.cxx
index 49863873ddba..9d7e1aed245c 100644
--- a/drawinglayer/source/processor2d/processor2dtools.cxx
+++ b/drawinglayer/source/processor2d/processor2dtools.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <drawinglayer/processor2d/processor2dtools.hxx>
+#include <o3tl/make_unique.hxx>
#include "vclpixelprocessor2d.hxx"
#include "vclmetafileprocessor2d.hxx"
@@ -28,15 +29,15 @@ namespace drawinglayer
{
namespace processor2d
{
- BaseProcessor2D* createPixelProcessor2DFromOutputDevice(
+ std::unique_ptr<BaseProcessor2D> createPixelProcessor2DFromOutputDevice(
OutputDevice& rTargetOutDev,
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
{
// create Pixel Vcl-Processor
- return new VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
+ return o3tl::make_unique<VclPixelProcessor2D>(rViewInformation2D, rTargetOutDev);
}
- BaseProcessor2D* createProcessor2DFromOutputDevice(
+ std::unique_ptr<BaseProcessor2D> createProcessor2DFromOutputDevice(
OutputDevice& rTargetOutDev,
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
{
@@ -46,7 +47,7 @@ namespace drawinglayer
if(bOutputToRecordingMetaFile)
{
// create MetaFile Vcl-Processor and process
- return new VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev);
+ return o3tl::make_unique<VclMetafileProcessor2D>(rViewInformation2D, rTargetOutDev);
}
else
{
diff --git a/drawinglayer/source/processor2d/processorfromoutputdevice.cxx b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
index 16bd3b6404f4..ce81ce4b8f88 100644
--- a/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
+++ b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx
@@ -26,6 +26,7 @@
#include "vclmetafileprocessor2d.hxx"
#include "vclpixelprocessor2d.hxx"
#include <vcl/window.hxx>
+#include <o3tl/make_unique.hxx>
using namespace com::sun::star;
@@ -33,7 +34,7 @@ namespace drawinglayer
{
namespace processor2d
{
- drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> createBaseProcessor2DFromOutputDevice(
OutputDevice& rTargetOutDev,
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
{
@@ -43,12 +44,12 @@ namespace drawinglayer
if(bOutputToRecordingMetaFile)
{
// create MetaFile Vcl-Processor and process
- return new drawinglayer::processor2d::VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev);
+ return o3tl::make_unique<drawinglayer::processor2d::VclMetafileProcessor2D>(rViewInformation2D, rTargetOutDev);
}
else
{
// create Pixel Vcl-Processor
- return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev);
+ return o3tl::make_unique<drawinglayer::processor2d::VclPixelProcessor2D>(rViewInformation2D, rTargetOutDev);
}
}
} // end of namespace processor2d
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx
index 968b67bef4c0..c34dc03e9039 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -80,7 +80,7 @@ namespace drawinglayer
// create pixel processor, also already takes care of AAing and
// checking the getOptionsDrawinglayer().IsAntiAliasing() switch. If
// not wanted, change after this call as needed
- processor2d::BaseProcessor2D* pContentProcessor = processor2d::createPixelProcessor2DFromOutputDevice(
+ std::unique_ptr<processor2d::BaseProcessor2D> pContentProcessor = processor2d::createPixelProcessor2DFromOutputDevice(
*pContent.get(),
rViewInformation2D);
@@ -122,7 +122,7 @@ namespace drawinglayer
// render
pContentProcessor->process(xSeq);
- delete pContentProcessor;
+ pContentProcessor.reset();
// get alpha channel from vdev
pContent->EnableMapMode(false);
diff --git a/include/drawinglayer/processor2d/processor2dtools.hxx b/include/drawinglayer/processor2d/processor2dtools.hxx
index 37af4d9daee6..e4f4684b0b76 100644
--- a/include/drawinglayer/processor2d/processor2dtools.hxx
+++ b/include/drawinglayer/processor2d/processor2dtools.hxx
@@ -22,6 +22,7 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
+#include <memory>
class OutputDevice;
@@ -42,7 +43,7 @@ namespace drawinglayer
the created BaseProcessor2D (ownership change) or null if
something went wrong
*/
- DRAWINGLAYER_DLLPUBLIC BaseProcessor2D* createPixelProcessor2DFromOutputDevice(
+ DRAWINGLAYER_DLLPUBLIC std::unique_ptr<BaseProcessor2D> createPixelProcessor2DFromOutputDevice(
OutputDevice& rTargetOutDev,
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
@@ -61,7 +62,7 @@ namespace drawinglayer
the created BaseProcessor2D (ownership change) or null if
something went wrong
*/
- DRAWINGLAYER_DLLPUBLIC BaseProcessor2D* createProcessor2DFromOutputDevice(
+ DRAWINGLAYER_DLLPUBLIC std::unique_ptr<BaseProcessor2D> createProcessor2DFromOutputDevice(
OutputDevice& rTargetOutDev,
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
diff --git a/include/drawinglayer/processor2d/processorfromoutputdevice.hxx b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
index 0d47032405cb..549b170f293d 100644
--- a/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
+++ b/include/drawinglayer/processor2d/processorfromoutputdevice.hxx
@@ -22,6 +22,7 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <drawinglayer/drawinglayerdllapi.h>
+#include <memory>
class OutputDevice;
@@ -36,7 +37,7 @@ namespace drawinglayer
// create a mating VCL-Processor for given OutputDevice. This includes
// looking for MetaFile-recording. The returned renderer changes owner,
// deletion is duty of the caller
- DRAWINGLAYER_DLLPUBLIC drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice(
+ DRAWINGLAYER_DLLPUBLIC std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> createBaseProcessor2DFromOutputDevice(
OutputDevice& rTargetOutDev,
const drawinglayer::geometry::ViewInformation2D& rViewInformation2D);
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index 162e1918f759..0546bd544f7a 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -234,7 +234,7 @@ private:
void DrawRotatedFrame(vcl::RenderContext& rRenderContext); // pixel
- drawinglayer::processor2d::BaseProcessor2D* CreateProcessor2D( );
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> CreateProcessor2D( );
void DrawEditStandard(DrawEditParam& rParam);
void DrawEditBottomTop(DrawEditParam& rParam);
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index e6549bdd3427..3d70370187c9 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1690,7 +1690,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext)
rRenderContext.SetClipRegion();
}
-drawinglayer::processor2d::BaseProcessor2D* ScOutputData::CreateProcessor2D( )
+std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> ScOutputData::CreateProcessor2D( )
{
mpDoc->InitDrawLayer(mpDoc->GetDocumentShell());
ScDrawLayer* pDrawLayer = mpDoc->GetDrawLayer();
diff --git a/svx/source/dialog/pagectrl.cxx b/svx/source/dialog/pagectrl.cxx
index 003b0546287c..1daea5b6e7ba 100644
--- a/svx/source/dialog/pagectrl.cxx
+++ b/svx/source/dialog/pagectrl.cxx
@@ -379,9 +379,8 @@ void SvxPageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext,
basegfx::B2DHomMatrix(), GetViewTransformation(), aPaintRange, nullptr,
0.0, css::uno::Sequence<css::beans::PropertyValue >());
- std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor;
- pProcessor.reset(drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D));
-
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
+ drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D));
if (pProcessor)
{
pProcessor->process(aSequence);
@@ -727,9 +726,8 @@ void PageWindow::drawFillAttributes(vcl::RenderContext& rRenderContext,
basegfx::B2DHomMatrix(), rRenderContext.GetViewTransformation(), aPaintRange, nullptr,
0.0, css::uno::Sequence<css::beans::PropertyValue >());
- std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor;
- pProcessor.reset(drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D));
-
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(
+ drawinglayer::processor2d::createProcessor2DFromOutputDevice(rRenderContext, aViewInformation2D));
if (pProcessor)
{
pProcessor->process(aSequence);
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index de13c4d8b7b2..9490c08d880b 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -911,15 +911,13 @@ bool paintUsingPrimitivesHelper(
uno::Sequence< beans::PropertyValue >());
// get a primitive processor for rendering
- drawinglayer::processor2d::BaseProcessor2D* pProcessor2D =
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
drawinglayer::processor2d::createProcessor2DFromOutputDevice(
- rOutputDevice, aViewInformation2D);
-
+ rOutputDevice, aViewInformation2D) );
if(pProcessor2D)
{
// render and cleanup
pProcessor2D->process(rSequence);
- delete pProcessor2D;
return true;
}
}
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 4f6375d664a9..5756edf07e43 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -555,7 +555,7 @@ public:
const Color *pColor,
const SvxBorderLineStyle = SvxBorderLineStyle::SOLID ) const;
- drawinglayer::processor2d::BaseProcessor2D * CreateProcessor2D( ) const;
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> CreateProcessor2D( ) const;
void ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DContainer& rSequence ) const;
// retouch, not in the area of the given Rect!
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 782587b964f2..2c55d516f5c9 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1763,16 +1763,12 @@ bool DrawFillAttributes(
nullptr,
0.0,
uno::Sequence< beans::PropertyValue >());
- drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice(
rOut,
- aViewInformation2D);
-
+ aViewInformation2D) );
if(pProcessor)
{
pProcessor->process(*pPrimitives);
-
- delete pProcessor;
-
return true;
}
}
@@ -4959,7 +4955,7 @@ static const SwFrame* lcl_GetCellFrameForBorderAttrs( const SwFrame* _pC
return pRet;
}
-drawinglayer::processor2d::BaseProcessor2D * SwFrame::CreateProcessor2D( ) const
+std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> SwFrame::CreateProcessor2D( ) const
{
basegfx::B2DRange aViewRange;
@@ -4979,12 +4975,10 @@ drawinglayer::processor2d::BaseProcessor2D * SwFrame::CreateProcessor2D( ) const
void SwFrame::ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DContainer& rSequence ) const
{
- drawinglayer::processor2d::BaseProcessor2D * pProcessor2D = CreateProcessor2D();
-
+ std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D = CreateProcessor2D();
if ( pProcessor2D )
{
pProcessor2D->process( rSequence );
- delete pProcessor2D;
}
}
More information about the Libreoffice-commits
mailing list