diff options
| author | Matthew Hoops | 2011-09-26 00:17:21 -0400 | 
|---|---|---|
| committer | Matthew Hoops | 2011-09-26 00:17:21 -0400 | 
| commit | 85e7d2d9a99a0b7663881c6b5e1ce066d2efc49c (patch) | |
| tree | 737072a99a413e8b8cfc978c9313639e1796bc46 /engines/pegasus/graphics.cpp | |
| parent | 515b2501a7eaf875172fcdde910b061da843c96d (diff) | |
| download | scummvm-rg350-85e7d2d9a99a0b7663881c6b5e1ce066d2efc49c.tar.gz scummvm-rg350-85e7d2d9a99a0b7663881c6b5e1ce066d2efc49c.tar.bz2 scummvm-rg350-85e7d2d9a99a0b7663881c6b5e1ce066d2efc49c.zip | |
PEGASUS: Update the GraphicsManager a bit
- Only update the screen if we drew something to it, not if a dirty rect was present.
- Add ability to clear the screen.
Diffstat (limited to 'engines/pegasus/graphics.cpp')
| -rw-r--r-- | engines/pegasus/graphics.cpp | 22 | 
1 files changed, 16 insertions, 6 deletions
| diff --git a/engines/pegasus/graphics.cpp b/engines/pegasus/graphics.cpp index e37150e75a..05217fabcd 100644 --- a/engines/pegasus/graphics.cpp +++ b/engines/pegasus/graphics.cpp @@ -44,6 +44,7 @@ GraphicsManager::GraphicsManager(PegasusEngine *vm) : _vm(vm) {  	_firstDisplayElement = _lastDisplayElement = 0;  	_workArea.create(640, 480, _vm->_system->getScreenFormat());  	_lastMousePosition = Common::Point(-1, -1); +	_modifiedScreen = false;  }  GraphicsManager::~GraphicsManager() { @@ -162,22 +163,31 @@ void GraphicsManager::updateDisplay() {  			// TODO: Better logic; it does a bit more work than it probably needs to  			// but it should work fine for now. -			if (bounds.intersects(_dirtyRect) && runner->validToDraw(_backLayer, _frontLayer)) +			if (bounds.intersects(_dirtyRect) && runner->validToDraw(_backLayer, _frontLayer)) {  				runner->draw(bounds); +				screenDirty = true; +			}  		}  		// Copy only the dirty rect to the screen -		g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height()); - -		// Mark the screen as dirty -		screenDirty = true; +		if (screenDirty) +			g_system->copyRectToScreen((byte *)_workArea.getBasePtr(_dirtyRect.left, _dirtyRect.top), _workArea.pitch, _dirtyRect.left, _dirtyRect.top, _dirtyRect.width(), _dirtyRect.height());  		// Clear the dirty rect  		_dirtyRect = Common::Rect();  	} -	if (screenDirty) +	if (screenDirty || _modifiedScreen)  		g_system->updateScreen(); + +	_modifiedScreen = false; +} + +void GraphicsManager::clearScreen() { +	Graphics::Surface *screen = g_system->lockScreen(); +	screen->fillRect(Common::Rect(0, 0, 640, 480), g_system->getScreenFormat().RGBToColor(0, 0, 0)); +	g_system->unlockScreen(); +	_modifiedScreen = true;  }  } // End of namespace Pegasus | 
