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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/gui.cpp
Date: Wed, 23 Apr 2008 16:10:19 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/04/23 16:10:19

Modified files:
        .              : ChangeLog 
        gui            : gui.cpp 

Log message:
        add support for all vertical and horizontal alignments.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6361&r2=1.6362
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/gui.cpp?cvsroot=gnash&r1=1.156&r2=1.157

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6361
retrieving revision 1.6362
diff -u -b -r1.6361 -r1.6362
--- ChangeLog   23 Apr 2008 15:31:20 -0000      1.6361
+++ ChangeLog   23 Apr 2008 16:10:18 -0000      1.6362
@@ -1,3 +1,8 @@
+2008-04-23 Sandro Santilli <address@hidden>
+
+       * gui/gui.cpp (updateStageMatrix): add support for all vertical
+         and horizontal alignments.
+
 2008-04-23 Benjamin Wolsey <address@hidden>
 
        * server/movie_root.cpp: notify Player of Stage.align event.

Index: gui/gui.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/gui.cpp,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -b -r1.156 -r1.157
--- gui/gui.cpp 23 Apr 2008 15:05:38 -0000      1.156
+++ gui/gui.cpp 23 Apr 2008 16:10:19 -0000      1.157
@@ -234,6 +234,7 @@
        float swfwidth = _movieDef->get_width_pixels();
        float swfheight = _movieDef->get_height_pixels();
 
+       // TODO: query scaleMode [ noScale,showAll,exactFit,noBorders ]
        if ( _stage && _stage->isRescalingAllowed() )
        {
 
@@ -253,24 +254,73 @@
        _xoffset=0;
        _yoffset=0;
 
-       // TODO: check Stage.getAlignMode
-       {
                // Align to center
+       // TODO: use _stage.getAlignMode
+       movie_root::StageHorizontalAlign halign = movie_root::STAGE_H_ALIGN_C;
+       movie_root::StageVerticalAlign valign = movie_root::STAGE_V_ALIGN_C;
 
+       // Handle horizontal alignment
+       switch ( halign )
+       {
+               case movie_root::STAGE_H_ALIGN_L:
+                       // _xoffset=0 is fine
+                       break;
+
+               case movie_root::STAGE_H_ALIGN_R:
+               {
+                       // Offsets in pixels
+                       float defWidth = swfwidth *= _xscale;
+                       if ( _width > defWidth )
+                       {
+                               float diffWidth = _width-defWidth;
+                               _xoffset = diffWidth;
+                       }
+                       break;
+               }
+
+               case movie_root::STAGE_V_ALIGN_C:
+               default:
+               {
                // Offsets in pixels
                float defWidth = swfwidth *= _xscale;
-               float defHeight = swfheight *= _yscale;
                if ( _width > defWidth )
                {
                        float diffWidth = _width-defWidth;
                        _xoffset = diffWidth/2.0;
                }
+                       break;
+               }
+       }
+
+       // Handle vertical alignment
+       switch ( valign )
+       {
+               case movie_root::STAGE_V_ALIGN_T:
+                       // _yoffset=0 is fine
+                       break;
+
+               case movie_root::STAGE_V_ALIGN_B:
+               {
+                       float defHeight = swfheight *= _yscale;
+                       if ( _height > defHeight )
+                       {
+                               float diffHeight = _height-defHeight;
+                               _yoffset = diffHeight;
+                       }
+                       break;
+               }
+
+               case movie_root::STAGE_V_ALIGN_C:
+               default:
+               {
+                       float defHeight = swfheight *= _yscale;
                if ( _height > defHeight )
                {
                        float diffHeight = _height-defHeight;
                        _yoffset = diffHeight/2.0;
                }
        }
+       }
 
        // TODO: have a generic set_matrix ?
        _renderer->set_scale(_xscale, _yscale);




reply via email to

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