gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/fill_style.cpp server/im...


From: Chad Musick
Subject: [Gnash-commit] gnash ChangeLog server/fill_style.cpp server/im...
Date: Sun, 02 Sep 2007 12:57:01 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Chad Musick <cmusick>   07/09/02 12:57:01

Modified files:
        .              : ChangeLog 
        server         : fill_style.cpp impl.cpp styles.cpp styles.h 
        server/parser  : shape_character_def.cpp 
        server/swf     : tag_loaders.cpp 

Log message:
        Changes to allow DefineShape4 to (halfway) work.  At the moment, no
        functionality not included in lesser Define Shapes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4189&r2=1.4190
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.117&r2=1.118
http://cvs.savannah.gnu.org/viewcvs/gnash/server/styles.cpp?cvsroot=gnash&r1=1.32&r2=1.33
http://cvs.savannah.gnu.org/viewcvs/gnash/server/styles.h?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.37&r2=1.38
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.134&r2=1.135

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4189
retrieving revision 1.4190
diff -u -b -r1.4189 -r1.4190
--- ChangeLog   2 Sep 2007 07:23:52 -0000       1.4189
+++ ChangeLog   2 Sep 2007 12:57:00 -0000       1.4190
@@ -1,3 +1,19 @@
+2007-09-02 Chad Musick <address@hidden>
+
+       * server/fill_style.cpp -- Update the allow focal gradient fill style,
+         and to accomodate some format changes for SWF8+ tags.  Focal
+         gradients are not implemented yet -- I don't yet know how to do this.
+       * server/impl.cpp -- Update DefineShape4 loader function from 
fixme_loader
+         to shape loader.
+       * server/styles.h -- Change signature of read function to include the
+         movie definition since it may be part of a fill style, which needs 
this.
+       * server/styles.cpp -- Change read function to read new line styles
+         allowed in newer SWF files.
+       * server/parser/shape_character_def.cpp -- Change loader to know how
+         to read a DefineShape4 tag.
+       * server/swf/tag_loaders.cpp -- Let the shape_loader be able to load
+         a DefineShape4 tag.
+
 2007-09-02 Zou Lunkai <address@hidden>
        
        * testsuite/misc-swfc.all/movieclip_destruction_test2.sc: one more test.

Index: server/fill_style.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/fill_style.cpp       7 Aug 2007 20:53:10 -0000       1.7
+++ server/fill_style.cpp       2 Sep 2007 12:57:00 -0000       1.8
@@ -84,7 +84,8 @@
     if (m_type == SWF::FILL_SOLID)
     {
         // 0x00: solid fill
-        if ( tag_type == SWF::DEFINESHAPE3 )
+        if ( tag_type == SWF::DEFINESHAPE3 || tag_type == SWF::DEFINESHAPE4
+                       || tag_type == SWF::DEFINESHAPE4_)
         {
             m_color.read_rgba(in);
         }
@@ -102,10 +103,12 @@
                );
     }
     else if (m_type == SWF::FILL_LINEAR_GRADIENT
-            || m_type == SWF::FILL_RADIAL_GRADIENT)
+            || m_type == SWF::FILL_RADIAL_GRADIENT
+                       || m_type == SWF::FILL_FOCAL_GRADIENT)
     {
         // 0x10: linear gradient fill
         // 0x12: radial gradient fill
+        // 0x13: focal gradient fill
 
         matrix input_matrix;
         input_matrix.read(in);
@@ -121,6 +124,13 @@
         {
             m_gradient_matrix.concatenate_translation(32.f, 32.f);
             m_gradient_matrix.concatenate_scale(1.0f / 512.0f);
+                       // TODO: Obviously, a focal gradient isn't a radial
+                       // gradient, but how _should_ this be handled?
+                       if (m_type == SWF::FILL_FOCAL_GRADIENT)
+                       {
+                               /* float focal_point = */
+                               static_cast<void>(in->read_short_sfixed());
+                       }
         }
 
         matrix m;

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- server/impl.cpp     24 Aug 2007 05:55:51 -0000      1.117
+++ server/impl.cpp     2 Sep 2007 12:57:00 -0000       1.118
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: impl.cpp,v 1.117 2007/08/24 05:55:51 cmusick Exp $ */
+/* $Id: impl.cpp,v 1.118 2007/09/02 12:57:00 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -244,7 +244,7 @@
 
         // TODO: Alexis reference says these are 83, 84. The 67,68 comes from 
Tamarin.
         // Figure out which one is correct (possibly both are).
-        register_tag_loader(SWF::DEFINESHAPE4_, fixme_loader 
/*define_shape_loader*/); // 67
+        register_tag_loader(SWF::DEFINESHAPE4_, define_shape_loader); // 67
         register_tag_loader(SWF::DEFINEMORPHSHAPE2_, fixme_loader); // 68
 
        register_tag_loader(SWF::FILEATTRIBUTES, file_attributes_loader); // 69
