1 // Shape.cpp: Shape DisplayObject implementation for Gnash.
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
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
22 #include "Transform.h"
27 Shape::pointInShape(boost::int32_t x
, boost::int32_t y
) const
29 SWFMatrix wm
= getWorldMatrix(*this);
34 // FIXME: if the shape contains non-scaled strokes
35 // we can't rely on boundary itself for a quick
36 // way out. Bounds supposedly already include
37 // thickness, so we might keep a flag telling us
38 // whether *non_scaled* strokes are present
39 // and if not still use the boundary check.
40 // NOTE: just skipping this test breaks a corner-case
41 // in DrawingApiTest (kind of a fill-leakage making
42 // the collision detection find you inside a self-crossing
45 if (!_def
->bounds().point_test(lp
.x
, lp
.y
)) return false;
46 return _def
->pointTestLocal(lp
.x
, lp
.y
, wm
);
50 if (!_shape
->getBounds().point_test(lp
.x
, lp
.y
)) return false;
51 return _shape
->pointTestLocal(lp
.x
, lp
.y
, wm
);
56 Shape::display(Renderer
& renderer
, const Transform
& base
)
58 const Transform xform
= base
* transform();
60 if (_def
) _def
->display(renderer
, xform
);
61 else _shape
->display(renderer
, xform
);
69 // indent-tabs-mode: t