[Scummvm-cvs-logs] scummvm master -> b25ed0a02f22aa1bcee826c6843870b299b0c1ed

digitall dgturner at iee.org
Sun Oct 21 00:22:29 CEST 2012


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b25ed0a02f COMPOSER: Change screen surface variable naming for clarity.


Commit: b25ed0a02f22aa1bcee826c6843870b299b0c1ed
    https://github.com/scummvm/scummvm/commit/b25ed0a02f22aa1bcee826c6843870b299b0c1ed
Author: D G Turner (digitall at scummvm.org)
Date: 2012-10-20T15:19:47-07:00

Commit Message:
COMPOSER: Change screen surface variable naming for clarity.

This makes it easier to read the code where sprite surfaces are blitted
to the screen.

Changed paths:
    engines/composer/composer.cpp
    engines/composer/composer.h
    engines/composer/graphics.cpp



diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp
index f2fef3c..5db778d 100644
--- a/engines/composer/composer.cpp
+++ b/engines/composer/composer.cpp
@@ -102,7 +102,7 @@ Common::Error ComposerEngine::run() {
 	if (_bookIni.hasKey("Height", "Common"))
 		height = atoi(getStringFromConfig("Common", "Height").c_str());
 	initGraphics(width, height, true);
-	_surface.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
+	_screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 	_needsUpdate = true;
 
 	Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
@@ -214,7 +214,7 @@ Common::Error ComposerEngine::run() {
 		_system->delayMillis(20);
 	}
 
-	_surface.free();
+	_screen.free();
 
 	return Common::kNoError;
 }
diff --git a/engines/composer/composer.h b/engines/composer/composer.h
index 0f53258..33a5356 100644
--- a/engines/composer/composer.h
+++ b/engines/composer/composer.h
@@ -170,7 +170,7 @@ private:
 
 	bool _needsUpdate;
 	Common::Array<Common::Rect> _dirtyRects;
-	Graphics::Surface _surface;
+	Graphics::Surface _screen;
 	Common::List<Sprite> _sprites;
 
 	uint _directoriesToStrip;
diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp
index 1314e90..2b68fac 100644
--- a/engines/composer/graphics.cpp
+++ b/engines/composer/graphics.cpp
@@ -507,7 +507,7 @@ const Sprite *ComposerEngine::getSpriteAtPos(const Common::Point &pos) {
 
 void ComposerEngine::dirtySprite(const Sprite &sprite) {
 	Common::Rect rect(sprite._pos.x, sprite._pos.y, sprite._pos.x + sprite._surface.w, sprite._pos.y + sprite._surface.h);
-	rect.clip(_surface.w, _surface.h);
+	rect.clip(_screen.w, _screen.h);
 	if (rect.isEmpty())
 		return;
 
@@ -541,8 +541,8 @@ void ComposerEngine::redraw() {
 
 	for (uint i = 0; i < _dirtyRects.size(); i++) {
 		const Common::Rect &rect = _dirtyRects[i];
-		byte *pixels = (byte *)_surface.pixels + (rect.top * _surface.pitch) + rect.left;
-		_system->copyRectToScreen(pixels, _surface.pitch, rect.left, rect.top, rect.width(), rect.height());
+		byte *pixels = (byte *)_screen.pixels + (rect.top * _screen.pitch) + rect.left;
+		_system->copyRectToScreen(pixels, _screen.pitch, rect.left, rect.top, rect.width(), rect.height());
 	}
 	_system->updateScreen();
 
@@ -814,16 +814,16 @@ void ComposerEngine::drawSprite(const Sprite &sprite) {
 	int y = sprite._pos.y;
 
 	// incoming data is BMP-style (bottom-up), so flip it
-	byte *pixels = (byte *)_surface.pixels;
+	byte *pixels = (byte *)_screen.pixels;
 	for (int j = 0; j < sprite._surface.h; j++) {
 		if (j + y < 0)
 			continue;
-		if (j + y >= _surface.h)
+		if (j + y >= _screen.h)
 			break;
 		byte *in = (byte *)sprite._surface.pixels + (sprite._surface.h - j - 1) * sprite._surface.w;
-		byte *out = pixels + ((j + y) * _surface.w) + x;
+		byte *out = pixels + ((j + y) * _screen.w) + x;
 		for (int i = 0; i < sprite._surface.w; i++)
-			if ((x + i >= 0) && (x + i < _surface.w) && in[i])
+			if ((x + i >= 0) && (x + i < _screen.w) && in[i])
 				out[i] = in[i];
 	}
 }






More information about the Scummvm-git-logs mailing list