hwpfilter/source/hwpreader.cxx |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit 4cbaaf21fe1c22b36dd72798cecfa59e73d0f8c3
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Mar 3 23:02:41 2022 +0300
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Mar 3 22:59:04 2022 +0100

    Use <cmath>'s std::hypot
    
    Change-Id: I2f9db19dca795b6318cd88ca645020077520f5da
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130943
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index 6c285c664e23..a8272d82746e 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -3943,8 +3943,6 @@ void HwpReader::makePicture(Picture * hbox)
     }
 }
 
-namespace { double DBL(int x) { return x * x; } }
-
 void HwpReader::makePictureDRAW(HWPDrawingObject *drawobj, Picture * hbox)
 {
     int x = hbox->pgx;
@@ -4047,8 +4045,8 @@ void HwpReader::makePictureDRAW(HWPDrawingObject 
*drawobj, Picture * hbox)
                     bIsRotate = true;
                 }
                 if( bIsRotate ){
-                    drawobj->extent.w = 
static_cast<int>(sqrt(DBL(pt[1].x-pt[0].x) + DBL(pt[1].y-pt[0].y)));
-                    drawobj->extent.h = 
static_cast<int>(sqrt(DBL(pt[2].x-pt[1].x) + DBL(pt[2].y-pt[1].y)));
+                    drawobj->extent.w = 
static_cast<int>(std::hypot(pt[1].x-pt[0].x, pt[1].y-pt[0].y));
+                    drawobj->extent.h = 
static_cast<int>(std::hypot(pt[2].x-pt[1].x, pt[2].y-pt[1].y));
                     padd("draw:transform", sXML_CDATA, trans);
                 }
             }

Reply via email to