[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9571: Some cleanups, drop unused fu
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9571: Some cleanups, drop unused functions. |
Date: |
Fri, 08 Aug 2008 16:15:14 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9571
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Fri 2008-08-08 16:15:14 +0200
message:
Some cleanups, drop unused functions.
Parse and implement DefineButtonCxform tag (SWF2 only).
added:
libcore/swf/DefineButtonCxformTag.h
modified:
libcore/Makefile.am
libcore/impl.cpp
libcore/impl.h
libcore/movie_root.cpp
libcore/parser/button_character_def.cpp
libcore/parser/button_character_def.h
libcore/sprite_instance.cpp
------------------------------------------------------------
revno: 9568.2.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Fri 2008-08-08 14:47:04 +0200
message:
Update comments, use LOG_ONCE.
modified:
libcore/parser/button_character_def.cpp
------------------------------------------------------------
revno: 9568.2.4
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Fri 2008-08-08 14:48:33 +0200
message:
Drop save_extern_movie and s_extern_sprites. Remove old includes.
modified:
libcore/impl.cpp
libcore/impl.h
libcore/movie_root.cpp
libcore/sprite_instance.cpp
------------------------------------------------------------
revno: 9568.2.5
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Fri 2008-08-08 15:46:37 +0200
message:
Implement DefineButtonCxform tag. See
http://www.fortunecity.com/rivendell/krondor/531/2dwrebuild.swf for
perhaps
the only use of it you'll ever see (was replaced in SWF3 by
DefineButton2).
added:
libcore/swf/DefineButtonCxformTag.h
modified:
libcore/Makefile.am
libcore/impl.cpp
libcore/parser/button_character_def.cpp
libcore/parser/button_character_def.h
=== modified file 'libcore/Makefile.am'
--- a/libcore/Makefile.am 2008-08-07 18:51:54 +0000
+++ b/libcore/Makefile.am 2008-08-08 13:46:37 +0000
@@ -174,6 +174,7 @@
swf/ControlTag.h \
swf/DefineFontAlignZonesTag.h \
swf/CSMTextSettingsTag.h \
+ swf/DefineButtonCxformTag.h \
swf/PlaceObject2Tag.h \
swf/RemoveObjectTag.h \
swf/DisplayListTag.h \
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2008-08-07 18:51:54 +0000
+++ b/libcore/impl.cpp 2008-08-08 13:46:37 +0000
@@ -21,19 +21,11 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "IOChannel.h"
#include "utility.h"
-//#include "action.h"
#include "impl.h"
#include "font.h"
#include "fontlib.h"
#include "log.h"
#include "image.h"
-//#include "render.h"
-//#include "shape.h"
-//#include "styles.h"
-//#include "dlist.h"
-//#include "timers.h"
-//#include "zlib_adapter.h"
-//#include "generic_character.h"
#include "sprite_definition.h"
#include "SWFMovieDefinition.h"
#include "swf.h"
@@ -45,6 +37,7 @@
#include "ScriptLimitsTag.h"
#include "BitmapMovieDefinition.h"
#include "DefineFontAlignZonesTag.h"
+#include "DefineButtonCxformTag.h"
#include "CSMTextSettingsTag.h"
#include "PlaceObject2Tag.h"
#include "RemoveObjectTag.h"
@@ -134,7 +127,7 @@
// End tag doesn't really need to exist.
// TODO: use null_loader here ?
- register_tag_loader(SWF::END, end_loader);
+ register_tag_loader(SWF::END, end_loader);
register_tag_loader(SWF::DEFINESHAPE, define_shape_loader);
register_tag_loader(SWF::FREECHARACTER, fixme_loader); // 03
@@ -160,7 +153,7 @@
register_tag_loader(SWF::DEFINELOSSLESS, define_bits_lossless_2_loader);
register_tag_loader(SWF::DEFINEBITSJPEG2, define_bits_jpeg2_loader);
register_tag_loader(SWF::DEFINESHAPE2, define_shape_loader);
- register_tag_loader(SWF::DEFINEBUTTONCXFORM, fixme_loader); // 23
+ register_tag_loader(SWF::DEFINEBUTTONCXFORM,
DefineButtonCxformTag::loader); // 23
// "protect" tag; we're not an authoring tool so we don't care.
// (might be nice to dump the password instead..)
register_tag_loader(SWF::PROTECT, null_loader);
@@ -628,12 +621,6 @@
};
static MovieLibrary s_movie_library;
-static std::vector<sprite_instance*> s_extern_sprites;
-
-void save_extern_movie(sprite_instance* m)
-{
- s_extern_sprites.push_back(m);
-}
static void clear_library()
// Drop all library references to movie_definitions, so they
=== modified file 'libcore/impl.h'
--- a/libcore/impl.h 2008-08-07 13:21:24 +0000
+++ b/libcore/impl.h 2008-08-08 12:48:33 +0000
@@ -27,11 +27,6 @@
namespace gnash {
-// Forward declarations
-class sprite_instance;
-
-DSOEXPORT void save_extern_movie(sprite_instance* m);
-
//
// Loader callbacks.
//
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2008-07-28 21:44:24 +0000
+++ b/libcore/movie_root.cpp 2008-08-08 12:48:33 +0000
@@ -423,8 +423,6 @@
character* ch = extern_movie.get();
ch->set_depth(num+character::staticDepthOffset);
- save_extern_movie(extern_movie.get());
-
setLevel(num, extern_movie);
return true;
=== modified file 'libcore/parser/button_character_def.cpp'
--- a/libcore/parser/button_character_def.cpp 2008-08-07 10:02:35 +0000
+++ b/libcore/parser/button_character_def.cpp 2008-08-08 13:46:37 +0000
@@ -184,36 +184,30 @@
in->ensureBytes(2);
m_button_layer = in->read_u16();
- // TODO: pass available range to button matrix read
+ // matrix::read() checks the length of the stream
m_button_matrix.read(in);
if (tag_type == SWF::DEFINEBUTTON2)
{
- // TODO: pass available range to button cxform read
+ // cxform::read_rgba() checks the length of the stream.
m_button_cxform.read_rgba(in);
}
if ( buttonHasFilterList )
{
filter_factory::read(*in, true, &_filters);
- static bool warned=false;
- if ( ! warned )
- {
+ LOG_ONCE(
log_unimpl("Button filters");
- warned=true;
- }
+ );
}
if ( buttonHasBlendMode )
{
in->ensureBytes(1);
- _blendMode = in->read_u8();
- static bool warned=false;
- if ( ! warned )
- {
+ _blendMode = in->read_u8();
+ LOG_ONCE(
log_unimpl("Button blend mode");
- warned=true;
- }
+ );
}
return true;
@@ -348,6 +342,20 @@
}
void
+button_character_definition::readDefineButtonCxform(SWFStream* in,
movie_definition* /*m*/)
+{
+ // A simple rgb cxform for SWF2 buttons, superseded by DefineButton2.
+ for (ButtonRecVect::iterator i = m_button_records.begin(), e =
m_button_records.end();
+ i != e; ++i)
+ {
+ (*i).m_button_cxform.read_rgb(in);
+ IF_VERBOSE_PARSE(
+ log_parse("Read DefineButtonCxform: %s", (*i).m_button_cxform);
+ );
+ }
+}
+
+void
button_character_definition::readDefineButton2(SWFStream* in,
movie_definition* m)
{
// Character ID has been read already
=== modified file 'libcore/parser/button_character_def.h'
--- a/libcore/parser/button_character_def.h 2008-06-09 13:55:51 +0000
+++ b/libcore/parser/button_character_def.h 2008-08-08 13:46:37 +0000
@@ -260,6 +260,9 @@
/// Read a SWF::DEFINEBUTTONSOUND tag
void readDefineButtonSound(SWFStream* in, movie_definition* m);
+ /// Read a SWF::DEFINEBUTTONCXFORM tag
+ void readDefineButtonCxform(SWFStream* in, movie_definition* m);
+
const rect& get_bound() const {
// It is required that get_bound() is implemented in character
definition
// classes. However, button character definitions do not have
shape
=== modified file 'libcore/sprite_instance.cpp'
--- a/libcore/sprite_instance.cpp 2008-07-19 08:17:17 +0000
+++ b/libcore/sprite_instance.cpp 2008-08-08 12:48:33 +0000
@@ -4573,8 +4573,6 @@
assert ( extern_movie->get_event_handlers().empty() );
extern_movie->set_event_handlers(clipEvs);
- save_extern_movie(extern_movie.get());
-
const std::string& name = get_name();
assert ( parent == extern_movie->get_parent() );
=== added file 'libcore/swf/DefineButtonCxformTag.h'
--- a/libcore/swf/DefineButtonCxformTag.h 1970-01-01 00:00:00 +0000
+++ b/libcore/swf/DefineButtonCxformTag.h 2008-08-08 13:46:37 +0000
@@ -0,0 +1,85 @@
+// DefineButtonCxformTag.h: parse SWF2 button cxform tag.
+//
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#ifndef GNASH_SWF_DEFINEBUTTONCXFORMTAG_H
+#define GNASH_SWF_DEFINEBUTTONCXFORMTAG_H
+
+#include "swf.h" // for tag_type definition
+#include "stream.h" // for inlines
+#include "movie_definition.h"
+#include "button_character_def.h"
+
+namespace gnash {
+namespace SWF {
+
+/// \brief Sets the desired limits for recursion and timeout for AS scripts
+//
+/// A loaded movie containing a ScriptLimits tag should change the *global*
+/// scriptlimits setting, so this is kept in movie_root rather than the
+/// immutable movie_definition. Whenever this tag is parsed, the value in
+/// movie_root is overridden.
+namespace DefineButtonCxformTag
+{
+
+void loader(SWFStream* in, tag_type tag, movie_definition* m)
+{
+
+ assert(tag == SWF::DEFINEBUTTONCXFORM);
+
+ in->ensureBytes(2);
+ const boost::uint16_t buttonID = in->read_u16();
+
+ IF_VERBOSE_PARSE (
+ log_debug("DefineButtonCxformTag: ButtonId=%d", buttonID);
+ );
+
+ character_def* chdef = m->get_character_def(buttonID);
+ if ( ! chdef )
+ {
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror(_("DefineButtonCxform refers to an unknown character
%d"), buttonID);
+ );
+ return;
+ }
+
+ button_character_definition* ch =
dynamic_cast<button_character_definition*> (chdef);
+ if ( ! ch )
+ {
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror(_("DefineButtonCxform refers to character ID %d (%s)."
+ " Expected a button definition"),
+ buttonID, typeName(*chdef));
+ );
+ return;
+ }
+
+ ch->readDefineButtonCxform(in, m);
+ }
+}
+
+} // namespace gnash::SWF
+} // namespace gnash
+
+
+#endif // GNASH_SWF_DEFINEBUTTONCXFORMTAG_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9571: Some cleanups, drop unused functions.,
Benjamin Wolsey <=