summaryrefslogtreecommitdiff
path: root/include/vcl
diff options
context:
space:
mode:
authorJuan Picca <jumapico@gmail.com>2014-09-19 14:19:30 -0300
committerDavid Tardon <dtardon@redhat.com>2014-10-09 11:33:33 +0000
commit47a2d7642d249d70b5da0c330a73f3a0032e4bba (patch)
tree202b04810382ea87cf8015a7b4de29e931408948 /include/vcl
parentae77dc81c33ab0817264bcf5fc8bb71a55b78a73 (diff)
fdo#81356: convert Fraction to boost::rational<long> - wip
* Added rational util functions used by Fraction class not available in the boost::rational class. * Replaced usage of Fraction by boost::rational<long> * Removed code that relies on: 1. fraction.IsValid() -- rational only allow valid values, ie denominator() != 0 2. rational.denominator() == 0 -- always false 3. rational.denominator() < 0 -- always false but implementation detail: http://www.boost.org/doc/libs/release/libs/rational/rational.html#Internal%20representation * Simplified code that relies on: 1. rational.denominator() != 0 -- always true * BUGS EXIST because Fraction allows the creation of invalid values but boost::rational throws the exception boost::bad_rational Change-Id: I84970a4956afb3f91ac0c8f726547466319420f9 Reviewed-on: https://gerrit.libreoffice.org/11551 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/gdimtf.hxx2
-rw-r--r--include/vcl/mapmod.hxx16
-rw-r--r--include/vcl/virdev.hxx2
-rw-r--r--include/vcl/window.hxx4
4 files changed, 12 insertions, 12 deletions
diff --git a/include/vcl/gdimtf.hxx b/include/vcl/gdimtf.hxx
index 5a80213a7550..128895fc0675 100644
--- a/include/vcl/gdimtf.hxx
+++ b/include/vcl/gdimtf.hxx
@@ -136,7 +136,7 @@ public:
// additional Move method getting specifics how to handle MapMode( MAP_PIXEL )
void Move( long nX, long nY, long nDPIX, long nDPIY );
void Scale( double fScaleX, double fScaleY );
- void Scale( const Fraction& rScaleX, const Fraction& rScaleY );
+ void Scale( const boost::rational<long>& rScaleX, const boost::rational<long>& rScaleY );
void Rotate( long nAngle10 );
void Clip( const Rectangle& );
/* get the bound rect of the contained actions
diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx
index 10e06d2e9ca3..211727f39660 100644
--- a/include/vcl/mapmod.hxx
+++ b/include/vcl/mapmod.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_VCL_MAPMOD_HXX
#include <tools/gen.hxx>
-#include <tools/fract.hxx>
+#include <tools/rational.hxx>
#include <tools/solar.h>
#include <vcl/dllapi.h>
#include <tools/resid.hxx>
@@ -44,8 +44,8 @@ private:
sal_uLong mnRefCount;
MapUnit meUnit;
Point maOrigin;
- Fraction maScaleX;
- Fraction maScaleY;
+ boost::rational<long> maScaleX;
+ boost::rational<long> maScaleY;
bool mbSimple;
friend SvStream& ReadImplMapMode( SvStream& rIStm, ImplMapMode& rMapMode );
@@ -75,7 +75,7 @@ public:
MapMode( const MapMode& rMapMode );
MapMode( MapUnit eUnit );
MapMode( MapUnit eUnit, const Point& rLogicOrg,
- const Fraction& rScaleX, const Fraction& rScaleY );
+ const boost::rational<long>& rScaleX, const boost::rational<long>& rScaleY );
~MapMode();
void SetMapUnit( MapUnit eUnit );
@@ -86,11 +86,11 @@ public:
const Point& GetOrigin() const
{ return mpImplMapMode->maOrigin; }
- void SetScaleX( const Fraction& rScaleX );
- const Fraction& GetScaleX() const
+ void SetScaleX( const boost::rational<long>& rScaleX );
+ const boost::rational<long>& GetScaleX() const
{ return mpImplMapMode->maScaleX; }
- void SetScaleY( const Fraction& rScaleY );
- const Fraction& GetScaleY() const
+ void SetScaleY( const boost::rational<long>& rScaleY );
+ const boost::rational<long>& GetScaleY() const
{ return mpImplMapMode->maScaleY; }
MapMode& operator=( const MapMode& rMapMode );
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index 624cb2f0f31a..4886410bd2aa 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -124,7 +124,7 @@ public:
bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true );
bool SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize,
- const Fraction& rScale,
+ const boost::rational<long>& rScale,
const Point& rNewOffset,
const basebmp::RawMemorySharedArray &pBuffer,
const bool bTopDown = false );
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index decc15c1c88e..14c23bdfbcff 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1009,8 +1009,8 @@ public:
void SetCursor( vcl::Cursor* pCursor );
vcl::Cursor* GetCursor() const;
- void SetZoom( const Fraction& rZoom );
- const Fraction& GetZoom() const;
+ void SetZoom( const boost::rational<long>& rZoom );
+ const boost::rational<long>& GetZoom() const;
bool IsZoom() const;
long CalcZoom( long n ) const;