gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/movie_root.h server/asob...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/movie_root.h server/asob...
Date: Tue, 01 May 2007 18:02:52 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/05/01 18:02:52

Modified files:
        .              : ChangeLog 
        server         : movie_root.h 
        server/asobj   : Stage.cpp Stage.h 
        testsuite/actionscript.all: Stage.as 

Log message:
        Stage sizes implemented, please anyone see if this changes anything 
with YouTube...
        
                * server/movie_root.h: add getWidth() and getHeight()
                * server/asobj/Stage.{cpp,h}: implement Stage.width and
                  Stage.height.
                * testsuite/actionscript.all/Stage.as: small test for
                  Stage.width and Stage.height (not automated)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3052&r2=1.3053
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.h?cvsroot=gnash&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Stage.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Stage.as?cvsroot=gnash&r1=1.9&r2=1.10

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3052
retrieving revision 1.3053
diff -u -b -r1.3052 -r1.3053
--- ChangeLog   30 Apr 2007 21:11:10 -0000      1.3052
+++ ChangeLog   1 May 2007 18:02:51 -0000       1.3053
@@ -1,3 +1,11 @@
+2007-05-01 Sandro Santilli <address@hidden>
+
+       * server/movie_root.h: add getWidth() and getHeight()
+       * server/asobj/Stage.{cpp,h}: implement Stage.width and
+         Stage.height.
+       * testsuite/actionscript.all/Stage.as: small test for
+         Stage.width and Stage.height (not automated)
+
 2007-04-30 Sandro Santilli <address@hidden>
 
        * testsuite/swfdec/swfdec_gnash_tester: allow 11 loop-backs.

Index: server/movie_root.h
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- server/movie_root.h 26 Apr 2007 12:31:44 -0000      1.51
+++ server/movie_root.h 1 May 2007 18:02:51 -0000       1.52
@@ -14,7 +14,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.51 2007/04/26 12:31:44 strk Exp $ */
+/* $Id: movie_root.h,v 1.52 2007/05/01 18:02:51 strk Exp $ */
 
 /// \page events_handling Handling of user events
 ///
@@ -155,6 +155,18 @@
        ///
        void set_display_viewport(int x0, int y0, int w, int h);
 
+       /// Get current viewport width, in pixels
+       unsigned getWidth() const
+       {
+               return m_viewport_width;
+       }
+
+       /// Get current viewport height, in pixels
+       unsigned getHeight() const
+       {
+               return m_viewport_height;
+       }
+
        /// Set whether rescaling is allowed or not.
        //
        /// When rescaling is not allowed the Stage listeners
@@ -439,6 +451,8 @@
 
        // TODO: use Range2d<int> ?
        int                     m_viewport_x0, m_viewport_y0;
+
+       /// Width and height of viewport, in pixels
        int                     m_viewport_width, m_viewport_height;
 
        float                   m_pixel_scale;

Index: server/asobj/Stage.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/asobj/Stage.cpp      18 Apr 2007 14:07:32 -0000      1.12
+++ server/asobj/Stage.cpp      1 May 2007 18:02:52 -0000       1.13
@@ -36,6 +36,8 @@
 as_value stage_addlistener(const fn_call& fn);
 as_value stage_removelistener(const fn_call& fn);
 as_value stage_scalemode_getset(const fn_call& fn);
+as_value stage_width_getset(const fn_call& fn);
+as_value stage_height_getset(const fn_call& fn);
 
 static void
 attachStageInterface(as_object& o)
@@ -47,6 +49,12 @@
 
        boost::intrusive_ptr<builtin_function> getset(new 
builtin_function(stage_scalemode_getset));
        o.init_property("scaleMode", *getset, *getset);
+
+       getset = new builtin_function(stage_width_getset);
+       o.init_property("width", *getset, *getset);
+
+       getset = new builtin_function(stage_height_getset);
+       o.init_property("height", *getset, *getset);
 }
 
 Stage::Stage()
@@ -96,6 +104,22 @@
        func->call(fn_call(obj.get(), env, 0, 0));
 }
 
+unsigned
+Stage::getWidth() const
+{
+       log_warning("Stage::getWidth() testing");
+       return VM::get().getRoot().getWidth();
+       //return 0;
+}
+
+unsigned
+Stage::getHeight() const
+{
+       log_warning("Stage::getHeight() testing");
+       return VM::get().getRoot().getHeight();
+       //return 0;
+}
+
 void
 Stage::addListener(boost::intrusive_ptr<as_object> obj)
 {
@@ -229,6 +253,42 @@
        }
 }
 
+as_value
+stage_width_getset(const fn_call& fn)
+{
+       boost::intrusive_ptr<Stage> stage = ensureType<Stage>(fn.this_ptr);
+
+       if ( fn.nargs == 0 ) // getter
+       {
+               return as_value(stage->getWidth());
+       }
+       else // setter
+       {
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("Stage.width is a read-only property!"));
+               );
+               return as_value();
+       }
+}
+
+as_value
+stage_height_getset(const fn_call& fn)
+{
+       boost::intrusive_ptr<Stage> stage = ensureType<Stage>(fn.this_ptr);
+
+       if ( fn.nargs == 0 ) // getter
+       {
+               return as_value(stage->getHeight());
+       }
+       else // setter
+       {
+               IF_VERBOSE_ASCODING_ERRORS(
+               log_aserror(_("Stage.height is a read-only property!"));
+               );
+               return as_value();
+       }
+}
+
 // extern (used by Global.cpp)
 void stage_class_init(as_object& global)
 {

Index: server/asobj/Stage.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Stage.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/asobj/Stage.h        26 Apr 2007 07:00:29 -0000      1.7
+++ server/asobj/Stage.h        1 May 2007 18:02:52 -0000       1.8
@@ -65,6 +65,12 @@
        ///
        void onResize(as_environment* env);
 
+       /// Get current stage width, in pixels
+       unsigned getWidth() const;
+
+       /// Get current stage height, in pixels
+       unsigned getHeight() const;
+
        /// Set scale mode 
        void setScaleMode(ScaleMode mode);
 

Index: testsuite/actionscript.all/Stage.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Stage.as,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- testsuite/actionscript.all/Stage.as 29 Mar 2007 12:37:31 -0000      1.9
+++ testsuite/actionscript.all/Stage.as 1 May 2007 18:02:52 -0000       1.10
@@ -20,7 +20,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: Stage.as,v 1.9 2007/03/29 12:37:31 strk Exp $";
+rcsid="$Id: Stage.as,v 1.10 2007/05/01 18:02:52 strk Exp $";
 
 #include "check.as"
 
@@ -40,7 +40,9 @@
 
 listener = new Object;
 listener.onResize = function() {
-       _root.note("Resize event received, args to handler: "+arguments.length);
+       _root.note("Resize event received, args to handler: 
"+arguments.length+" Stage.width="+Stage.width+", Stage.height="+Stage.height);
+       Stage.height = 1;
+       check(Stage.height != 1);
        // If we delete the Stage object, events won't arrive anymore, but
        // the precedent setting of 'scaleMode' will persist !!
        //delete Stage;




reply via email to

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