@@ -260,7 +260,7 @@
        register_tag_loader(SWF::METADATA, metadata_loader); // 77
        register_tag_loader(SWF::DEFINESCALINGGRID, fixme_loader); // 78
         register_tag_loader(SWF::DOABCDEFINE, fixme_loader); // 79 -- AS3 
codeblock.
-       register_tag_loader(SWF::DEFINESHAPE4, fixme_loader 
/*define_shape_loader*/); // 83
+       register_tag_loader(SWF::DEFINESHAPE4, define_shape_loader); // 83
        register_tag_loader(SWF::DEFINEMORPHSHAPE2, fixme_loader); // 84
 
         register_tag_loader(SWF::DEFINEFONTNAME, define_font_name_loader); // 
88

Index: server/styles.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/styles.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/styles.cpp   7 Aug 2007 20:53:10 -0000       1.32
+++ server/styles.cpp   2 Sep 2007 12:57:01 -0000       1.33
@@ -31,11 +31,44 @@
 
 
 void
-line_style::read(stream* in, int tag_type)
+line_style::read(stream* in, int tag_type, movie_definition *md)
 {
+    if (!(tag_type == SWF::DEFINESHAPE4 || tag_type == SWF::DEFINESHAPE4_))
+       {
     in->ensureBytes(2);
     m_width = in->read_u16();
     m_color.read(in, tag_type);
+               return;
+       }
+
+       // TODO: Unfinished. Temporary to allow define shape 4 to work in many
+       // cases, but does not work correctly in all cases.
+       in->ensureBytes(2);
+       m_width = in->read_u16();
+       // 0 -- Round caps, 1 -- No caps, 2 -- square caps
+       uint8_t caps = in->read_uint(2);
+       // 0 -- Round join, 1 -- Bevel join, 2 -- Miter join
+       uint8_t joins = in->read_uint(2);
+       bool has_fill = in->read_uint(1);
+       bool no_hscale = in->read_uint(1);
+       bool no_vscale = in->read_uint(1);
+       bool pixel_hinting = in->read_uint(1);
+       static_cast<void> (in->read_uint(5));
+       bool no_close = in->read_uint(1);
+       bool end_cap_style = in->read_uint(2); // As caps above.
+       if (joins == 2)
+       {
+               // TODO: Throwing this away is not the right thing.
+               // What is?
+               // A fill style is here.
+               fill_style f;
+               f.read(in, tag_type, md);
+               m_color = f.get_color();
+       }
+       else
+       {
+               m_color.read(in, tag_type);
+       }
 }
 
 

Index: server/styles.h
===================================================================
RCS file: /sources/gnash/gnash/server/styles.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/styles.h     7 Aug 2007 20:53:10 -0000       1.20
+++ server/styles.h     2 Sep 2007 12:57:01 -0000       1.21
@@ -5,7 +5,7 @@
 
 // line style types.
 
