basegfx/source/matrix/b3dhommatrix.cxx                     |   15 +++++++++--
 drawinglayer/source/primitive2d/svggradientprimitive2d.cxx |   17 +++----------
 sc/source/filter/inc/lotattr.hxx                           |    2 -
 sc/source/filter/lotus/lotattr.cxx                         |    6 ++--
 sc/source/ui/attrdlg/scdlgfact.cxx                         |    2 -
 sc/source/ui/attrdlg/scdlgfact.hxx                         |    4 +--
 sw/source/core/layout/wsfrm.cxx                            |   14 +---------
 7 files changed, 26 insertions(+), 34 deletions(-)

New commits:
commit 437d5d30422014c0a6def06e432a41e3f2e5c4c5
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Aug 31 16:49:22 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Sep 3 12:41:46 2018 +0200

    move identity checks into B3DHomMatrix::operator*=
    
    and consequently simplify some call-sites
    
    Change-Id: I301fc4c88fdfb8af75a348a41593a27f4c6567c5
    Reviewed-on: https://gerrit.libreoffice.org/59916
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basegfx/source/matrix/b3dhommatrix.cxx 
b/basegfx/source/matrix/b3dhommatrix.cxx
index d23aed896120..e3f3d3d28475 100644
--- a/basegfx/source/matrix/b3dhommatrix.cxx
+++ b/basegfx/source/matrix/b3dhommatrix.cxx
@@ -117,9 +117,20 @@ namespace basegfx
 
     B3DHomMatrix& B3DHomMatrix::operator*=(const B3DHomMatrix& rMat)
     {
-        if(!rMat.isIdentity())
+        if(rMat.isIdentity())
+        {
+            // multiply with identity, no change -> nothing to do
+        }
+        else if(isIdentity())
+        {
+            // we are identity, result will be rMat -> assign
+            *this = rMat;
+        }
+        else
+        {
+            // multiply
             mpImpl->doMulMatrix(*rMat.mpImpl);
-
+        }
         return *this;
     }
 
diff --git a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx 
b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
index 12eef36c16ac..6e2ab2e16b3e 100644
--- a/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/svggradientprimitive2d.cxx
@@ -404,14 +404,11 @@ namespace drawinglayer
                     aUnitGradientToObject.rotate(atan2(aVector.getY(), 
aVector.getX()));
                     aUnitGradientToObject.translate(getStart().getX(), 
getStart().getY());
 
-                    if(!getGradientTransform().isIdentity())
-                    {
-                        aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
-                    }
+                    aUnitGradientToObject *= getGradientTransform();
 
                     // create full transform from unit gradient coordinates to 
object coordinates
                     // including the SvgGradient transformation
-                    aUnitGradientToObject = aObjectTransform * 
aUnitGradientToObject;
+                    aUnitGradientToObject *= aObjectTransform;
                 }
                 else
                 {
@@ -424,10 +421,7 @@ namespace drawinglayer
                     aUnitGradientToObject.rotate(atan2(aVector.getY(), 
aVector.getX()));
                     aUnitGradientToObject.translate(aStart.getX(), 
aStart.getY());
 
-                    if(!getGradientTransform().isIdentity())
-                    {
-                        aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
-                    }
+                    aUnitGradientToObject *= getGradientTransform();
                 }
 
                 // create inverse from it
@@ -757,10 +751,7 @@ namespace drawinglayer
                     aUnitGradientToObject.scale(fRadius, fRadius);
                     aUnitGradientToObject.translate(aStart.getX(), 
aStart.getY());
 
-                    if(!getGradientTransform().isIdentity())
-                    {
-                        aUnitGradientToObject = getGradientTransform() * 
aUnitGradientToObject;
-                    }
+                    aUnitGradientToObject *= getGradientTransform();
                 }
 
                 // create inverse from it
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index cdce7870a536..bc41904eea2c 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -274,18 +274,8 @@ void TransformableSwFrame::restoreFrameAreas()
 // transform by given B2DHomMatrix
 void TransformableSwFrame::transform(const basegfx::B2DHomMatrix aTransform)
 {
-    if(!aTransform.isIdentity())
-    {
-        if(!maFrameAreaTransformation.isIdentity())
-        {
-            maFrameAreaTransformation *= aTransform;
-        }
-
-        if(!maFramePrintAreaTransformation.isIdentity())
-        {
-            maFramePrintAreaTransformation *= aTransform;
-        }
-    }
+    maFrameAreaTransformation *= aTransform;
+    maFramePrintAreaTransformation *= aTransform;
 }
 
 SwFrame::SwFrame( SwModify *pMod, SwFrame* pSib )
commit 2a933f0b9444792c9a6b1273238d3c36ca590686
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Sep 3 10:12:28 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Sep 3 12:41:35 2018 +0200

    loplugin:useuniqueptr in various in sc
    
    Change-Id: I47eb6ea14495a3f21fd008f8b8716c30effde985
    Reviewed-on: https://gerrit.libreoffice.org/59924
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index 8439c8f89c40..78d80e8dd174 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -73,7 +73,7 @@ private:
         std::unique_ptr<ScPatternAttr>  pPattAttr;
         sal_uInt32                      nHash0;
 
-        ENTRY(ScPatternAttr* p);
+        ENTRY(std::unique_ptr<ScPatternAttr> p);
 
         ~ENTRY();
     };
diff --git a/sc/source/filter/lotus/lotattr.cxx 
b/sc/source/filter/lotus/lotattr.cxx
index 16fe863289d7..a26faf9edbe7 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -36,8 +36,8 @@
 
 using namespace ::com::sun::star;
 
-LotAttrCache::ENTRY::ENTRY (ScPatternAttr* p)
-    : pPattAttr(p)
+LotAttrCache::ENTRY::ENTRY (std::unique_ptr<ScPatternAttr> p)
+    : pPattAttr(std::move(p))
     , nHash0(0)
 {
 }
@@ -91,7 +91,7 @@ const ScPatternAttr& LotAttrCache::GetPattAttr( const 
LotAttrWK3& rAttr )
     ScPatternAttr*  pNewPatt = new ScPatternAttr(pDocPool);
 
     SfxItemSet&     rItemSet = pNewPatt->GetItemSet();
-    ENTRY *pCurrent = new ENTRY( pNewPatt );
+    ENTRY *pCurrent = new ENTRY( std::unique_ptr<ScPatternAttr>(pNewPatt) );
 
     pCurrent->nHash0 = nRefHash;
 
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx 
b/sc/source/ui/attrdlg/scdlgfact.cxx
index 159a04fa21c9..b1c72c9ed02b 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -1053,7 +1053,7 @@ VclPtr<SfxAbstractTabDialog> 
ScAbstractDialogFactory_Impl::CreateScParagraphDlg(
 
 VclPtr<SfxAbstractTabDialog> 
ScAbstractDialogFactory_Impl::CreateScSortDlg(weld::Window* pParent, const 
SfxItemSet* pArgSet)
 {
-    return VclPtr<ScAbstractTabController_Impl>::Create(new ScSortDlg(pParent, 
pArgSet));
+    return 
VclPtr<ScAbstractTabController_Impl>::Create(o3tl::make_unique<ScSortDlg>(pParent,
 pArgSet));
 }
 
 //------------------ Factories for TabPages--------------------
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx 
b/sc/source/ui/attrdlg/scdlgfact.hxx
index 600bd6eecc18..a91779ce16ad 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -520,8 +520,8 @@ class ScAbstractTabController_Impl : public 
SfxAbstractTabDialog
 protected:
     std::unique_ptr<SfxTabDialogController> m_xDlg;
 public:
-    explicit ScAbstractTabController_Impl(SfxTabDialogController* p)
-        : m_xDlg(p)
+    explicit 
ScAbstractTabController_Impl(std::unique_ptr<SfxTabDialogController> p)
+        : m_xDlg(std::move(p))
     {
     }
     virtual short Execute() override;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to