1 // Shape.cpp: Shape DisplayObject implementation for Gnash.
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "smart_ptr.h"
23 #include "Transform.h"
29 Shape::pointInShape(boost::int32_t x
, boost::int32_t y
) const
31 SWFMatrix wm
= getWorldMatrix(*this);
36 // FIXME: if the shape contains non-scaled strokes
37 // we can't rely on boundary itself for a quick
38 // way out. Bounds supposedly already include
39 // thickness, so we might keep a flag telling us
40 // whether *non_scaled* strokes are present
41 // and if not still use the boundary check.
42 // NOTE: just skipping this test breaks a corner-case
43 // in DrawingApiTest (kind of a fill-leakage making
44 // the collision detection find you inside a self-crossing
47 if (!_def
->bounds().point_test(lp
.x
, lp
.y
)) return false;
48 return _def
->pointTestLocal(lp
.x
, lp
.y
, wm
);
52 if (!_shape
->getBounds().point_test(lp
.x
, lp
.y
)) return false;
53 return _shape
->pointTestLocal(lp
.x
, lp
.y
, wm
);
58 Shape::display(Renderer
& renderer
, const Transform
& base
)
60 const Transform xform
= base
* transform();
62 if (_def
) _def
->display(renderer
, xform
);
63 else _shape
->display(renderer
, xform
);
71 // indent-tabs-mode: t