gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/font.cpp server/font.h s...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/font.cpp server/font.h s...
Date: Mon, 31 Jul 2006 23:10:14 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/07/31 23:10:14

Modified files:
        .              : ChangeLog 
        server         : font.cpp font.h 
        server/swf     : tag_loaders.cpp 

Log message:
                * server/font.h, server/font.cpp: split read of DefineFont and  
                  DefineFont2 tags
                * server/swf/tag_loaders.cpp: more use of symbolic names for 
SWF tags.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.565&r2=1.566
http://cvs.savannah.gnu.org/viewcvs/gnash/server/font.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/font.h?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.18&r2=1.19

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.565
retrieving revision 1.566
diff -u -b -r1.565 -r1.566
--- ChangeLog   31 Jul 2006 22:10:35 -0000      1.565
+++ ChangeLog   31 Jul 2006 23:10:13 -0000      1.566
@@ -1,5 +1,8 @@
-2006-07-31 Sandro Santilli <address@hidden>
+2006-08-01 Sandro Santilli <address@hidden>
 
+       * server/font.h, server/font.cpp: split read of DefineFont and
+         DefineFont2 tags
+       * server/swf/tag_loaders.cpp: more use of symbolic names for SWF tags.
        * server/samples/sound1.README: added description of sound1.swf.
        * backend/Makefile.am, backend/sound_handler_mp3.cpp,
          backend/sound_handler_sdl.cpp, server/Makefile.am,

Index: server/font.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/font.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/font.cpp     27 Jul 2006 01:47:11 -0000      1.14
+++ server/font.cpp     31 Jul 2006 23:10:14 -0000      1.15
@@ -101,15 +101,24 @@
 
        void    font::read(stream* in, int tag_type, movie_definition* m)
        {
-               assert(tag_type == SWF::DEFINEFONT
-                       || tag_type == SWF::DEFINEFONT2);
-
                // No add_ref() here, to avoid cycle. 
                // m_owning_movie is our owner, so it has a ref to us.
                m_owning_movie = m;
 
                if (tag_type == SWF::DEFINEFONT)
                {
+                       readDefineFont(in, m);
+               }
+               else
+               {
+                       assert (tag_type == SWF::DEFINEFONT2);
+                       readDefineFont2(in, m);
+               }
+       }
+
+       // Read a DefineFont tag
+       void font::readDefineFont(stream* in, movie_definition* m)
+       {
                        log_parse("reading DefineFont");
 
                        int     table_base = in->get_position();
@@ -147,7 +156,9 @@
                                }}
                        }
                }
-               else if (tag_type == SWF::DEFINEFONT2)
+
+       // Read a DefineFont2 tag
+       void font::readDefineFont2(stream* in, movie_definition* m)
                {
                        log_parse("reading DefineFont2");
 
@@ -166,14 +177,16 @@
 
                        m_name = in->read_string_with_length();
 
-                       int     glyph_count = in->read_u16();
+               uint16_t glyph_count = in->read_u16();
                        
                        int     table_base = in->get_position();
 
+log_msg("Sizeof(int):%d, sizeof(uint32_t):%d", sizeof(int), sizeof(uint32_t));
+
                        // Read the glyph offsets.  Offsets
                        // are measured from the start of the
-                       // offset table.
-                       std::vector<int>        offsets;
+               // offset table. Make sure wide offsets fit into elements
+               std::vector<uint32_t>   offsets;
                        int     font_code_offset;
                        if (wide_offsets)
                        {
@@ -219,6 +232,7 @@
                                if (font_code_offset + table_base != 
current_position)
                                {
                                        // Bad offset!  Don't try to read any 
more.
+                               log_warning("Bad offset in DefineFont2!");
                                        return;
                                }
                        }
@@ -290,7 +304,6 @@
                                }}
                        }
                }
-       }
 
 
        // Read additional information about this font, from a

Index: server/font.h
===================================================================
RCS file: /sources/gnash/gnash/server/font.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- server/font.h       25 May 2006 11:46:14 -0000      1.8
+++ server/font.h       31 Jul 2006 23:10:14 -0000      1.9
@@ -141,6 +141,12 @@
        private:
                void    read_code_table(stream* in);
 
+               /// Read a DefineFont2 tag
+               void font::readDefineFont2(stream* in, movie_definition* m);
+
+               // Read a DefineFont tag
+               void font::readDefineFont(stream* in, movie_definition* m);
+
                std::vector< smart_ptr<shape_character_def> >   m_glyphs;
 
                std::vector< texture_glyph >    m_texture_glyphs;       // 
cached info, built by gnash_fontlib.
@@ -149,6 +155,7 @@
 
                char*   m_name;
                movie_definition*       m_owning_movie;
+
                bool    m_has_layout;
                bool    m_unicode_chars;
                bool    m_shift_jis_chars;

Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/swf/tag_loaders.cpp  27 Jul 2006 01:47:11 -0000      1.18
+++ server/swf/tag_loaders.cpp  31 Jul 2006 23:10:14 -0000      1.19
@@ -389,7 +389,8 @@
 void
 define_bits_lossless_2_loader(stream* in, tag_type tag, movie_definition* m)
 {
-    assert(tag == 20 || tag == 36);
+    // tags 20 || 36
+    assert(tag == SWF::DEFINELOSSLESS || tag == SWF::DEFINELOSSLESS2);
 
     uint16_t   character_id = in->read_u16();
     uint8_t    bitmap_format = in->read_u8();  // 3 == 8 bit, 4 == 16 bit, 5 
== 32 bit
@@ -520,7 +521,7 @@
            else
                {
                    // RGBA image data.
-                   assert(tag == 36);
+                   assert(tag == SWF::DEFINELOSSLESS2); // 36
 
                    image::rgba*        image = image::create_rgba(width, 
height);
 
@@ -660,7 +661,7 @@
 
 void define_shape_morph_loader(stream* in, tag_type tag, movie_definition* m)
 {
-    assert(tag == 46);
+    assert(tag == SWF::DEFINEMORPHSHAPE); // 46
     uint16_t character_id = in->read_u16();
     log_parse("  shape_morph_loader: id = %d\n", character_id);
     morph2_character_def* morph = new morph2_character_def;
@@ -676,7 +677,7 @@
 void   define_font_loader(stream* in, tag_type tag, movie_definition* m)
     // Load a DefineFont or DefineFont2 tag.
 {
-    assert(tag == 10 || tag == 48);
+    assert(tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2); // 10 || 48
 
     uint16_t   font_id = in->read_u16();
                
@@ -761,9 +762,9 @@
            m_event_handlers.resize(0);
        }
 
+       // read SWF::PLACEOBJECT or SWF::PLACEOBJECT2
     void       read(stream* in, tag_type tag, int movie_version)
        {
-           assert(tag == 4 || tag == 26);
 
            m_tag_type = tag;
 
@@ -787,8 +788,10 @@
                            log_parse("  cxform:\n"); m_color_transform.print();
                        }
                }
-           else if (tag == SWF::PLACEOBJECT2)
+           else
                {
+                    assert(tag == SWF::PLACEOBJECT2);
+
                    in->align();
 
                    bool        has_actions = in->read_uint(1) ? true : false;
@@ -1113,7 +1116,7 @@
 
 void   end_loader(stream* in, tag_type tag, movie_definition* m)
 {
-    assert(tag == 0);
+    assert(tag == SWF::END); // 0
     assert(in->get_position() == in->get_tag_end_position());
 }
 
@@ -1127,9 +1130,9 @@
 
     void       read(stream* in, int tag)
        {
-           assert(tag == 5 || tag == 28);
+           assert(tag == SWF::REMOVEOBJECT || tag == SWF::REMOVEOBJECT2);
 
-           if (tag == 5)
+           if (tag == SWF::REMOVEOBJECT)
                {
                    // Older SWF's allow multiple objects at the same depth;
                    // this m_id disambiguates.  Later SWF's just use one
@@ -1171,7 +1174,7 @@
 
 void   remove_object_2_loader(stream* in, tag_type tag, movie_definition* m)
 {
-    assert(tag == 5 || tag == 28);
+    assert(tag == SWF::REMOVEOBJECT || tag == SWF::REMOVEOBJECT2);
 
     remove_object_2*   t = new remove_object_2;
     t->read(in, tag);
@@ -1184,7 +1187,7 @@
 
 void   button_sound_loader(stream* in, tag_type tag, movie_definition* m)
 {
-    assert(tag == 17);
+    assert(tag == SWF::DEFINEBUTTONSOUND); // 17
 
     int        button_character_id = in->read_u16();
     button_character_definition* ch = (button_character_definition*) 
m->get_character_def(button_character_id);
@@ -1196,7 +1199,8 @@
 
 void   button_character_loader(stream* in, tag_type tag, movie_definition* m)
 {
-    assert(tag == 7 || tag == 34);
+    // 7 || 34
+    assert(tag == SWF::DEFINEBUTTON || tag == SWF::DEFINEBUTTON2);
 
     int        character_id = in->read_u16();
 
@@ -1217,7 +1221,7 @@
 void   export_loader(stream* in, tag_type tag, movie_definition* m)
     // Load an export tag (for exposing internal resources of m)
 {
-    assert(tag == 56);
+    assert(tag == SWF::EXPORTASSETS); // 56
 
     int        count = in->read_u16();
 
@@ -1380,7 +1384,7 @@
               m->get_loading_frame());
     
     assert(in);
-    assert(tag == 12);
+    assert(tag == SWF::DOACTION); // 12
     assert(m);
     
     do_action* da = new do_action;
@@ -1392,7 +1396,7 @@
 void
 do_init_action_loader(stream* in, tag_type tag, movie_definition* m)
 {
-       assert(tag == 59);
+       assert(tag == SWF::INITACTION); // 59
 
        int sprite_character_id = in->read_u16();
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]