Commit fc3d7d4f authored by Pierre Marchand's avatar Pierre Marchand
Browse files

fixed newer versions of GMP do not implicitly cast mpf_class to double

parent cdb11a43
......@@ -407,8 +407,8 @@ namespace ospi {
ospi::Point cropCenter((cleft + (cwidth / 2.0)) * 1.0, ((srect.GetHeight() - ctop) - (cheight / 2.0)) * 1.0);
trx_double_t transX(slotCenter.x - cropCenter.x);
trx_double_t transY(slotCenter.y - cropCenter.y);
trx_double_t transX(slotCenter.getX() - cropCenter.getX());
trx_double_t transY(slotCenter.getY() - cropCenter.getY());
Transform t;
t.translate(transX, transY);
......
......@@ -39,10 +39,11 @@ namespace ospi {
class Point
{
public:
trx_double_t x;
trx_double_t y;
private:
trx_double_t x;
trx_double_t y;
public:
Point():x(0),y(0){}
Point(trx_double_t x, trx_double_t y):x(x),y(y){}
Point& operator=(const Point& o)
......@@ -56,6 +57,26 @@ namespace ospi {
{
return ( x == trx_double_t(0.0) && y == trx_double_t(0.0));
}
double getX() const
{
#ifndef WITH_GMP
return x;
#else
return x.get_d();
#endif
}
double getY() const
{
#ifndef WITH_GMP
return y;
#else
return y.get_d();
#endif
}
friend class Rectangle;
friend class Transform;
};
class Rectangle : public std::vector<Point>
......@@ -78,8 +99,24 @@ namespace ospi {
Point topLeft() const {return at(TL);}
Point bottomRight() const {return at(BR);}
trx_double_t width() const {return (at(BR).x - at(BL).x);}
trx_double_t height() const {return(at(TL).y - at(BL).y);}
double width() const
{
trx_double_t result = at(BR).x - at(BL).x;
#ifndef WITH_GMP
return result;
#else
return result.get_d();
#endif
}
double height() const
{
trx_double_t result = at(TL).y - at(BL).y;
#ifndef WITH_GMP
return result;
#else
return result.get_d();
#endif
}
Rectangle unite(const Rectangle& o);
Rectangle& united(const Rectangle& o);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment