[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/fill_style.cpp server/fi...
From: |
Chad Musick |
Subject: |
[Gnash-commit] gnash ChangeLog server/fill_style.cpp server/fi... |
Date: |
Tue, 04 Sep 2007 11:27:43 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Chad Musick <cmusick> 07/09/04 11:27:43
Modified files:
. : ChangeLog
server : fill_style.cpp fill_style.h impl.cpp styles.cpp
styles.h
server/parser : morph2_character_def.cpp
server/swf : tag_loaders.cpp
Log message:
Changes to make DefineMorphShape2 tags work as well as DefineMorphShape
tags do. This is not yet complete functionality and loses the benefits
of
the '2' in the tag, but allows a large subset of the functionality.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4213&r2=1.4214
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/fill_style.h?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.118&r2=1.119
http://cvs.savannah.gnu.org/viewcvs/gnash/server/styles.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/styles.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/morph2_character_def.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.135&r2=1.136
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4213
retrieving revision 1.4214
diff -u -b -r1.4213 -r1.4214
--- ChangeLog 4 Sep 2007 10:19:00 -0000 1.4213
+++ ChangeLog 4 Sep 2007 11:27:42 -0000 1.4214
@@ -1,3 +1,15 @@
+2007-09-04 Chad Musick <address@hidden>
+
+ * server/fill_style.cpp,.h: Let fill style know how to read
+ morph (2) type styles as well, to avoid duplicating lots
+ of code.
+ * server/styles.cpp,.h: Fill line style know how to read
+ morph2 tags for the same reason.
+ * server/impl.cpp: Change MORPHSHAPE2 loader to activate it.
+ * server/parser/morph2_character_def.cpp: Parse MorphShape2
+ tags as well as MorphShape.
+ * server/swf/tag_loaders.cpp: Recognize MorphShape2 tags.
+
2007-09-04 Sandro Santilli <address@hidden>
* server/vm/ActionExec.{cpp,h}: add an _abortOnUnload flag
Index: server/fill_style.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/fill_style.cpp 3 Sep 2007 05:55:39 -0000 1.10
+++ server/fill_style.cpp 4 Sep 2007 11:27:42 -0000 1.11
@@ -71,10 +71,15 @@
}
void
-fill_style::read(stream* in, int tag_type, movie_definition* md)
+fill_style::read(stream* in, int tag_type, movie_definition* md,
+ fill_style *pOther)
{
+ const bool is_morph = pOther != NULL;
+
in->ensureBytes(1);
m_type = in->read_u8();
+ if (is_morph)
+ pOther->m_type = m_type;
IF_VERBOSE_PARSE
(
@@ -85,9 +90,11 @@
{
// 0x00: solid fill
if ( tag_type == SWF::DEFINESHAPE3 || tag_type == SWF::DEFINESHAPE4
- || tag_type == SWF::DEFINESHAPE4_)
+ || tag_type == SWF::DEFINESHAPE4_ || is_morph)
{
m_color.read_rgba(in);
+ if (is_morph)
+ pOther->m_color.read_rgba(in);
}
else
{
@@ -128,8 +135,20 @@
matrix m;
m.set_inverse(input_matrix);
+
+ if (is_morph)
+ {
+ pOther->m_gradient_matrix = m_gradient_matrix;
+ }
m_gradient_matrix.concatenate(m);
+ if (is_morph)
+ {
+ input_matrix.read(in);
+ m.set_inverse(input_matrix);
+ pOther->m_gradient_matrix.concatenate(m);
+ }
+
// GRADIENT
in->ensureBytes(1);
// num_gradients is not 8 bits, it is only the last 4.
@@ -152,9 +171,14 @@
num_gradients);
}
+ if (is_morph)
+ pOther->m_gradients.resize(num_gradients);
+
m_gradients.resize(num_gradients);
for (int i = 0; i < num_gradients; i++) {
m_gradients[i].read(in, tag_type);
+ if (is_morph)
+ pOther->m_gradients[i].read(in, tag_type);
}
// A focal gradient also has a focal point.
@@ -167,6 +191,9 @@
m_focal_point = 1.0f;
}
+ if (is_morph)
+ pOther->m_focal_point = m_focal_point;
+
IF_VERBOSE_PARSE
(
log_parse(" gradients: num_gradients = %d", num_gradients);
@@ -175,10 +202,18 @@
// @@ hack.
if (num_gradients > 0) {
m_color = m_gradients[0].m_color;
+ if (is_morph)
+ pOther->m_color = m_gradients[0].m_color;
}
if (md->get_create_bitmaps() == DO_LOAD_BITMAPS) {
m_gradient_bitmap_info = create_gradient_bitmap();
+ if (is_morph)
+ {
+ pOther->m_gradient_bitmap_info =
+ pOther->create_gradient_bitmap();
+
md->add_bitmap_info(pOther->m_gradient_bitmap_info.get());
+ }
// Make sure our movie_def_impl knows about this bitmap.
md->add_bitmap_info(m_gradient_bitmap_info.get());
}
@@ -228,6 +263,11 @@
// TWIPS-to-texcoords matrix.
m_bitmap_matrix.set_inverse(m);
+ if (is_morph)
+ {
+ m.read(in);
+ pOther->m_bitmap_matrix.set_inverse(m);
+ }
IF_VERBOSE_PARSE(
m_bitmap_matrix.print();
);
Index: server/fill_style.h
===================================================================
RCS file: /sources/gnash/gnash/server/fill_style.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- server/fill_style.h 2 Sep 2007 17:01:59 -0000 1.9
+++ server/fill_style.h 4 Sep 2007 11:27:42 -0000 1.10
@@ -17,7 +17,7 @@
// Based on work of Thatcher Ulrich <address@hidden> 2003
-/* $Id: fill_style.h,v 1.9 2007/09/02 17:01:59 cmusick Exp $ */
+/* $Id: fill_style.h,v 1.10 2007/09/04 11:27:42 cmusick Exp $ */
#ifndef GNASH_FILL_STYLE_H
#define GNASH_FILL_STYLE_H
@@ -74,7 +74,12 @@
/// 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, movie_definition* m);
+ void read(stream* in, int tag_type, movie_definition* m,
+ fill_style *pOther = NULL);
+
+ /// Read the fill style from a stream, morph version.
+ void read_morph(stream* in, int tag_type, movie_definition* m,
+ fill_style *pOther);
/// \brief
/// Make a bitmap_info* corresponding to our gradient.
Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -b -r1.118 -r1.119
--- server/impl.cpp 2 Sep 2007 12:57:00 -0000 1.118
+++ server/impl.cpp 4 Sep 2007 11:27:42 -0000 1.119
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: impl.cpp,v 1.118 2007/09/02 12:57:00 cmusick Exp $ */
+/* $Id: impl.cpp,v 1.119 2007/09/04 11:27:42 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -245,7 +245,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_, define_shape_loader); // 67
- register_tag_loader(SWF::DEFINEMORPHSHAPE2_, fixme_loader); // 68
+ register_tag_loader(SWF::DEFINEMORPHSHAPE2_,
define_shape_morph_loader); // 68
register_tag_loader(SWF::FILEATTRIBUTES, file_attributes_loader); // 69
register_tag_loader(SWF::PLACEOBJECT3, PlaceObject2Tag::loader); // 70
@@ -261,7 +261,7 @@
register_tag_loader(SWF::DEFINESCALINGGRID, fixme_loader); // 78
register_tag_loader(SWF::DOABCDEFINE, fixme_loader); // 79 -- AS3
codeblock.
register_tag_loader(SWF::DEFINESHAPE4, define_shape_loader); // 83
- register_tag_loader(SWF::DEFINEMORPHSHAPE2, fixme_loader); // 84
+ register_tag_loader(SWF::DEFINEMORPHSHAPE2, define_shape_morph_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.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/styles.cpp 2 Sep 2007 12:57:01 -0000 1.33
+++ server/styles.cpp 4 Sep 2007 11:27:42 -0000 1.34
@@ -29,6 +29,54 @@
{
}
+void
+line_style::read_morph(stream* in, int tag_type, movie_definition *md,
+ line_style *pOther)
+{
+ if (tag_type == SWF::DEFINEMORPHSHAPE)
+ {
+ m_width = in->read_u16();
+ pOther->m_width = in->read_u16();
+ m_color.read(in, tag_type);
+ pOther->m_color.read(in, tag_type);
+ return;
+ }
+
+ // MorphShape 2 from here down.
+ in->ensureBytes(4);
+ m_width = in->read_u16();
+ pOther->m_width = in->read_u16();
+ // TODO: Same as in read(...), use these.
+ // 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)
+ {
+ float f_miter = in->read_short_ufixed();
+ }
+ if (has_fill)
+ {
+ // TODO: Throwing this away is not the right thing.
+ // What is?
+ // A fill style is here.
+ fill_style f, g;
+ f.read(in, tag_type, md, &g);
+ m_color = f.get_color();
+ }
+ else
+ {
+ m_color.read(in, tag_type);
+ pOther->m_color.read(in, tag_type);
+ }
+}
void
line_style::read(stream* in, int tag_type, movie_definition *md)
@@ -58,6 +106,10 @@
bool end_cap_style = in->read_uint(2); // As caps above.
if (joins == 2)
{
+ /*float f_miter =*/static_cast<void>(in->read_short_ufixed());
+ }
+ if (has_fill)
+ {
// TODO: Throwing this away is not the right thing.
// What is?
// A fill style is here.
Index: server/styles.h
===================================================================
RCS file: /sources/gnash/gnash/server/styles.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/styles.h 2 Sep 2007 12:57:01 -0000 1.21
+++ server/styles.h 4 Sep 2007 11:27:42 -0000 1.22
@@ -5,7 +5,7 @@
// line style types.
-/* $Id: styles.h,v 1.21 2007/09/02 12:57:01 cmusick Exp $ */
+/* $Id: styles.h,v 1.22 2007/09/04 11:27:42 cmusick Exp $ */
#ifndef GNASH_STYLES_H
#define GNASH_STYLES_H
@@ -59,6 +59,11 @@
///
void read(stream* in, int tag_type, movie_definition *md);
+ /// Read two lines styles from the SWF stream
+ /// at the same time -- this is used in morphing.
+ void read_morph(stream* in, int tag_type, movie_definition *md,
+ line_style *pOther);
+
/// Return thickness of the line, in TWIPS
uint16_t get_width() const { return m_width; }
Index: server/parser/morph2_character_def.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/morph2_character_def.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/parser/morph2_character_def.cpp 9 Aug 2007 12:18:06 -0000
1.13
+++ server/parser/morph2_character_def.cpp 4 Sep 2007 11:27:43 -0000
1.14
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: morph2_character_def.cpp,v 1.13 2007/08/09 12:18:06 zoulunkai Exp $ */
+/* $Id: morph2_character_def.cpp,v 1.14 2007/09/04 11:27:43 cmusick Exp $ */
// Based on the public domain morph2.cpp of:
// Thatcher Ulrich <address@hidden>, Mike Shaver <address@hidden> 2003,
@@ -216,7 +216,9 @@
void morph2_character_def::read(stream* in, int tag_type, bool
with_style, movie_definition* md)
{
- assert(tag_type == SWF::DEFINEMORPHSHAPE);
+ assert(tag_type == SWF::DEFINEMORPHSHAPE
+ || tag_type == SWF::DEFINEMORPHSHAPE2
+ || tag_type == SWF::DEFINEMORPHSHAPE2_);
UNUSED(tag_type);
UNUSED(with_style);
@@ -227,12 +229,25 @@
m_shape1->set_bound(bound1);
m_shape2->set_bound(bound2);
+ if (tag_type == SWF::DEFINEMORPHSHAPE2 || tag_type ==
SWF::DEFINEMORPHSHAPE2_)
+ {
+ // TODO: Use these values.
+ rect inner_bound1, inner_bound2;
+ inner_bound1.read(in);
+ inner_bound2.read(in);
+ // This should be used -- first 6 bits reserved, then
'non-scaling' stroke,
+ // then 'scaling' stroke -- these can be used to optimize
morphing.
+ static_cast<void>(in->read_u8());
+ }
+
in->ensureBytes(4);
offset = in->read_u32();
// Next line will throw ParserException on malformed SWF
fill_style_count = in->read_variable_count();
int i;
+ if (tag_type == SWF::DEFINEMORPHSHAPE)
+ {
for (i = 0; i < fill_style_count; i++) {
fill_style fs1, fs2;
@@ -339,8 +354,21 @@
m_shape1->m_fill_styles.push_back(fs1);
m_shape2->m_fill_styles.push_back(fs2);
}
+ }
+ else // MorphShape2
+ {
+ fill_style fs1, fs2;
+ for (i = 0; i < fill_style_count; ++i)
+ {
+ fs1.read(in, tag_type, md, &fs2);
+ m_shape1->m_fill_styles.push_back(fs1);
+ m_shape2->m_fill_styles.push_back(fs2);
+ }
+ }
line_style_count = in->read_variable_count();
+ if (tag_type == SWF::DEFINEMORPHSHAPE)
+ {
for (i = 0; i < line_style_count; i++) {
line_style ls1, ls2;
in->ensureBytes(4);
@@ -351,6 +379,17 @@
m_shape1->m_line_styles.push_back(ls1);
m_shape2->m_line_styles.push_back(ls2);
}
+ }
+ else // MorphShape2 is different
+ {
+ line_style ls1, ls2;
+ for (i = 0; i < line_style_count; ++i)
+ {
+ ls1.read_morph(in, tag_type, md, &ls2);
+ m_shape1->m_line_styles.push_back(ls1);
+ m_shape2->m_line_styles.push_back(ls2);
+ }
+ }
m_shape1->read(in, tag_type, false, md);
in->align();
@@ -368,6 +407,7 @@
fill_style& fs1 = m_shape1->m_fill_styles[k];
fs.m_gradients.resize(fs1.m_gradients.size());
}
+
m_line_styles.resize(m_shape1->m_line_styles.size());
m_paths.resize(m_shape1->m_paths.size());
Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -b -r1.135 -r1.136
--- server/swf/tag_loaders.cpp 2 Sep 2007 12:57:01 -0000 1.135
+++ server/swf/tag_loaders.cpp 4 Sep 2007 11:27:43 -0000 1.136
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: tag_loaders.cpp,v 1.135 2007/09/02 12:57:01 cmusick Exp $ */
+/* $Id: tag_loaders.cpp,v 1.136 2007/09/04 11:27:43 cmusick Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1063,7 +1063,10 @@
void define_shape_morph_loader(stream* in, tag_type tag, movie_definition* m)
{
- assert(tag == SWF::DEFINEMORPHSHAPE); // 46
+ assert(tag == SWF::DEFINEMORPHSHAPE
+ || tag == SWF::DEFINEMORPHSHAPE2
+ || tag == SWF::DEFINEMORPHSHAPE2_);
+
uint16_t character_id = in->read_u16();
IF_VERBOSE_PARSE
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/fill_style.cpp server/fi...,
Chad Musick <=