libcanvas: FramedCanvas::covers() method is ill-conceived. Use PolyItem::covers()
This commit is contained in:
parent
9e754959f6
commit
ef07fb601a
@ -49,7 +49,6 @@ class LIBCANVAS_API FramedCurve : public PolyItem, public InterpolatedCurve
|
||||
|
||||
void set_points_per_segment (uint32_t n);
|
||||
|
||||
bool covers (Duple const &) const;
|
||||
void set_fill_mode (CurveFill cf) { curve_fill = cf; }
|
||||
|
||||
private:
|
||||
|
@ -289,24 +289,3 @@ FramedCurve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) c
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
FramedCurve::covers (Duple const & pc) const
|
||||
{
|
||||
Duple point = window_to_item (pc);
|
||||
|
||||
/* O(N) N = number of points, and not accurate */
|
||||
|
||||
for (Points::const_iterator p = _points.begin(); p != _points.end(); ++p) {
|
||||
|
||||
const Coord dx = point.x - (*p).x;
|
||||
const Coord dy = point.y - (*p).y;
|
||||
const Coord dx2 = dx * dx;
|
||||
const Coord dy2 = dy * dy;
|
||||
|
||||
if ((dx2 < 2.0 && dy2 < 2.0) || (dx2 + dy2 < 4.0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user