summaryrefslogtreecommitdiff
path: root/include/svx/svdtrans.hxx
diff options
context:
space:
mode:
authorJuan Picca <jumapico@gmail.com>2014-11-03 22:33:52 -0200
committerDavid Tardon <dtardon@redhat.com>2014-12-18 15:58:42 +0000
commit82aa4dbd8330eb446cdf535794c13185f0c0ca81 (patch)
tree2aef1fa53c830b00085bab8f6a98ded1a755aec7 /include/svx/svdtrans.hxx
parent3f66df98050175dfbab2026661c0cba734885e05 (diff)
Fraction: rewrite 'GetDenominator()==0' conditions
Change-Id: Ie42972db98da48b60b3f5314e019046b2a2ee0e7 Reviewed-on: https://gerrit.libreoffice.org/12238 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'include/svx/svdtrans.hxx')
-rw-r--r--include/svx/svdtrans.hxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index 0dca9751a949..f2e159104177 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -104,10 +104,16 @@ void CrookStretchPoly(XPolyPolygon& rPoly, const Point& rCenter, const Point& rR
inline void ResizePoint(Point& rPnt, const Point& rRef, Fraction xFact, Fraction yFact)
{
- if (xFact.GetDenominator()==0) xFact=Fraction(xFact.GetNumerator(),1); // DivZero abfangen
- if (yFact.GetDenominator()==0) yFact=Fraction(yFact.GetNumerator(),1); // DivZero abfangen
- rPnt.X()=rRef.X()+ Round(((double)(rPnt.X()-rRef.X())*xFact.GetNumerator())/xFact.GetDenominator());
- rPnt.Y()=rRef.Y()+ Round(((double)(rPnt.Y()-rRef.Y())*yFact.GetNumerator())/yFact.GetDenominator());
+ 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() + Round( (rPnt.X() - rRef.X()) * double(xFact) );
+ rPnt.Y() = rRef.Y() + Round( (rPnt.Y() - rRef.Y()) * double(yFact) );
}
inline void RotatePoint(Point& rPnt, const Point& rRef, double sn, double cs)