=== modified file 'gui/Player.cpp'
--- gui/Player.cpp	2008-12-04 10:21:27 +0000
+++ gui/Player.cpp	2009-02-14 22:22:15 +0000
@@ -97,7 +97,8 @@
     _fpsDebugTime(0.0),
 #endif
     _hostfd(-1),
-    _startFullscreen(false)
+    _startFullscreen(false),
+    _scaleExactFit(false)
 {
     init();
 }
@@ -460,6 +461,11 @@
     if (!_windowID && _startFullscreen) {
         _gui->setFullscreen();
     }
+    
+    if (!_windowID && _scaleExactFit) {
+        _gui->setScaleExactFit();
+    }
+    
     _gui->run();
 
     log_debug("Main loop ended, cleaning up");

=== modified file 'gui/Player.h'
--- gui/Player.h	2008-11-04 01:14:26 +0000
+++ gui/Player.h	2009-02-14 22:22:16 +0000
@@ -137,6 +137,10 @@
 	void setStartFullscreen(bool x) {
 	    _startFullscreen = x;
 	}
+	
+	void setScaleExactFit(bool x) {
+	    _scaleExactFit = x;
+	}
 
     void setAudioDumpfile(const std::string& filespec) {
         _audioDump = filespec;
@@ -288,6 +292,8 @@
 	// (Or what did you think it meant?)
 	bool _startFullscreen;
 
+    bool _scaleExactFit;
+    
     // The filename to use for dumping audio.
     std::string _audioDump;
 

=== modified file 'gui/gnash.cpp'
--- gui/gnash.cpp	2008-12-28 09:40:28 +0000
+++ gui/gnash.cpp	2009-02-14 22:22:00 +0000
@@ -91,6 +91,7 @@
     << _("  -h,  --help              Print this help and exit") << endl
     << _("  -V,  --version           Print version information and exit") << endl
     << _("  -s,  --scale <factor>    Scale the movie by the specified factor") << endl
+    << _("  -S,  --exactfit          Force the SWF to scale to the window size") << endl
     << _("  -c                       Produce a core file instead of letting SDL trap it") << endl
     << _("  -d,  --delay num         Number of milliseconds to delay in main loop") << endl
     << _("  -v,  --verbose           Produce verbose output") << endl
@@ -193,6 +194,7 @@
         { 'a', 0,               Arg_parser::no  },
         { 'p', 0,               Arg_parser::no  },
         { 's', "scale",         Arg_parser::yes },
+        { 'S', "exactfit",      Arg_parser::no },
         { 256, "max-advances",  Arg_parser::yes },
         { 257, "fullscreen",    Arg_parser::no  },        
         { 'c', 0,               Arg_parser::no  },
@@ -279,6 +281,9 @@
                                     parser.argument<float>(i),
                                     0.01f, 100.f));
                     break;
+                case 'S':
+                    player.setScaleExactFit(true);
+                    break;
                 case 'd':
                     player.setDelay( parser.argument<long>(i) );
                     break;

=== modified file 'gui/gui.cpp'
--- gui/gui.cpp	2009-01-22 20:10:39 +0000
+++ gui/gui.cpp	2009-02-14 23:10:12 +0000
@@ -82,6 +82,7 @@
     _renderer(NULL),
     _redraw_flag(true),
     _fullscreen(false),
+    _scaleExactFit(false),
     _mouseShown(true),
     _maxAdvances(0),
     _advances(0),
@@ -124,6 +125,7 @@
     _renderer(NULL),
     _redraw_flag(true),
     _fullscreen(false),
+    _scaleExactFit(false),
     _mouseShown(true),
     _maxAdvances(0),
     _advances(0),
@@ -178,6 +180,12 @@
     log_unimpl(_("Fullscreen not yet supported in this GUI"));
 }
 
+void 
+Gui::setScaleExactFit()
+{
+    _scaleExactFit = true;
+}
+
 bool
 Gui::showMouse(bool /* show */)
 {
@@ -244,36 +252,57 @@
 	switch (scaleMode)
 	{
 		case movie_root::noScale:
-			_xscale = _yscale = 1.0f;
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+		    }
+		    else
+		    {
+			    _xscale = _yscale = 1.0f;
+		    }
 			break;
 
 		case movie_root::showAll:
 		{
-		
-			// set new scale value ( user-pixel / pseudo-pixel ). Do
-			// not divide by zero, or we end up with an invalid
-			// stage matrix that returns nan values.			
-			_xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
-			_yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+		    }
+		    else
+		    {
+			    // set new scale value ( user-pixel / pseudo-pixel ). Do
+			    // not divide by zero, or we end up with an invalid
+			    // stage matrix that returns nan values.			
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
 			
-			// Scale proportionally, using smallest scale
-			if (_xscale < _yscale) _yscale = _xscale;
-			else if (_yscale < _xscale) _xscale = _yscale;
+			    // Scale proportionally, using smallest scale
+			    if (_xscale < _yscale) _yscale = _xscale;
+			    else if (_yscale < _xscale) _xscale = _yscale;
+		    }
 
 			break;
 		}
 
 		case movie_root::noBorder:
 		{
-
-			// set new scale value ( user-pixel / pseudo-pixel )
-			_xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
-			_yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+		    }
+		    else
+		    {
+			    // set new scale value ( user-pixel / pseudo-pixel )
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
 			
-			// Scale proportionally, using biggest scale
-			if (_xscale > _yscale) _yscale = _xscale;
-			else if (_yscale > _xscale) _xscale = _yscale;
-
+			    // Scale proportionally, using biggest scale
+			    if (_xscale > _yscale) _yscale = _xscale;
+			    else if (_yscale > _xscale) _xscale = _yscale;
+            }
 			break;
 		}
 
@@ -288,7 +317,16 @@
 
 		default:
 		{
-			log_error("Invalid scaleMode %d", scaleMode);
+            if (_scaleExactFit)
+            {
+			    _xscale = (swfwidth == 0.0f) ? 1.0f : _width / swfwidth;
+			    _yscale = (swfheight == 0.0f) ? 1.0f : _height / swfheight;
+			    log_error("Invalid scaleMode - forcing to exactfit");
+		    }
+		    else
+		    {
+			    log_error("Invalid scaleMode %d", scaleMode);
+		    }
 			break;
 		}
 	}

=== modified file 'gui/gui.h'
--- gui/gui.h	2009-01-22 20:10:39 +0000
+++ gui/gui.h	2009-02-14 22:22:02 +0000
@@ -254,6 +254,8 @@
     ///
     virtual void unsetFullscreen();
     
+    void setScaleExactFit();
+    
     /// Sets whether the gui should show the system mouse pointer
     //
     /// @param show true if the mouse should be shown.
@@ -426,6 +428,9 @@
 
     // True if Gnash is running in fullscreen
     bool _fullscreen;
+    
+    // Forces Gnash to scale video
+    bool _scaleExactFit;
 
     // True if mouse pointer is showing
     bool _mouseShown;

