Gnash  0.8.11dev
Bitmap.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 
20 #ifndef GNASH_BITMAP_H
21 #define GNASH_BITMAP_H
22 
23 #include <boost/intrusive_ptr.hpp>
24 #include "DisplayObject.h"
26 #include "DynamicShape.h"
27 
28 namespace gnash {
29  class CachedBitmap;
30  class BitmapMovieDefinition;
31 }
32 
33 
34 namespace gnash {
35 
36 
39 //
42 //
45 //
49 class Bitmap : public DisplayObject
50 {
51 public:
52 
54  Bitmap(movie_root& mr, as_object* object, BitmapData_as* bd,
56 
58  Bitmap(movie_root& mr, as_object* object, const BitmapMovieDefinition* def,
59  DisplayObject* parent);
60 
61  virtual ~Bitmap();
62 
64  virtual void update();
65 
66  virtual void add_invalidated_bounds(InvalidatedRanges& ranges, bool force);
67 
69  virtual void display(Renderer& renderer, const Transform& xform);
70 
72  virtual SWFRect getBounds() const;
73 
75  virtual bool pointInShape(std::int32_t x, std::int32_t y) const;
76 
78  virtual void construct(as_object* init = nullptr);
79 
80 protected:
81 
82  void markReachableObjects() const {
83  if (_bitmapData) _bitmapData->setReachable();
84  }
85 
86 private:
87 
89  //
91  const CachedBitmap* bitmap() const;
92 
94  //
97  void checkBitmapData();
98 
100  //
103  const boost::intrusive_ptr<const BitmapMovieDefinition> _def;
104 
105  BitmapData_as* _bitmapData;
106 
108  DynamicShape _shape;
109 
111  size_t _width;
112 
114  size_t _height;
115 
116 };
117 
118 } // end namespace gnash
119 
120 
121 #endif // GNASH_DYNAMIC_SHAPE_H
122 
123 
124 // Local Variables:
125 // mode: C++
126 // c-basic-offset: 8
127 // tab-width: 8
128 // indent-tabs-mode: t
129 // End:
virtual bool pointInShape(std::int32_t x, std::int32_t y) const
Test whether a point is in the Bitmap&#39;s bounds.
Definition: Bitmap.cpp:108
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:168
Definition: Bitmap.h:49
DisplayObject * parent() const
Return the parent of this DisplayObject, or NULL if the DisplayObject has no parent.
Definition: DisplayObject.h:252
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
virtual void display(Renderer &renderer, const Transform &xform)
Display this Bitmap.
Definition: Bitmap.cpp:114
The base class for all ActionScript objects.
Definition: as_object.h:161
virtual ~Bitmap()
Definition: Bitmap.cpp:61
Base class for render handlers.
Definition: Renderer.h:188
virtual SWFRect getBounds() const
Get the bounds of the Bitmap.
Definition: Bitmap.cpp:139
void markReachableObjects() const
Definition: Bitmap.h:82
virtual void update()
Notify the Bitmap that it&#39;s been updated during ActionScript execution.
Definition: Bitmap.cpp:145
The DynamicShape class represents a mutable shape.
Definition: DynamicShape.h:44
A "movie" definition for a bitmap file.
Definition: BitmapMovieDefinition.h:45
std::int32_t x
Definition: BitmapData_as.cpp:434
virtual void add_invalidated_bounds(InvalidatedRanges &ranges, bool force)
Add the DisplayObject&#39;s invalidated bounds to the given ranges list.
Definition: Bitmap.cpp:126
std::int32_t y
Definition: BitmapData_as.cpp:435
Bitmap(movie_root &mr, as_object *object, BitmapData_as *bd, DisplayObject *parent)
Construct a Bitmap character from a BitmapData.
Definition: Bitmap.cpp:35
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:44
virtual void setReachable()
Overrides Relay::setReachable().
Definition: BitmapData_as.cpp:615
A CachedBitmap is created by the renderer in a format of its choosing.
Definition: CachedBitmap.h:37
virtual void construct(as_object *init=nullptr)
Called when the object is placed on stage.
Definition: Bitmap.cpp:74
Implements the BitmapData native type.
Definition: BitmapData_as.h:63
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:33
This class represents the &#39;Stage&#39; and top-level movie.
Definition: movie_root.h:150