include/tools/gen.hxx        |   10 +---------
 tools/source/generic/gen.cxx |   11 +++++++++++
 2 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 77ca41321193ddfaa0ca05d1fa43f3b614209a61
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Jul 9 13:33:41 2019 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Jul 9 14:36:02 2019 +0200

    make tools::Rectangle::shrink respect empty state
    
    and make non-inline so it is easy to disable this for debugging, if need
    be
    
    Change-Id: Id529037e82b2fdd8c2120877a44fc7e069fc8406
    Reviewed-on: https://gerrit.libreoffice.org/75298
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx
index 56af47582a7f..897db7a25f79 100644
--- a/include/tools/gen.hxx
+++ b/include/tools/gen.hxx
@@ -471,7 +471,7 @@ public:
      * Expands the rectangle in all directions by the input value.
      */
     void expand(long nExpandBy);
-    inline void shrink(long nShrinkBy);
+    void shrink(long nShrinkBy);
 
     /**
      * Sanitizing variants for handling data from the outside
@@ -722,14 +722,6 @@ inline Rectangle operator - ( const Rectangle& rRect, 
const Point& rPt )
 }
 }
 
-inline void tools::Rectangle::shrink(long nShrinkBy)
-{
-    nLeft   += nShrinkBy;
-    nTop    += nShrinkBy;
-    nRight  -= nShrinkBy;
-    nBottom -= nShrinkBy;
-}
-
 template< typename charT, typename traits >
 inline std::basic_ostream<charT, traits> & operator <<(
     std::basic_ostream<charT, traits> & stream, const tools::Rectangle& 
rectangle )
diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 53bb2680c5c8..020be91ac3c0 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -247,5 +247,16 @@ void tools::Rectangle::expand(long nExpandBy)
         nBottom += nExpandBy;
 }
 
+void tools::Rectangle::shrink(long nShrinkBy)
+{
+    nLeft   += nShrinkBy;
+    nTop    += nShrinkBy;
+    if (nRight != RECT_EMPTY)
+        nRight -= nShrinkBy;
+    if (nBottom != RECT_EMPTY)
+        nBottom -= nShrinkBy;
+}
+
+
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to