Gnash  0.8.11dev
Shape.h
Go to the documentation of this file.
1 // Shape.h: Shape DisplayObject implementation for Gnash.
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
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.
10 //
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.
15 //
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
19 
20 #ifndef GNASH_SHAPE_H
21 #define GNASH_SHAPE_H
22 
23 #include "DisplayObject.h"
24 #include "DefineShapeTag.h"
25 #include "DynamicShape.h"
26 
27 #include <boost/intrusive_ptr.hpp>
28 #include <cassert>
29 #include <boost/shared_ptr.hpp>
30 
31 namespace gnash {
32 
34 //
38 class Shape : public DisplayObject
39 {
40 
41 public:
42 
43  Shape(movie_root& mr, as_object* object, boost::shared_ptr<DynamicShape> sh,
45  :
46  DisplayObject(mr, object, parent),
47  _shape(sh)
48  {
49  assert(_shape.get());
50  }
51 
52  Shape(movie_root& mr, as_object* object, const SWF::DefineShapeTag* def,
54  :
55  DisplayObject(mr, object, parent),
56  _def(def)
57  {
58  assert(_def);
59  }
60 
61  virtual void display(Renderer& renderer, const Transform& xform);
62 
63  virtual SWFRect getBounds() const {
64  return _def ? _def->bounds() : _shape->getBounds();
65  }
66 
67  virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const;
68 
69 private:
70 
71  const boost::intrusive_ptr<const SWF::DefineShapeTag> _def;
72 
73  boost::shared_ptr<DynamicShape> _shape;
74 
75 };
76 
77 
78 } // namespace gnash
79 
80 
81 #endif
82 
83 
84 // Local Variables:
85 // mode: C++
86 // indent-tabs-mode: t
87 // End: