Exemplo n.º 1
0
bool
Shape::pointInShape(boost::int32_t x, boost::int32_t y) const
{
    SWFMatrix wm = getWorldMatrix();
    wm.invert();
    point lp(x, y);
    wm.transform(lp);
    
    // FIXME: if the shape contains non-scaled strokes
    //        we can't rely on boundary itself for a quick
    //        way out. Bounds supposedly already include
    //        thickness, so we might keep a flag telling us
    //        whether *non_scaled* strokes are present
    //        and if not still use the boundary check.
    // NOTE: just skipping this test breaks a corner-case
    //       in DrawingApiTest (kind of a fill-leakage making
    //       the collision detection find you inside a self-crossing
    //       shape).
    if (_def) {
        if (!_def->bounds().point_test(lp.x, lp.y)) return false;
        return _def->pointTestLocal(lp.x, lp.y, wm);
    }
    assert(_shape.get());
    
    if (!_shape->getBounds().point_test(lp.x, lp.y)) return false;
    return _shape->pointTestLocal(lp.x, lp.y, wm);

}