fix clamping of line and rect coordinates to avoid issues with cairo when drawing way outside a surface's dimensions; move various coordinate methods down to Canvas, because they don't require GTK information; make visible_area() a Canvas virtual method so that we don't have to cast to call it

This commit is contained in:
Paul Davis 2013-04-17 10:53:17 -04:00
parent 96eee9e7a1
commit d1a05240ef
17 changed files with 98 additions and 85 deletions

View file

@ -25,9 +25,7 @@
using namespace std;
using namespace ArdourCanvas;
Coord const ArdourCanvas::COORD_MAX = DBL_MAX;
/* XXX: empirically arrived at */
Coord const ArdourCanvas::CAIRO_MAX = 65536;
Coord const ArdourCanvas::COORD_MAX = 1.7e307;
static inline Coord
safe_add (Coord a, Coord b)
@ -132,6 +130,12 @@ ArdourCanvas::operator+ (Duple const & a, Duple const & b)
return Duple (safe_add (a.x, b.x), safe_add (a.y, b.y));
}
bool
ArdourCanvas::operator== (Duple const & a, Duple const & b)
{
return a.x == b.x && a.y == b.y;
}
Duple
ArdourCanvas::operator- (Duple const & a, Duple const & b)
{