2
// Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
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.
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.
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
18
#ifndef GNASH_CHARACTER_DEF_H
19
#define GNASH_CHARACTER_DEF_H
22
#include "gnashconfig.h"
25
#include "resource.h" // for inheritance from resource class
27
// Forward declarations
39
class render_cache_manager;
42
/// Immutable data representing the template of a movie element.
44
/// This is not really a public interface. It's here so it
45
/// can be mixed into movie_definition and sprite_definition,
46
/// without using multiple inheritance.
48
class character_def : public resource
54
character_def& operator= (const character_def&) { abort(); return *this; }
64
virtual ~character_def();
66
virtual void display(character* /*instance_info*/)
70
/// Return true if the specified point is on the interior of our shape.
72
/// Point coordinates are local coords (TWIPS)
74
virtual bool point_test_local(float /*x*/, float /*y*/)
79
virtual float get_height_local() const
84
virtual float get_width_local() const
89
/// Should stick the result in a boost::intrusive_ptr immediately.
91
/// default is to make a generic_character
93
virtual character* create_character_instance(character* parent,
96
// From resource interface.
97
virtual character_def* cast_to_character_def()
102
// Declared as virtual here because generic_character needs access to it
103
virtual const rect& get_bound() const = 0;
107
/// Cache holder for renderer (contents depend on renderer handler)
108
/// Will be deleted by destructor of the character_def.
109
/// We could store by auto_ptr, but I'm afraid that would mean
110
/// including render_handler.h in this header, which I don't like.
113
render_cache_manager* m_render_cache;
117
/// Copy a character definition
119
/// The copy will have a NULL render cache object.
120
/// The only known use of copy constructor is from
121
/// duplicateMovieClip, in particular during copy
122
/// of the drawable object, which is a subclass
123
/// of a shape_character_def
125
/// The choice of NOT copying the cache manager
126
/// is a choice of simplicity. We can't copy the
127
/// pointer as the character_def destructor will
128
/// destroy it, and we don't want to destroy it twice.
129
/// We don't want to make a copy of the whole cache
130
/// as it might be a waste of resource, we don't want
131
/// to share ownership as some character_def ended up
132
/// NOT being immutable any more !! :(
134
/// By setting the cache to NULL we'll leave reconstruction
135
/// of a cache to the renderers.
137
/// TODO: improve by implementing copy on write for the cache ?
139
character_def(const character_def& o)
141
resource(), // this is a new resource, nothing to copy
152
#endif // GNASH_CHARACTER_DEF_H
157
// indent-tabs-mode: t