CVSROOT: /cvsroot/gnash Module name: gnash Changes by: Udo Giacomozzi <udog> 07/05/22 14:23:51
Modified files: . : ChangeLog server : character.cpp character.h cxform.h dlist.cpp sprite_instance.cpp Log message: some invalidated bounds fixes CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3305&r2=1.3306 http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.41&r2=1.42 http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.76&r2=1.77 http://cvs.savannah.gnu.org/viewcvs/gnash/server/cxform.h?cvsroot=gnash&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.65&r2=1.66 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.272&r2=1.273 Patches: Index: ChangeLog =================================================================== RCS file: /cvsroot/gnash/gnash/ChangeLog,v retrieving revision 1.3305 retrieving revision 1.3306 diff -u -b -r1.3305 -r1.3306 --- ChangeLog 22 May 2007 13:56:32 -0000 1.3305 +++ ChangeLog 22 May 2007 14:23:50 -0000 1.3306 @@ -1,4 +1,15 @@ +2007-05-22 Udo Giacomozzi <[EMAIL PROTECTED]> + + * server/character.{h,cpp}: Added preprocessor code to analyze + calls to set_invalidated() more easily. + * server/cxform.h: Implemented == operator + * server/dlist.cpp: inherit invalidated bounds when replacing a + character + * server/sprite_instance.cpp: avoid call to set_invalidated() + (of parent) when replacing a char + 2007-05-22 Ann Barcomb <[EMAIL PROTECTED]> + * doc/C/usermanual/*: Added files for the new user manual. * doc/C/app_authors.xml: Added a file which is used in the user manual but might be cross-referenced by other documents. Index: server/character.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/server/character.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -b -r1.41 -r1.42 --- server/character.cpp 3 May 2007 09:54:45 -0000 1.41 +++ server/character.cpp 22 May 2007 14:23:51 -0000 1.42 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: character.cpp,v 1.41 2007/05/03 09:54:45 udog Exp $ */ +/* $Id: character.cpp,v 1.42 2007/05/22 14:23:51 udog Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -33,6 +33,8 @@ #include <boost/algorithm/string/case_conv.hpp> +#undef set_invalidated + namespace gnash { @@ -185,6 +187,12 @@ void character::set_invalidated() { + set_invalidated("unknown", -1); +} + +void +character::set_invalidated(const char* debug_file, int debug_line) +{ // Set the invalidated-flag of the parent. Note this does not mean that // the parent must re-draw itself, it just means that one of it's childs // needs to be re-drawn. @@ -202,6 +210,11 @@ { m_invalidated = true; + #ifdef DEBUG_SET_INVALIDATED + printf("%p set_invalidated() of %s in %s:%d\n", this, get_name().c_str(), + debug_file, debug_line); + #endif + // NOTE: we need to set snap_distance in order to avoid too tight // invalidated ranges. The GUI chooses the appropriate distance in base // of various parameters but for this internal ranges list we don't know @@ -228,6 +241,13 @@ } } +void +character::extend_invalidated_bounds(const InvalidatedRanges& ranges) +{ + set_invalidated(__FILE__, __LINE__); + m_old_invalidated_ranges.add(ranges); +} + //--------------------------------------------------------------------- // // Shared ActionScript getter-setters Index: server/character.h =================================================================== RCS file: /cvsroot/gnash/gnash/server/character.h,v retrieving revision 1.76 retrieving revision 1.77 diff -u -b -r1.76 -r1.77 --- server/character.h 21 May 2007 10:10:59 -0000 1.76 +++ server/character.h 22 May 2007 14:23:51 -0000 1.77 @@ -18,7 +18,7 @@ // // -/* $Id: character.h,v 1.76 2007/05/21 10:10:59 udog Exp $ */ +/* $Id: character.h,v 1.77 2007/05/22 14:23:51 udog Exp $ */ #ifndef GNASH_CHARACTER_H #define GNASH_CHARACTER_H @@ -46,6 +46,8 @@ #include <cassert> #include <typeinfo> +//#define DEBUG_SET_INVALIDATED 1 + // Forward declarations namespace gnash { class sprite_instance; @@ -360,7 +362,7 @@ { assert(m.is_valid()); if (!(m == m_matrix)) { - set_invalidated(); + set_invalidated(__FILE__, __LINE__); m_matrix = m; } } @@ -383,14 +385,16 @@ const cxform& get_cxform() const { return m_color_transform; } void set_cxform(const cxform& cx) { - set_invalidated(); + if (!(cx == m_color_transform)) { + set_invalidated(__FILE__, __LINE__); m_color_transform = cx; } + } void concatenate_cxform(const cxform& cx) { m_color_transform.concatenate(cx); } void concatenate_matrix(const matrix& m) { m_matrix.concatenate(m); } float get_ratio() const { return m_ratio; } void set_ratio(float f) { - if (f!=m_ratio) set_invalidated(); + if (f!=m_ratio) set_invalidated(__FILE__, __LINE__); m_ratio = f; } @@ -720,7 +724,7 @@ // TODO: why is this virtual ?? virtual void set_visible(bool visible) { - if (m_visible!=visible) set_invalidated(); + if (m_visible!=visible) set_invalidated(__FILE__, __LINE__); m_visible = visible; } @@ -847,6 +851,14 @@ /// @see \ref region_update /// void set_invalidated(); + void set_invalidated(const char* debug_file, int debug_line); + + + /// Calls set_invalidated() and extends old_invalidated_ranges to the + /// given value so that also this area gets re-rendered (used when + /// replacing characters). + void extend_invalidated_bounds(const InvalidatedRanges& ranges); + /// Called by a child to signalize it has changed visibily. The /// difference to set_invalidated() is that *this* character does @@ -968,6 +980,9 @@ } // end namespace gnash +#ifdef DEBUG_SET_INVALIDATED +#define set_invalidated() set_invalidated(__FILE__, __LINE__) +#endif #endif // GNASH_CHARACTER_H Index: server/cxform.h =================================================================== RCS file: /cvsroot/gnash/gnash/server/cxform.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- server/cxform.h 19 May 2007 22:12:51 -0000 1.5 +++ server/cxform.h 22 May 2007 14:23:51 -0000 1.6 @@ -39,6 +39,7 @@ { public: + friend bool operator== (const cxform&, const cxform&); friend std::ostream& operator<< (std::ostream& os, const cxform& cx); /// [RGBA][multiply, add] @@ -85,6 +86,19 @@ }; +inline bool operator== (const cxform& a, const cxform& b) +{ + return + a.m_[0][0] == b.m_[0][0] && + a.m_[0][1] == b.m_[0][1] && + a.m_[1][0] == b.m_[1][0] && + a.m_[1][1] == b.m_[1][1] && + a.m_[2][0] == b.m_[2][0] && + a.m_[2][1] == b.m_[2][1] && + a.m_[3][0] == b.m_[3][0] && + a.m_[3][1] == b.m_[3][1]; +} + } // namespace gnash Index: server/dlist.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/server/dlist.cpp,v retrieving revision 1.65 retrieving revision 1.66 diff -u -b -r1.65 -r1.66 --- server/dlist.cpp 15 May 2007 07:38:15 -0000 1.65 +++ server/dlist.cpp 22 May 2007 14:23:51 -0000 1.66 @@ -195,15 +195,24 @@ if ( it == _characters.end() || (*it)->get_depth() != depth ) { //log_msg(_("place_character: new character at depth %d"), depth); + // add the new char _characters.insert(it, DisplayItem(ch)); } else { //log_msg(_("place_character: replacing existing character at depth %d"), depth); + + // remember bounds of old char + InvalidatedRanges old_ranges; + (*it)->add_invalidated_bounds(old_ranges, true); + (*it)->unload(); // replace existing char *it = DisplayItem(ch); + + // extend invalidated bounds + ch->extend_invalidated_bounds(old_ranges); } // Give life to this instance @@ -283,6 +292,9 @@ } else { + + InvalidatedRanges old_ranges; + if (!use_cxform) { // Use the cxform from the old character. @@ -295,9 +307,15 @@ ch->set_matrix((*it)->get_matrix()); } + // remember bounds of old char + (*it)->add_invalidated_bounds(old_ranges, true); + // replace existing char *it = di; + // extend invalidated bounds + ch->extend_invalidated_bounds(old_ranges); + // TODO: check: Shouldn't we construct the new object here too ? //ch->construct(); } Index: server/sprite_instance.cpp =================================================================== RCS file: /cvsroot/gnash/gnash/server/sprite_instance.cpp,v retrieving revision 1.272 retrieving revision 1.273 diff -u -b -r1.272 -r1.273 --- server/sprite_instance.cpp 19 May 2007 22:12:51 -0000 1.272 +++ server/sprite_instance.cpp 22 May 2007 14:23:51 -0000 1.273 @@ -3163,8 +3163,6 @@ ch->set_name(name); } - set_invalidated(); - m_display_list.replace_character( ch, depth, _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit