gnash-commit
[Top][All Lists]
Advanced

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

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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/Player.cpp gui/gui.cpp gui/...
Date: Wed, 23 Apr 2008 14:55:28 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/23 14:55:28

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

Log message:
                * gui/gui.{cpp,h}: Put stage matrix computation in its own
                  method (updateStageMatrix). Call on resize.
                * gui/Player.cpp: call Gui's updateStageMatrix when
                  the Stage.align and Stage.scaleMode events are received.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6358&r2=1.6359
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.102&r2=1.103
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.154&r2=1.155
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.h?cvsroot=gnash&r1=1.89&r2=1.90

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6358
retrieving revision 1.6359
diff -u -b -r1.6358 -r1.6359
--- ChangeLog   23 Apr 2008 14:29:36 -0000      1.6358
+++ ChangeLog   23 Apr 2008 14:55:27 -0000      1.6359
@@ -1,5 +1,12 @@
 2008-04-23 Sandro Santilli <address@hidden>
 
+       * gui/gui.{cpp,h}: Put stage matrix computation in its own
+         method (updateStageMatrix). Call on resize.
+       * gui/Player.cpp: call Gui's updateStageMatrix when 
+         the Stage.align and Stage.scaleMode events are received.
+
+2008-04-23 Sandro Santilli <address@hidden>
+
        * server/render.{cpp,h}: drop get_scale interface (unused).
        * backend/render_handler.h: add set_translation method, to
          go togheter with set_scale for setting a "stage matrix".

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -b -r1.102 -r1.103
--- gui/Player.cpp      14 Apr 2008 09:33:10 -0000      1.102
+++ gui/Player.cpp      23 Apr 2008 14:55:27 -0000      1.103
@@ -537,6 +537,12 @@
         return "";
     }
     
+    if (event == "Stage.scaleMode" || event == "Stage.align" )
+    {
+        _gui->updateStageMatrix();
+        return "";
+    }
+    
     if (event == "System.capabilities.screenResolutionX")
     {
         std::ostringstream ss;

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -b -r1.154 -r1.155
--- gui/gui.cpp 23 Apr 2008 14:29:37 -0000      1.154
+++ gui/gui.cpp 23 Apr 2008 14:55:28 -0000      1.155
@@ -221,19 +221,14 @@
 }
 
 void
-Gui::resize_view(int width, int height)
+Gui::updateStageMatrix()
 {
-       GNASH_REPORT_FUNCTION;
-
-       assert(width>0);
-       assert(height>0);
-
-       if ( VM::isInitialized() )
-       {
-
-               if ( _stage && _started )
+       if ( ! VM::isInitialized() )
                {
-                       _stage->set_display_viewport(0, 0, width, height);
+               // When VM initializes, we'll get a call to resize_view, which
+               // would call us again.
+               //log_debug("Can't update stage matrix till VM is initialized");
+               return;
                }
 
                float swfwidth = _movieDef->get_width_pixels();
@@ -243,8 +238,8 @@
                {
 
                        // set new scale value ( user-pixel / pseudo-pixel )
-                       _xscale = width / swfwidth;
-                       _yscale = height / swfheight;
+               _xscale = _width / swfwidth;
+               _yscale = _height / swfheight;
                        
                        // always scale proportionally
                        if (_xscale < _yscale) _yscale = _xscale;
@@ -265,14 +260,14 @@
                        // Offsets in pixels
                        float defWidth = swfwidth *= _xscale;
                        float defHeight = swfheight *= _yscale;
-                       if ( width > defWidth )
+               if ( _width > defWidth )
                        {
-                               float diffWidth = width-defWidth;
+                       float diffWidth = _width-defWidth;
                                _xoffset = diffWidth/2.0;
                        }
-                       if ( width > defHeight )
+               if ( _height > defHeight )
                        {
-                               float diffHeight = height-defHeight;
+                       float diffHeight = _height-defHeight;
                                _yoffset = diffHeight/2.0;
                        }
                }
@@ -281,24 +276,38 @@
                _renderer->set_scale(_xscale, _yscale);
                _renderer->set_translation(_xoffset, _yoffset);
 
-       }
-       else
-       {
-               //log_debug(_("Resize request received while there's still"
-               //      " no movie loaded, can't correctly set movie scale"));
-       }
-       
        // trigger redraw
        //_redraw_flag |= (_width!=width) || (_height!=height);
        _redraw_flag = true; // this fixes bug #21971
 
-       // set new size ?
+
+       if ( _stage ) display(_stage);
+}
+
+
+void
+Gui::resize_view(int width, int height)
+{
+       GNASH_REPORT_FUNCTION;
+
+       assert(width>0);
+       assert(height>0);
+
+       if ( VM::isInitialized() )
+       {
+
+               if ( _stage && _started )
+               {
+                       _stage->set_display_viewport(0, 0, width, height);
+               }
+
+       }
+
        _width = width;
        _height = height;
        _validbounds.setTo(0, 0, _width-1, _height-1);
-       //log_debug(_("new size (in twips) is: %dx%d"), _width*20, _height*20); 
 
-       if ( _stage ) display(_stage);
+       updateStageMatrix();
 }
 
 void

Index: gui/gui.h
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.h,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- gui/gui.h   23 Apr 2008 14:29:37 -0000      1.89
+++ gui/gui.h   23 Apr 2008 14:55:28 -0000      1.90
@@ -219,6 +219,14 @@
     /// @param height The desired height in pixels.
     void resize_view(int width, int height);
 
+    /// Update stage matrix accordingly to window size and flash Stage
+    /// configuration (scaleMode, alignment)
+    //
+    /// This method should be called from the core lib when Stage configuration
+    /// change or is called by resize_view.
+    ///
+    void updateStageMatrix();
+
     /// \brief
     /// Advances the movie to the next frame. This is to take place after the
     /// interval specified in the call to setInterval().




reply via email to

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