00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GNASH_DLIST_H
00023 #define GNASH_DLIST_H
00024
00025
00026 #include "container.h"
00027 #include "types.h"
00028 #include "impl.h"
00029
00030 #include <list>
00031 #include <iosfwd>
00032
00033 namespace gnash {
00034
00036 typedef boost::intrusive_ptr<character> DisplayItem;
00037
00039
00045 class DisplayList {
00046
00047 public:
00048
00052
00080 void place_character(
00081 character* ch,
00082 uint16_t depth,
00083 const cxform& color_xform,
00084 const matrix& mat,
00085 float ratio,
00086 uint16_t clip_depth);
00087
00091
00099 void replace_character(
00100 character* ch,
00101 uint16_t depth,
00102 bool use_cxform,
00103 const cxform& color_xform,
00104 bool use_matrix,
00105 const matrix& mat,
00106 float ratio,
00107 uint16_t clip_depth);
00108
00109 void swap_characters(character* ch, character* ch2);
00110
00113 void move_display_object(
00114 uint16_t depth,
00115 bool use_cxform,
00116 const cxform& color_xform,
00117 bool use_matrix,
00118 const matrix& mat,
00119 float ratio,
00120 uint16_t clip_depth);
00121
00123 void remove_display_object(uint16_t depth);
00124
00128 void clear();
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 void clear_unaffected(std::vector<uint16>& affected_depths);
00139
00143 void reset();
00144
00146 void advance(float delta_time);
00147
00151 void display();
00152
00154 character* get_character_at_depth(int depth);
00155
00156 const character* get_character_at_depth(int depth) const {
00157 return const_cast<DisplayList*>(this)->get_character_at_depth(depth);
00158 }
00159
00163 character* get_character_by_name(const std::string& name);
00164
00165 const character* get_character_by_name(const std::string& name) const
00166 {
00167 return const_cast<DisplayList*>(this)->get_character_by_name(name);
00168 }
00169
00173 character* get_character_by_name_i(const std::string& name);
00174
00178
00182 template <class V>
00183 inline void visitForward(V& visitor);
00184
00188
00193 template <class V>
00194 inline void visitBackward(V& visitor);
00195
00197 void dump(std::ostream& os) const;
00198
00201 void get_invalidated_bounds(rect* bounds, bool force);
00202
00203
00205 size_t size() const {
00206 return _characters.size();
00207 }
00208
00210
00215 int getNextHighestDepth() const;
00216
00217 private:
00218
00219 typedef std::list<DisplayItem> container_type;
00220 typedef container_type::iterator iterator;
00221 typedef container_type::const_iterator const_iterator;
00222 typedef container_type::reverse_iterator reverse_iterator;
00223 typedef container_type::const_reverse_iterator const_reverse_iterator;
00224
00225 container_type _characters;
00226
00227
00228 };
00229
00230 template <class V>
00231 void
00232 DisplayList::visitForward(V& visitor)
00233 {
00234 for (iterator it = _characters.begin(),
00235 itEnd = _characters.end();
00236 it != itEnd; ++it)
00237 {
00238 DisplayItem& di = *it;
00239 if ( ! visitor(di.get()) )
00240 {
00241 break;
00242 }
00243 }
00244 }
00245
00246 template <class V>
00247 void
00248 DisplayList::visitBackward(V& visitor)
00249 {
00250 for (reverse_iterator it = _characters.rbegin(),
00251 itEnd = _characters.rend();
00252 it != itEnd; ++it)
00253 {
00254 DisplayItem& di = *it;
00255
00256
00257
00258 if ( ! visitor(di.get()) )
00259 {
00260 break;
00261
00262
00263
00264
00265 #if 0
00266
00267
00268
00269 if (di->can_handle_mouse_event())
00270 {
00271 break;
00272 }
00273 #endif
00274 }
00275 }
00276 }
00277
00278 }
00279
00280
00281 #endif // GNASH_DLIST_H
00282
00283
00284
00285
00286
00287
00288
00289
00290