~ubuntu-branches/ubuntu/karmic/gnash/karmic

« back to all changes in this revision

Viewing changes to server/parser/BitmapMovieDefinition.h

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-10-13 14:29:49 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20081013142949-f6qdvnu4mn05ltdc
Tags: 0.8.4~~bzr9980-0ubuntu1
* new upstream release 0.8.4 (LP: #240325)
* ship new lib usr/lib/gnash/libmozsdk.so.* in mozilla-plugin-gnash
  - update debian/mozilla-plugin-gnash.install
* ship new lib usr/lib/gnash/libgnashnet.so.* in gnash-common
  - update debian/gnash-common.install
* add basic debian/build_head script to build latest CVS head packages.
  - add debian/build_head
* new sound architecture requires build depend on libsdl1.2-dev
  - update debian/control
* head build script now has been completely migrated to bzr (upstream +
  ubuntu)
  - update debian/build_head
* disable kde gui until klash/qt4 has been fixed; keep kde packages as empty
  packages for now.
  - update debian/rules
  - debian/klash.install
  - debian/klash.links
  - debian/klash.manpages
  - debian/konqueror-plugin-gnash.install
* drop libkonq5-dev build dependency accordingly
  - update debian/control
* don't install headers manually anymore. gnash doesnt provide a -dev
  package after all
  - update debian/rules
* update libs installed in gnash-common; libgnashserver-*.so is not available
  anymore (removed); in turn we add the new libgnashcore-*.so
  - update debian/gnash-common.install
* use -Os for optimization and properly pass CXXFLAGS=$(CFLAGS) to configure
  - update debian/rules
* touch firefox .autoreg in postinst of mozilla plugin
  - update debian/mozilla-plugin-gnash.postinst
* link gnash in ubufox plugins directory for the plugin alternative switcher
  - add debian/mozilla-plugin-gnash.links
* suggest ubufox accordingly
  - update debian/control
* add new required build-depends on libgif-dev
  - update debian/control
* add Xb-Npp-Description and Xb-Npp-File as new plugin database meta data
  - update debian/control

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// 
2
 
//   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
3
 
// 
4
 
// This program is free software; you can redistribute it and/or modify
5
 
// it under the terms of the GNU General Public License as published by
6
 
// the Free Software Foundation; either version 3 of the License, or
7
 
// (at your option) any later version.
8
 
// 
9
 
// This program is distributed in the hope that it will be useful,
10
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
// GNU General Public License for more details.
13
 
// 
14
 
// You should have received a copy of the GNU General Public License
15
 
// along with this program; if not, write to the Free Software
16
 
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
 
 
18
 
#ifndef GNASH_BITMAPMOVIEDEFINITION_H
19
 
#define GNASH_BITMAPMOVIEDEFINITION_H
20
 
 
21
 
#include "movie_definition.h" // for inheritance
22
 
#include "rect.h" // for composition
23
 
#include "BitmapMovieInstance.h" // for create_movie_instance
24
 
#include "bitmap_character_def.h" // for destructor visibility by intrusive_ptr
25
 
#include "DynamicShape.h" // for destructor visibility by intrusive_ptr
26
 
 
27
 
#include <string>
28
 
#include <memory> // for auto_ptr
29
 
 
30
 
// Forward declarations
31
 
namespace gnash {
32
 
        class bitmap_character_def;
33
 
}
34
 
 
35
 
namespace gnash
36
 
{
37
 
 
38
 
/// A "movie" definition for a bitmap file
39
 
//
40
 
/// The create_movie_instance function will return a BitmapMovieInstance
41
 
///
42
 
class BitmapMovieDefinition : public movie_definition
43
 
{
44
 
        int _version;
45
 
        rect _framesize;
46
 
        size_t _framecount;
47
 
        float _framerate;
48
 
        std::string _url;
49
 
 
50
 
        std::auto_ptr<image::rgb> _image;
51
 
 
52
 
        boost::intrusive_ptr<bitmap_character_def> _bitmap;
53
 
 
54
 
        boost::intrusive_ptr<DynamicShape> _shapedef;
55
 
 
56
 
        /// Get the shape character definition for this bitmap movie
57
 
        //
58
 
        /// It will create the definition the first time it's called
59
 
        ///
60
 
        shape_character_def* getShapeDef();
61
 
 
62
 
        size_t _bytesTotal;
63
 
 
64
 
protected:
65
 
 
66
 
#ifdef GNASH_USE_GC
67
 
        /// Mark reachable resources of a BitmapMovieDefinition
68
 
        //
69
 
        /// Reachable resources are:
70
 
        ///     - dynamic shape (_shapedef)
71
 
        ///     - bitmap (_bitmap)
72
 
        ///
73
 
        void markReachableResources() const;
74
 
#endif // GNASH_USE_GC
75
 
 
76
 
public:
77
 
 
78
 
 
79
 
        /// Construct a BitmapMovieDefinition for the given image (rgb)
80
 
        //
81
 
        /// Will be initialized with the following values
82
 
        ///
83
 
        ///  - SWF version 6
84
 
        ///  - Framesize extracted from image 
85
 
        ///  - Single frame (unlabeled)
86
 
        ///  - 12 FPS
87
 
        ///  - image->size() bytes (for get_bytes_loaded()/get_bytes_total())
88
 
        ///  - provided url
89
 
        ///
90
 
        BitmapMovieDefinition(std::auto_ptr<image::rgb> image, const std::string& url);
91
 
 
92
 
        // Discard id, always return the only shape character we have 
93
 
        virtual character_def* get_character_def(int /*id*/)
94
 
        {
95
 
                return getShapeDef();
96
 
        }
97
 
 
98
 
        virtual int     get_version() const {
99
 
                return _version;
100
 
        }
101
 
 
102
 
        virtual float   get_width_pixels() const {
103
 
                return ceilf(TWIPS_TO_PIXELS(_framesize.width()));
104
 
        }
105
 
 
106
 
        virtual float   get_height_pixels() const {
107
 
                return ceilf(TWIPS_TO_PIXELS(_framesize.height()));
108
 
        }
109
 
 
110
 
        virtual size_t  get_frame_count() const {
111
 
                return _framecount;
112
 
        }
113
 
 
114
 
        virtual float   get_frame_rate() const {
115
 
                return _framerate;
116
 
        }
117
 
 
118
 
        virtual const rect& get_frame_size() const {
119
 
                return _framesize;
120
 
        }
121
 
 
122
 
        virtual const rect& get_bound() const {
123
 
                return _framesize;
124
 
        }
125
 
 
126
 
        /// Return number of bytes loaded
127
 
        //
128
 
        /// Since no progressive load is implemented yet
129
 
        /// we'll always return total bytes here..
130
 
        ///
131
 
        virtual size_t get_bytes_loaded() const {
132
 
                return get_bytes_total();
133
 
        }
134
 
 
135
 
        /// Return total number of bytes which composed this movie
136
 
        //
137
 
        /// We actually cheat, and return the image size here...
138
 
        ///
139
 
        virtual size_t get_bytes_total() const {
140
 
                return _bytesTotal;
141
 
        }
142
 
        
143
 
        /// Create a playable movie_instance from this def.
144
 
        virtual movie_instance* create_movie_instance(character* parent=0)
145
 
        {
146
 
                return new BitmapMovieInstance(this, parent);
147
 
        }
148
 
 
149
 
        virtual const std::string& get_url() const {
150
 
                return _url;
151
 
        }
152
 
 
153
 
        // Inheritance from movie_definition requires this.
154
 
        // we always return 1 so sprite_instance::stagePlacementCallback
155
 
        // doesn't skip our handling (TODO: check if it's correct to
156
 
        // skip handling of 0-frames movies..).
157
 
        size_t  get_loading_frame() const 
158
 
        {
159
 
                return 1;
160
 
        }
161
 
};
162
 
 
163
 
} // namespace gnash
164
 
 
165
 
#endif // GNASH_BITMAPMOVIEDEFINITION_H