-/* $Id: styles.h,v 1.20 2007/08/07 20:53:10 strk Exp $ */
+/* $Id: styles.h,v 1.21 2007/09/02 12:57:01 cmusick Exp $ */
 
 #ifndef GNASH_STYLES_H
 #define GNASH_STYLES_H
@@ -18,7 +18,7 @@
 namespace gnash {
 
 class stream;
-
+class movie_definition;
 
 class base_line_style
 {
@@ -57,7 +57,7 @@
        /// Throw a ParserException if there's no enough bytes in the
        /// currently opened tag for reading. See stream::ensureBytes()
        ///
-       void    read(stream* in, int tag_type);
+       void    read(stream* in, int tag_type, movie_definition *md);
        
        /// Return thickness of the line, in TWIPS
        uint16_t        get_width() const { return m_width; }

Index: server/parser/shape_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -b -r1.37 -r1.38
--- server/parser/shape_character_def.cpp       27 Aug 2007 18:39:19 -0000      
1.37
+++ server/parser/shape_character_def.cpp       2 Sep 2007 12:57:01 -0000       
1.38
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: shape_character_def.cpp,v 1.37 2007/08/27 18:39:19 strk Exp $ */
+/* $Id: shape_character_def.cpp,v 1.38 2007/09/02 12:57:01 cmusick Exp $ */
 
 // Based on the public domain shape.cpp of Thatcher Ulrich <address@hidden> 
2003
 
@@ -106,7 +106,8 @@
 
 
 static void
-read_line_styles(std::vector<line_style>& styles, stream* in, int tag_type)
+read_line_styles(std::vector<line_style>& styles, stream* in, int tag_type,
+       movie_definition *md)
     // Read line styles and push them onto the back of the given array.
 {
     // Get the count.
@@ -135,7 +136,7 @@
     for (int i = 0; i < line_style_count; i++) {
        styles.resize(styles.size() + 1);
        //styles[styles.size() - 1].read(in, tag_type);
-       styles.back().read(in, tag_type);
+       styles.back().read(in, tag_type, md);
     }
 }
 
@@ -184,8 +185,16 @@
     log_parse(_("  bound rect: %s"), b.c_str());
                );
 
+       // TODO: Store and use these.  Unfinished.
+       if (tag_type == SWF::DEFINESHAPE4 || tag_type == SWF::DEFINESHAPE4_)
+       {
+               rect tbound;
+               tbound.read(in);
+               /*uint8_t scales =*/static_cast<void>(in->read_u8());
+       }
+
        read_fill_styles(m_fill_styles, in, tag_type, m);
-       read_line_styles(m_line_styles, in, tag_type);
+       read_line_styles(m_line_styles, in, tag_type, m);
     }
 
     /// Adding a dummy fill style is just needed to make the
@@ -424,7 +433,7 @@
                fill_base = m_fill_styles.size();
                line_base = m_line_styles.size();
                read_fill_styles(m_fill_styles, in, tag_type, m);
-               read_line_styles(m_line_styles, in, tag_type);
+               read_line_styles(m_line_styles, in, tag_type, m);
                num_fill_bits = in->read_uint(4);
                num_line_bits = in->read_uint(4);
            }

Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -b -r1.134 -r1.135
--- server/swf/tag_loaders.cpp  28 Aug 2007 13:12:38 -0000      1.134
+++ server/swf/tag_loaders.cpp  2 Sep 2007 12:57:01 -0000       1.135
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: tag_loaders.cpp,v 1.134 2007/08/28 13:12:38 strk Exp $ */
+/* $Id: tag_loaders.cpp,v 1.135 2007/09/02 12:57:01 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1046,7 +1046,8 @@
 {
     assert(tag == SWF::DEFINESHAPE
           || tag == SWF::DEFINESHAPE2
-          || tag == SWF::DEFINESHAPE3);
+          || tag == SWF::DEFINESHAPE3
+          || tag == SWF::DEFINESHAPE4 || tag == SWF::DEFINESHAPE4_);
 
     uint16_t   character_id = in->read_u16();
     IF_VERBOSE_PARSE




reply via email to

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