13
0

libcanvas: FramedCanvas::covers() method is ill-conceived. Use PolyItem::covers()

This commit is contained in:
Paul Davis 2022-05-29 14:19:02 -06:00
parent 9e754959f6
commit ef07fb601a
2 changed files with 0 additions and 22 deletions

View File

@ -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:

View File

@ -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;
}