Gnash
0.8.10
|
00001 // Shape.h: Shape DisplayObject implementation for Gnash. 00002 // 00003 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 00004 // Free Software Foundation, Inc 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 00020 #ifndef GNASH_SHAPE_H 00021 #define GNASH_SHAPE_H 00022 00023 #include "DisplayObject.h" 00024 #include "DefineShapeTag.h" 00025 #include "DynamicShape.h" 00026 00027 #include <boost/intrusive_ptr.hpp> 00028 #include <cassert> 00029 #include <boost/shared_ptr.hpp> 00030 00031 namespace gnash { 00032 00034 // 00038 class Shape : public DisplayObject 00039 { 00040 00041 public: 00042 00043 Shape(movie_root& mr, as_object* object, boost::shared_ptr<DynamicShape> sh, 00044 DisplayObject* parent) 00045 : 00046 DisplayObject(mr, object, parent), 00047 _shape(sh) 00048 { 00049 assert(_shape.get()); 00050 } 00051 00052 Shape(movie_root& mr, as_object* object, const SWF::DefineShapeTag* def, 00053 DisplayObject* parent) 00054 : 00055 DisplayObject(mr, object, parent), 00056 _def(def) 00057 { 00058 assert(_def); 00059 } 00060 00061 virtual void display(Renderer& renderer, const Transform& xform); 00062 00063 virtual SWFRect getBounds() const { 00064 return _def ? _def->bounds() : _shape->getBounds(); 00065 } 00066 00067 virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const; 00068 00069 private: 00070 00071 const boost::intrusive_ptr<const SWF::DefineShapeTag> _def; 00072 00073 boost::shared_ptr<DynamicShape> _shape; 00074 00075 }; 00076 00077 00078 } // namespace gnash 00079 00080 00081 #endif 00082 00083 00084 // Local Variables: 00085 // mode: C++ 00086 // indent-tabs-mode: t 00087 // End: