diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-05-25 21:26:03 +0200 |
---|---|---|
committer | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-06-01 07:07:14 +0000 |
commit | 4291d61851438b2ca4c767a697904ee7748489a6 (patch) | |
tree | b9e7b32d7c1cdaf6039c4a399d106ada0d03532c /include/svx/svdtrans.hxx | |
parent | d080fb811d23fe4d4a3bb2efd079cc9446709f73 (diff) |
pass by reference
Fraction does SAL_WARN when we create an invalid Fraction
and SAL_WARN again when converted to double (returns 0.0)
remove the warnings here and use 1.0 for invalid Fraction
Change-Id: I26de55ed7e3c9b4dac69c422fcaf7900804a0807
Reviewed-on: https://gerrit.libreoffice.org/25467
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'include/svx/svdtrans.hxx')
-rw-r--r-- | include/svx/svdtrans.hxx | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx index 6555b42050ef..41848ba3aaec 100644 --- a/include/svx/svdtrans.hxx +++ b/include/svx/svdtrans.hxx @@ -60,7 +60,7 @@ inline void MovePoly(tools::Polygon& rPoly, const Size& S) { rPoly.Move(S.W void MoveXPoly(XPolygon& rPoly, const Size& S); SVX_DLLPUBLIC void ResizeRect(Rectangle& rRect, const Point& rRef, const Fraction& xFact, const Fraction& yFact); -inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact); +inline void ResizePoint(Point& rPnt, const Point& rRef, const Fraction& xFract, const Fraction& yFract); void ResizePoly(tools::Polygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact); void ResizeXPoly(XPolygon& rPoly, const Point& rRef, const Fraction& xFact, const Fraction& yFact); @@ -111,18 +111,12 @@ void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rR /* Inline */ /**************************************************************************************************/ -inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact) +inline void ResizePoint(Point& rPnt, const Point& rRef, const Fraction& xFract, const Fraction& yFract) { - if (!xFact.IsValid()) { - SAL_WARN( "svx.svdraw", "invalid fraction xFact, using Fraction(1,1)" ); - xFact = Fraction(1,1); - } - if (!yFact.IsValid()) { - SAL_WARN( "svx.svdraw", "invalid fraction yFact, using Fraction(1,1)" ); - yFact = Fraction(1,1); - } - rPnt.X() = rRef.X() + svx::Round( (rPnt.X() - rRef.X()) * double(xFact) ); - rPnt.Y() = rRef.Y() + svx::Round( (rPnt.Y() - rRef.Y()) * double(yFact) ); + double nxFract = xFract.IsValid() ? static_cast<double>(xFract) : 1.0; + double nyFract = yFract.IsValid() ? static_cast<double>(yFract) : 1.0; + rPnt.X() = rRef.X() + svx::Round( (rPnt.X() - rRef.X()) * nxFract ); + rPnt.Y() = rRef.Y() + svx::Round( (rPnt.Y() - rRef.Y()) * nyFract ); } inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs) |