gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog gui/gui.cpp gui/gui.h


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/gui.cpp gui/gui.h
Date: Tue, 17 Oct 2006 12:42:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/10/17 12:42:28

Modified files:
        .              : ChangeLog 
        gui            : gui.cpp gui.h 

Log message:
                * gui/gui.{cpp,h}: extracted a display() function out of
                  advance_movie(), for possible reuse from event notifiers.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1261&r2=1.1262
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.23&r2=1.24

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1261
retrieving revision 1.1262
diff -u -b -r1.1261 -r1.1262
--- ChangeLog   17 Oct 2006 12:37:46 -0000      1.1261
+++ ChangeLog   17 Oct 2006 12:42:28 -0000      1.1262
@@ -1,5 +1,7 @@
 2006-10-17 Sandro Santilli <address@hidden>
 
+       * gui/gui.{cpp,h}: extracted a display() function out of
+         advance_movie(), for possible reuse from event notifiers.
        * server/edit_text_character.cpp: commented out debugging line
        * testsuite/misc-ming.all/ButtonEventsTest.c: set movie rate
          to 0.2 frames per second, to test redraw-on-event (not working

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- gui/gui.cpp 16 Oct 2006 14:45:47 -0000      1.29
+++ gui/gui.cpp 17 Oct 2006 12:42:28 -0000      1.30
@@ -208,7 +208,8 @@
 void
 Gui::notify_mouse_moved(int x, int y) 
 {
-    get_current_root()->notify_mouse_moved(x, y);
+       movie_interface* m = get_current_root();
+       m->notify_mouse_moved(x, y);
 }
 
 void
@@ -218,56 +219,60 @@
 }
 
 bool
-Gui::advance_movie(Gui* gui)
+Gui::display(gnash::movie_interface* m)
 {
-       assert(gui);
-
   rect changed_bounds;  // new bounds for the current frame
   rect draw_bounds;     // redraw bounds (union of current and previous frame)
   bool redraw_flag;
   
-//    GNASH_REPORT_FUNCTION;
-       gnash::movie_interface* m = gnash::get_current_root();
-
-  // Advance movie by one frame
-       m->advance(1.0);
-       
        // Should the frame be rendered completely, even if it did not change?
-       redraw_flag = gui->want_redraw();
+       redraw_flag = want_redraw();
 
-  // Find out the surrounding frame of all characters wich have been updated.
+       // Find out the surrounding frame of all characters which
+       // have been updated.
   m->get_invalidated_bounds(&changed_bounds, false);
 
 
-  if (redraw_flag) {
-  
+       if (redraw_flag)
+       {
     draw_bounds.m_x_min = -1e10f;
     draw_bounds.m_y_min = -1e10f;
     draw_bounds.m_x_max = +1e10f;
     draw_bounds.m_y_max = +1e10f;
+       }
+       else
+       {
     
-  } else {
-  
-    // Union it with the previous frame (when a character moved, we also need 
to
-    // redraw it's previous position).
+               // Union it with the previous frame (when a character moved,
+               // we also need to redraw it's previous position).
     draw_bounds = changed_bounds;
-    if (gui->_last_invalidated_bounds.m_x_min <= 
gui->_last_invalidated_bounds.m_x_max)  
-      draw_bounds.expand_to_rect(gui->_last_invalidated_bounds);
+               // TODO: the following condition seems bogus to me...
+               //       what about always calling expand_to_rect
+               //       and let rect class take care of any check ?
+               if (_last_invalidated_bounds.m_x_min <= 
_last_invalidated_bounds.m_x_max)  
+               {
+                       draw_bounds.expand_to_rect(_last_invalidated_bounds);
+               }
       
   }
   
   
   // Avoid drawing of stopped movies
-  if (draw_bounds.m_x_min <= draw_bounds.m_x_max) {
+       // TODO: the following condition seems a bit undeadable to me,
+       //       do we mean to catch an *empty* rect ? what about
+       //       adding a is_empty() method to rect class then ?
+       if (draw_bounds.m_x_min <= draw_bounds.m_x_max)
+       {
   
-    // Tell the GUI that we only need to update this region (it may ignore this
-    // information)
-    gui->set_invalidated_region(draw_bounds);
+               // Tell the GUI that we only need to update this region
+               // (it may ignore this information)
+               set_invalidated_region(draw_bounds);
 
     // render the frame      
     m->display();
   
-    // show invalidated region using a red rectangle (Flash debug style)
+               // show invalidated region using a red rectangle
+               // (Flash debug style)
     IF_DEBUG_REGION_UPDATES (
     point corners[4];
     corners[0].m_x = draw_bounds.m_x_min;      
@@ -280,15 +285,32 @@
     corners[3].m_y = draw_bounds.m_y_max;
     matrix dummy;      
     gnash::render::set_matrix(dummy); // reset matrix
-    gnash::render::draw_poly(&corners[0], 4, rgba(0,0,0,0), rgba(255,0,0,255));
+                       gnash::render::draw_poly(&corners[0], 4,
+                               rgba(0,0,0,0), rgba(255,0,0,255));
     );
 
     // show frame on screen
-       gui->renderBuffer();
+               renderBuffer();
        
   }
   
-  gui->_last_invalidated_bounds = changed_bounds;
+       _last_invalidated_bounds = changed_bounds;
+  
+}
+
+bool
+Gui::advance_movie(Gui* gui)
+{
+       assert(gui);
+
+  
+//    GNASH_REPORT_FUNCTION;
+       gnash::movie_interface* m = gnash::get_current_root();
+
+  // Advance movie by one frame
+       m->advance(1.0);
+
+       gui->display(m);
   
        if ( ! gui->loops() )
        {

Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- gui/gui.h   16 Oct 2006 14:41:30 -0000      1.23
+++ gui/gui.h   17 Oct 2006 12:42:28 -0000      1.24
@@ -214,6 +214,11 @@
     render_handler* _renderer;
     /// Invalidated bounds of previous frame
     rect            _last_invalidated_bounds;
+
+private:
+
+    bool display(gnash::movie_interface* m);
+
 };
 
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]