[Libreoffice-commits] core.git: lotuswordpro/source

Jochen Nitschke j.nitschke+logerrit at ok.de
Mon Jun 26 19:07:33 UTC 2017


 lotuswordpro/source/filter/lwpsdwrect.cxx |   36 +++++-------------------------
 lotuswordpro/source/filter/lwpsdwrect.hxx |    7 +----
 2 files changed, 8 insertions(+), 35 deletions(-)

New commits:
commit 0346371fcbb16ac4b31910469f5216b8eeacd850
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Mon Jun 26 11:52:33 2017 +0200

    lwp: use std::array and get copy ctor for free
    
    Change-Id: I3c0f8cea0adca843ec88f4742243c6cdada6bc5f
    Reviewed-on: https://gerrit.libreoffice.org/39260
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/lotuswordpro/source/filter/lwpsdwrect.cxx b/lotuswordpro/source/filter/lwpsdwrect.cxx
index d9f73ebde2b9..bb462d9951d7 100644
--- a/lotuswordpro/source/filter/lwpsdwrect.cxx
+++ b/lotuswordpro/source/filter/lwpsdwrect.cxx
@@ -64,47 +64,23 @@
 /**************************************************************************
  * @short:  Default constructor
 **************************************************************************/
-SdwRectangle::SdwRectangle() : m_bRotated(false)
+SdwRectangle::SdwRectangle()
+    : m_bRotated(false)
+    // m_nRectCorner array fields are default initialized with Point()
 {
-    for (sal_uInt16 i = 0; i < 4; i++)
-    {
-        m_nRectCorner[0] = Point(0, 0);
-    }
 }
 /**************************************************************************
  * @short:  Constructor
  * @param:  aPt0~aPt3 four corner points of a rectangle.
 **************************************************************************/
 SdwRectangle::SdwRectangle(const Point& rPt0, const Point& rPt1,
-        const Point& rPt2, const Point& rPt3) : m_bRotated(true)
+        const Point& rPt2, const Point& rPt3)
+    : m_bRotated(rPt0.Y() != rPt1.Y() || rPt0.Y() >= rPt3.Y())
+    , m_nRectCorner({{rPt0, rPt1, rPt2, rPt3}})
 {
-    m_nRectCorner[0] = rPt0;
-    m_nRectCorner[1] = rPt1;
-    m_nRectCorner[2] = rPt2;
-    m_nRectCorner[3] = rPt3;
-
-    if (rPt0.Y() == rPt1.Y() && rPt0.Y() < rPt3.Y())
-    {
-        m_bRotated = false;
-    }
 }
 
 /**************************************************************************
- * @short:  Copy constructor
-**************************************************************************/
-SdwRectangle::SdwRectangle(const SdwRectangle& rOther)
-{
-    m_nRectCorner[0] = rOther.m_nRectCorner[0];
-    m_nRectCorner[1] = rOther.m_nRectCorner[1];
-    m_nRectCorner[2] = rOther.m_nRectCorner[2];
-    m_nRectCorner[3] = rOther.m_nRectCorner[3];
-
-    m_bRotated  = rOther.IsRectRotated();
-}
-SdwRectangle::~SdwRectangle()
-{
-}
-/**************************************************************************
  * @short:  Calculate and return center point of the rectangle.
  * @return: center point
 **************************************************************************/
diff --git a/lotuswordpro/source/filter/lwpsdwrect.hxx b/lotuswordpro/source/filter/lwpsdwrect.hxx
index 9af37440ef68..39c228f028c9 100644
--- a/lotuswordpro/source/filter/lwpsdwrect.hxx
+++ b/lotuswordpro/source/filter/lwpsdwrect.hxx
@@ -63,6 +63,7 @@
 
 #include "lwpheader.hxx"
 #include <tools/gen.hxx>
+#include <array>
 
 /**
  * @brief
@@ -90,7 +91,7 @@ private:
     bool m_bRotated;
 
 public:
-    Point m_nRectCorner[4];
+    std::array<Point, 4> m_nRectCorner;
 
 public:
 
@@ -99,10 +100,6 @@ public:
     SdwRectangle(const Point& rPt0, const Point& rPt1,
         const Point& rPt2, const Point& rPt3);
 
-    SdwRectangle(const SdwRectangle& rOther);
-
-    ~SdwRectangle();
-
 public:
     /*
      * @short:  Get the flag whether if the rectangle has been rotated.


More information about the Libreoffice-commits mailing list