[Scummvm-cvs-logs] scummvm master -> 2937727018eef69c30a758a31b6fe3a6158ee35e

Strangerke Strangerke at scummvm.org
Sun Feb 9 20:42:34 CET 2014


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:
2937727018 CINE: Reduce the scope of some variables, optimize a couple of iterator increment


Commit: 2937727018eef69c30a758a31b6fe3a6158ee35e
    https://github.com/scummvm/scummvm/commit/2937727018eef69c30a758a31b6fe3a6158ee35e
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-02-09T11:41:08-08:00

Commit Message:
CINE: Reduce the scope of some variables, optimize a couple of iterator increment

Changed paths:
    engines/cine/gfx.cpp
    engines/cine/main_loop.cpp



diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 636c0cf..18a569b 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -246,17 +246,16 @@ void FWRenderer::incrustSprite(const BGIncrust &incrust) {
  * Draw command box on screen
  */
 void FWRenderer::drawCommand() {
-	unsigned int i;
-	int x = 10, y = _cmdY;
-
 	if (disableSystemMenu == 0) {
+		int x = 10, y = _cmdY;
+
 		drawPlainBox(x, y, 301, 11, 0);
 		drawBorder(x - 1, y - 1, 302, 12, 2);
 
 		x += 2;
 		y += 2;
 
-		for (i = 0; i < _cmd.size(); i++) {
+		for (unsigned int i = 0; i < _cmd.size(); i++) {
 			x = drawChar(_cmd[i], x, y);
 		}
 	}
@@ -458,12 +457,12 @@ void FWRenderer::drawDoubleBorder(int x, int y, int width, int height, byte colo
  * @param y Character coordinate
  */
 int FWRenderer::drawChar(char character, int x, int y) {
-	int width, idx;
+	int width;
 
 	if (character == ' ') {
 		x += 5;
 	} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
-		idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+		int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
 		drawSpriteRaw(g_cine->_textHandler.textTable[idx][FONT_DATA], g_cine->_textHandler.textTable[idx][FONT_MASK], FONT_WIDTH, FONT_HEIGHT, _backBuffer, x, y);
 		x += width + 1;
 	}
@@ -481,12 +480,12 @@ int FWRenderer::drawChar(char character, int x, int y) {
  * @param y Character coordinate
  */
 int FWRenderer::undrawChar(char character, int x, int y) {
-	int width, idx;
+	int width;
 
 	if (character == ' ') {
 		x += 5;
 	} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
-		idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+		int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
 		const byte *sprite = g_cine->_textHandler.textTable[idx][FONT_DATA];
 		for (uint i = 0; i < FONT_HEIGHT; ++i) {
 			byte *dst = _backBuffer + (y + i) * 320 + x;
@@ -997,11 +996,10 @@ void SelectionMenu::drawMenu(FWRenderer &r, bool top) {
 	}
 
 	int lineY = y + 4;
-	int charX;
 
 	const int elemCount = getElementCount();
 	for (int i = 0; i < elemCount; ++i, lineY += 9) {
-		charX = x + 4;
+		int charX = x + 4;
 
 		if (i == _selection) {
 			int color;
@@ -1228,12 +1226,12 @@ void OSRenderer::incrustSprite(const BGIncrust &incrust) {
  * @param y Character coordinate
  */
 int OSRenderer::drawChar(char character, int x, int y) {
-	int width, idx;
+	int width;
 
 	if (character == ' ') {
 		x += 5;
 	} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
-		idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+		int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
 		drawSpriteRaw2(g_cine->_textHandler.textTable[idx][FONT_DATA], 0, FONT_WIDTH, FONT_HEIGHT, _backBuffer, x, y);
 		x += width + 1;
 	}
@@ -1834,7 +1832,7 @@ void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 wi
 				}
 			}
 		}
-		it++;
+		++it;
 	}
 
 	// now, draw with the mask we created
@@ -1887,7 +1885,6 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
 				   byte *page, int16 x, int16 y) {
 	int16 i, j, tmpWidth, tmpHeight;
 	Common::List<BGIncrust>::iterator it;
-	byte *mask;
 	const byte *backup = maskPtr;
 
 	// background pass
@@ -1915,7 +1912,7 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
 	for (it = g_cine->_bgIncrustList.begin(); it != g_cine->_bgIncrustList.end(); ++it) {
 		tmpWidth = g_cine->_animDataTable[it->frame]._realWidth;
 		tmpHeight = g_cine->_animDataTable[it->frame]._height;
-		mask = (byte *)malloc(tmpWidth * tmpHeight);
+		byte *mask = (byte *)malloc(tmpWidth * tmpHeight);
 
 		if (it->param == 0) {
 			generateMask(g_cine->_animDataTable[it->frame].data(), mask, tmpWidth * tmpHeight, it->part);
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index c822f1c..789e764 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -254,7 +254,7 @@ void purgeSeqList() {
 			it = g_cine->_seqList.erase(it);
 		} else {
 			// Let the element be and jump to the next element
-			it++;
+			++it;
 		}
 	}
 }






More information about the Scummvm-git-logs mailing list