CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/27 10:44:45
Modified files: . : ChangeLog server : movie_root.cpp movie_root.h Log message: * server/movie_root.{cpp,h}: add the concept of an 'invalidated' stage/movie_root. The Stage is only invalidated when the background color changes, dunno if it should also be invalidated by changes in the _levels.. maybe I'm using a confusing terminology here... Anyway this fixes bug #21169 and probably allow for cleanups in the gui code, where some paranoia is used to tell the first ::display call apart from subsequent, exactly for the invalidated bounds on startup problem. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4440&r2=1.4441 http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.99&r2=1.100 http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.76&r2=1.77 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4440 retrieving revision 1.4441 diff -u -b -r1.4440 -r1.4441 --- ChangeLog 27 Sep 2007 09:27:40 -0000 1.4440 +++ ChangeLog 27 Sep 2007 10:44:45 -0000 1.4441 @@ -1,5 +1,16 @@ 2007-09-27 Sandro Santilli <[EMAIL PROTECTED]> + * server/movie_root.{cpp,h}: add the concept of an 'invalidated' + stage/movie_root. The Stage is only invalidated when the background + color changes, dunno if it should also be invalidated by changes + in the _levels.. maybe I'm using a confusing terminology here... + Anyway this fixes bug #21169 and probably allow for cleanups + in the gui code, where some paranoia is used to tell the first + ::display call apart from subsequent, exactly for the invalidated + bounds on startup problem. + +2007-09-27 Sandro Santilli <[EMAIL PROTECTED]> + * server/movie_root.cpp (restart): rework restart mechanism by actually re-instantiating the root from it's definition. Index: server/movie_root.cpp =================================================================== RCS file: /sources/gnash/gnash/server/movie_root.cpp,v retrieving revision 1.99 retrieving revision 1.100 diff -u -b -r1.99 -r1.100 --- server/movie_root.cpp 27 Sep 2007 09:27:41 -0000 1.99 +++ server/movie_root.cpp 27 Sep 2007 10:44:45 -0000 1.100 @@ -79,7 +79,8 @@ m_active_input_text(NULL), m_time_remainder(0.0f), m_drag_state(), - _allowRescale(true) + _allowRescale(true), + _invalidated(true) { } @@ -212,15 +213,8 @@ // Run the garbage collector again GC::get().collect(); #endif -} -void -movie_root::clear_invalidated() -{ - for (Levels::iterator i=_movies.begin(), e=_movies.end(); i!=e; ++i) - { - i->second->clear_invalidated(); - } + setInvalidated(); } boost::intrusive_ptr<Stage> @@ -727,6 +721,8 @@ // should we cache this ? it's immutable after all ! const rect& frame_size = getLevel(0)->get_frame_size(); + clearInvalidated(); + render::begin_display( m_background_color, m_viewport_x0, m_viewport_y0, @@ -1063,6 +1059,12 @@ void movie_root::add_invalidated_bounds(InvalidatedRanges& ranges, bool force) { + if ( isInvalidated() ) + { + ranges.setWorld(); + return; + } + for (Levels::reverse_iterator i=_movies.rbegin(), e=_movies.rend(); i!=e; ++i) { i->second->add_invalidated_bounds(ranges, force); @@ -1310,5 +1312,31 @@ std::for_each(_liveChars.begin(), _liveChars.end(), boost::bind(advanceLiveChar, _1, delta_time)); } +void +movie_root::set_background_color(const rgba& color) +{ + //GNASH_REPORT_FUNCTION; + + if ( m_background_color != color ) + { + setInvalidated(); + m_background_color = color; + } +} + +void +movie_root::set_background_alpha(float alpha) +{ + //GNASH_REPORT_FUNCTION; + + uint8_t newAlpha = iclamp(frnd(alpha * 255.0f), 0, 255); + + if ( m_background_color.m_a != newAlpha ) + { + setInvalidated(); + m_background_color.m_a = newAlpha; + } +} + } // namespace gnash Index: server/movie_root.h =================================================================== RCS file: /sources/gnash/gnash/server/movie_root.h,v retrieving revision 1.76 retrieving revision 1.77 diff -u -b -r1.76 -r1.77 --- server/movie_root.h 13 Sep 2007 16:26:13 -0000 1.76 +++ server/movie_root.h 27 Sep 2007 10:44:45 -0000 1.77 @@ -15,7 +15,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -/* $Id: movie_root.h,v 1.76 2007/09/13 16:26:13 strk Exp $ */ +/* $Id: movie_root.h,v 1.77 2007/09/27 10:44:45 strk Exp $ */ /// \page events_handling Handling of user events /// @@ -422,15 +422,9 @@ return getLevel(0)->get_character(character_id); } - void set_background_color(const rgba& color) - { - m_background_color = color; - } + void set_background_color(const rgba& color); - void set_background_alpha(float alpha) - { - m_background_color.m_a = iclamp(frnd(alpha * 255.0f), 0, 255); - } + void set_background_alpha(float alpha); float get_background_alpha() const { @@ -537,9 +531,6 @@ bool testInvariant() const; - // Clear invalidated flag for all levels - void clear_invalidated(); - /// Push an executable code to the ActionQueue void pushAction(std::auto_ptr<ExecutableCode> code); @@ -753,6 +744,30 @@ /// boost::intrusive_ptr<key_as_object> getKeyObject(); + /// Boundaries of the Stage are always world boundaries + /// and are only invalidated by changes in the background + /// color. + void setInvalidated() { _invalidated=true; } + + /// Every ::display call clears the invalidated flag + // + /// See setInvalidated(); + /// + void clearInvalidated() { _invalidated=false; } + + /// An invalidated stage will trigger complete redraw + // + /// So, this method should return true everytime a complete + /// redraw is needed. This is tipically only needed when + /// the background changes. + /// + /// See setInvalidated() and clearInvalidated(). + /// + bool isInvalidated() { return _invalidated; } + + /// See setInvalidated + bool _invalidated; + }; _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit