[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h... |
Date: |
Thu, 24 Apr 2008 10:27:14 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 08/04/24 10:27:14
Modified files:
. : ChangeLog
server : dlist.cpp dlist.h sprite_instance.cpp
sprite_instance.h
Log message:
* server/dlist.{h,cpp}: replace_character(), simplify the interface,
drop some unnecessary args.
* server/sprite_instance.{h,cpp}: adopt the new interface.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6379&r2=1.6380
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.118&r2=1.119
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.514&r2=1.515
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.184&r2=1.185
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6379
retrieving revision 1.6380
diff -u -b -r1.6379 -r1.6380
--- ChangeLog 24 Apr 2008 10:16:06 -0000 1.6379
+++ ChangeLog 24 Apr 2008 10:27:13 -0000 1.6380
@@ -1,3 +1,10 @@
+2008-04-24 Zou Lunkai <address@hidden>
+
+ * server/dlist.{h,cpp}: replace_character(), simplify the interface,
+ drop some unnecessary args.
+ * server/sprite_instance.{h,cpp}: adopt the new interface.
+
+
2008-04-24 Sandro Santilli <address@hidden>
* testsuite/misc-ming.all/Makefile.am: add rule to build
Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -b -r1.118 -r1.119
--- server/dlist.cpp 24 Apr 2008 06:21:00 -0000 1.118
+++ server/dlist.cpp 24 Apr 2008 10:27:13 -0000 1.119
@@ -260,10 +260,8 @@
DisplayList::replace_character(
character* ch,
int depth,
- const cxform* color_xform,
- const matrix* mat,
- int ratio,
- int clip_depth)
+ bool use_old_cxform,
+ bool use_old_matrix)
{
testInvariant();
@@ -272,13 +270,6 @@
ch->set_invalidated();
ch->set_depth(depth);
- if ( color_xform ) ch->set_cxform(*color_xform);
- if ( mat ) ch->set_matrix(*mat);
- if(ratio != character::noRatioValue)
- {
- ch->set_ratio(ratio);
- }
- ch->set_clip_depth(clip_depth);
// NOTE: currently, ::restart also cleans up all property, which include
__proto__ !!
// For this reason I commented it out. Since no tests in the testsuite
are failing
@@ -293,16 +284,7 @@
if ( it == _charsByDepth.end() || (*it)->get_depth() != depth )
{
-
- // Error, no existing object found at depth.
-// IF_VERBOSE_DEBUG(
-// log_debug(_("dl::replace_display_object()"
-// " no obj at depth %d"), depth)
-// );
-
- // add the new char
_charsByDepth.insert(it, di);
-
}
else
{
@@ -311,13 +293,13 @@
InvalidatedRanges old_ranges;
- if (!color_xform)
+ if (use_old_cxform)
{
// Use the cxform from the old character.
ch->set_cxform(oldch->get_cxform());
}
- if (!mat)
+ if (use_old_matrix)
{
// Use the matrix from the old character.
ch->set_matrix(oldch->get_matrix());
Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- server/dlist.h 24 Apr 2008 06:21:00 -0000 1.66
+++ server/dlist.h 24 Apr 2008 10:27:14 -0000 1.67
@@ -108,30 +108,28 @@
/// \brief
- /// Puts a new character at the specified depth, replacing any
- /// existing character.
+ /// Replace the old character at the specified depth with
+ /// the given new character.
//
/// Calls unload on the removed character.
///
- /// If use_cxform or use_matrix are false, and a character is
- /// present at the given depth, then keep those respective
- /// properties from the existing character.
+ /// @param ch
+ /// the new character to be put
///
- /// @param color_xform
- /// The color tranform to assign to the new character.
- /// If NULL the default color transform will be kept.
- //
- /// @param mat
- /// The matrix tranform to assign to the new character.
- /// If NULL the default matrix will be kept.
+ /// @param depth
+ /// depth to be replaced
///
- void replace_character(
- character* ch,
- int depth,
- const cxform* color_xform,
- const matrix* mat,
- int ratio,
- int clip_depth);
+ /// @param use_old_cxform
+ /// true: set the new character's cxform to the old one.
+ /// false: keep the new character's cxform.
+ ///
+ /// @param use_old_matrix
+ /// true: set the new character's transformation matrix to the old one.
+ /// false: keep the new character's transformation matrix.
+ ///
+ void replace_character(character* ch, int depth,
+ bool use_old_cxform,
+ bool use_old_matrix);
/// \brief
/// Change depth of the given characters in the list,
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.514
retrieving revision 1.515
diff -u -b -r1.514 -r1.515
--- server/sprite_instance.cpp 24 Apr 2008 06:59:43 -0000 1.514
+++ server/sprite_instance.cpp 24 Apr 2008 10:27:14 -0000 1.515
@@ -3265,14 +3265,32 @@
{
boost::intrusive_ptr<character> ch =
cdef->create_character_instance(this, tag->getID());
- replace_display_object(
- ch.get(),
- tag->hasName() ? &tag->getName() : NULL,
- tag->getDepth(),
- tag->hasCxform() ? &tag->getCxform() : NULL,
- tag->hasMatrix() ? &tag->getMatrix() : NULL,
- tag->getRatio(),
- tag->getClipDepth());
+ // TODO: check if we can drop this for REPLACE!
+ // should we rename the character when it's REPLACE tag?
+ if(tag->hasName())
+ {
+ ch->set_name(tag->getName());
+ }
+ else if(ch->wantsInstanceName())
+ {
+ std::string instance_name = getNextUnnamedInstanceName();
+ ch->set_name(instance_name);
+ }
+ if(tag->getRatio() != character::noRatioValue)
+ {
+ ch->set_ratio(tag->getRatio());
+ }
+ if(tag->hasCxform())
+ {
+ ch->set_cxform(tag->getCxform());
+ }
+ if(tag->hasMatrix())
+ {
+ ch->set_matrix(tag->getMatrix());
+ }
+ replace_display_object(ch.get(), tag->getDepth(),
+ !tag->hasCxform(), // use matrix from the old
character if tag doesn't provide one.
+ !tag->hasMatrix());
}
}
else // non-existing character
@@ -3283,37 +3301,15 @@
void sprite_instance::replace_display_object(
character* ch,
- const std::string* name,
int depth,
- const cxform* color_transform,
- const matrix* mat,
- int ratio,
- int clip_depth)
+ bool use_old_cxform,
+ bool use_old_matrix)
{
- //printf("%s: character %s, id is %d\n", __FUNCTION__, name,
ch->get_id()); // FIXME:
-
assert(ch != NULL);
- if (name)
- {
- ch->set_name(*name);
- }
- else if(ch->wantsInstanceName())
- {
- std::string instance_name = getNextUnnamedInstanceName();
- ch->set_name(instance_name);
- }
-
DisplayList& dlist = const_cast<DisplayList &>( getDisplayList() );
- dlist.replace_character(
- ch,
- depth,
- color_transform,
- mat,
- ratio,
- clip_depth);
-
+ dlist.replace_character(ch, depth, use_old_cxform, use_old_matrix);
}
int sprite_instance::get_id_at_depth(int depth)
@@ -4203,26 +4199,22 @@
save_extern_movie(extern_movie.get());
const std::string& name = get_name();
- int depth = get_depth();
- bool use_cxform = false;
- cxform color_transform = get_cxform();
- bool use_matrix = false;
- matrix mat = get_matrix();
- int ratio = get_ratio();
- int clip_depth = get_clip_depth();
-
assert ( parent == extern_movie->get_parent() );
sprite_instance* parent_sp = parent->to_movie();
assert(parent_sp);
+ if( !name.empty() )
+ {
+ // TODO: check empty != none...
+ extern_movie->set_name(name);
+ }
+ extern_movie->set_clip_depth(get_clip_depth());
+
parent_sp->replace_display_object(
extern_movie.get(),
- name.empty() ? NULL : &name, // TODO: check empty != none...
- depth,
- use_cxform ? &color_transform : NULL,
- use_matrix ? &mat : NULL,
- ratio,
- clip_depth);
+ get_depth(),
+ true,
+ true);
}
else
{
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -b -r1.184 -r1.185
--- server/sprite_instance.h 24 Apr 2008 06:21:01 -0000 1.184
+++ server/sprite_instance.h 24 Apr 2008 10:27:14 -0000 1.185
@@ -368,38 +368,16 @@
///
character* add_display_object(const SWF::PlaceObject2Tag* tag);
- /// See DisplayList::move_display_object, this method is just a proxy
to that...
+ /// Proxy of DisplayList::move_display_object()
//
void move_display_object(const SWF::PlaceObject2Tag* tag);
void replace_display_object(const SWF::PlaceObject2Tag* tag);
- ///
- /// @param color_xform
- /// The color tranform to assign to the new character.
- /// If NULL the default color transform will be kept.
- ///
- /// @param ch
- /// The character instance that should replace the old one.
- ///
- /// @param name
- /// The name to give to the new character (ch).
- /// If NULL, the new instance will be assigned a sequential
- /// name in the form 'instanceN', where N is incremented
- /// at each call, starting from 1.
- ///
- /// @param mat
- /// The matrix tranform to assign to the new character.
- /// If NULL the default matrix will be kept.
- ///
- void replace_display_object(
- character* ch,
- const std::string* name,
- int depth,
- const cxform* color_xform,
- const matrix* mat,
- int ratio,
- int clip_depth);
+ // Proxy of DisplayList::replace_character()
+ void replace_display_object(character* ch, int depth,
+ bool use_old_cxform,
+ bool use_old_matrix);
/// \brief
- [Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...,
Zou Lunkai <=