include/svx/svdtrans.hxx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
New commits: commit 4291d61851438b2ca4c767a697904ee7748489a6 Author: Jochen Nitschke <[email protected]> Date: Wed May 25 21:26:03 2016 +0200 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 <[email protected]> Reviewed-by: Jochen Nitschke <[email protected]> diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx index 6555b42..41848ba 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) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
