[Scummvm-cvs-logs] scummvm master -> 389b613190f14c7462043b75e84217633141149b

fingolfin max at quendi.de
Mon May 9 14:44:46 CEST 2011


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

Summary:
b4058a696a COMMON: Tweak some comments
76cf7bc907 SCI: Slight cleanup to undithering code
389b613190 SCI: Fix warning about potential strict-aliasing rules violation


Commit: b4058a696ab507991b6b8c8cf6c0bdd9cb5c714f
    https://github.com/scummvm/scummvm/commit/b4058a696ab507991b6b8c8cf6c0bdd9cb5c714f
Author: Max Horn (max at quendi.de)
Date: 2011-05-09T05:32:03-07:00

Commit Message:
COMMON: Tweak some comments

Changed paths:
    common/endian.h



diff --git a/common/endian.h b/common/endian.h
index e6c39d3..afd7e29 100644
--- a/common/endian.h
+++ b/common/endian.h
@@ -149,8 +149,8 @@
  */
 #define MKTAG(a0,a1,a2,a3) ((uint32)((a3) | ((a2) << 8) | ((a1) << 16) | ((a0) << 24)))
 
-// Functions for reading/writing native Integers,
-// this transparently handles the need for alignment
+// Functions for reading/writing native integers,
+// this transparently handles the need for alignment.
 
 #if !defined(SCUMM_NEED_ALIGNMENT)
 
@@ -170,8 +170,10 @@
 		*(uint32 *)(ptr) = value;
 	}
 
-// test for GCC >= 4.0. these implementations will automatically use CPU-specific
-// instructions for unaligned data when they are available (eg. MIPS)
+// Test for GCC >= 4.0. These implementations will automatically use CPU-specific
+// instructions for unaligned data when they are available (eg. MIPS).
+// See also this email thread on scummvm-devel for details:
+// <http://thread.gmane.org/gmane.games.devel.scummvm/8063>
 #elif defined(__GNUC__) && (__GNUC__ >= 4)
 
 	FORCEINLINE uint16 READ_UINT16(const void *ptr) {


Commit: 76cf7bc907f7d8dafaddd01a42c843c6a06cd5f2
    https://github.com/scummvm/scummvm/commit/76cf7bc907f7d8dafaddd01a42c843c6a06cd5f2
Author: Max Horn (max at quendi.de)
Date: 2011-05-09T05:41:49-07:00

Commit Message:
SCI: Slight cleanup to undithering code

Changed paths:
    engines/sci/console.cpp
    engines/sci/graphics/picture.cpp
    engines/sci/graphics/screen.cpp
    engines/sci/graphics/screen.h
    engines/sci/sci.cpp



diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 60bd129..419f5e1 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -1532,7 +1532,7 @@ bool Console::cmdUndither(int argc, const char **argv) {
 	}
 
 	bool flag = atoi(argv[1]) ? true : false;
-	_engine->_gfxScreen->debugUnditherSetState(flag);
+	_engine->_gfxScreen->enableUndithering(flag);
 	if (flag)
 		DebugPrintf("undithering ENABLED\n");
 	else
diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 82aae53..7209084 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -512,7 +512,7 @@ void GfxPicture::drawVectorData(byte *data, int dataSize) {
 			// WORKAROUND: we remove certain visual&priority lines in underwater rooms of iceman, when not dithering the
 			//              picture. Normally those lines aren't shown, because they share the same color as the dithered
 			//              fill color combination. When not dithering, those lines would appear and get distracting.
-			if ((_screen->getUnditherState()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61)))
+			if ((_screen->isUnditheringEnabled()) && ((_resourceId >= 53 && _resourceId <= 58) || (_resourceId == 61)))
 				icemanDrawFix = true;
 		}
 		if (g_sci->getGameId() == GID_KQ5) {
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index f619780..aa4ee0b 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -111,7 +111,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
 
 	_picNotValid = 0;
 	_picNotValidSci11 = 0;
-	_unditherState = true;
+	_unditheringEnabled = true;
 	_fontIsUpscaled = false;
 
 	if (_resMan->getViewType() != kViewEga) {
@@ -560,7 +560,7 @@ void GfxScreen::dither(bool addToFlag) {
 	byte *visualPtr = _visualScreen;
 	byte *displayPtr = _displayScreen;
 
-	if (!_unditherState) {
+	if (!_unditheringEnabled) {
 		// Do dithering on visual and display-screen
 		for (y = 0; y < _height; y++) {
 			for (x = 0; x < _width; x++) {
@@ -624,12 +624,12 @@ void GfxScreen::ditherForceDitheredColor(byte color) {
 	_ditheredPicColors[color] = 256;
 }
 
-void GfxScreen::debugUnditherSetState(bool flag) {
-	_unditherState = flag;
+void GfxScreen::enableUndithering(bool flag) {
+	_unditheringEnabled = flag;
 }
 
 int16 *GfxScreen::unditherGetDitheredBgColors() {
-	if (_unditherState)
+	if (_unditheringEnabled)
 		return (int16 *)&_ditheredPicColors;
 	else
 		return NULL;
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 89ad52e..bfe0a50 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -95,9 +95,10 @@ public:
 		return _upscaledHires;
 	}
 
-	bool getUnditherState() const {
-		return _unditherState;
+	bool isUnditheringEnabled() const {
+		return _unditheringEnabled;
 	}
+	void enableUndithering(bool flag);
 
 	void putKanjiChar(Graphics::FontSJIS *commonFont, int16 x, int16 y, uint16 chr, byte color);
 	byte getVisual(int x, int y);
@@ -119,7 +120,6 @@ public:
 
 	// Force a color combination as a dithered color
 	void ditherForceDitheredColor(byte color);
-	void debugUnditherSetState(bool flag);
 	int16 *unditherGetDitheredBgColors();
 
 	void debugShowMap(int mapNo);
@@ -151,7 +151,10 @@ private:
 
 	void setVerticalShakePos(uint16 shakePos);
 
-	bool _unditherState;
+	/**
+	 * If this flag is true, undithering is enabled, otherwise disabled.
+	 */
+	bool _unditheringEnabled;
 	int16 _ditheredPicColors[DITHERED_BG_COLORS_SIZE];
 
 	// These screens have the real resolution of the game engine (320x200 for
@@ -161,13 +164,13 @@ private:
 	byte *_priorityScreen;
 	byte *_controlScreen;
 
-	// This screen is the one that is actually displayed to the user. It may be
-	// 640x400 for japanese SCI1 games. SCI0 games may be undithered in here.
-	// Only read from this buffer for Save/ShowBits usage.
+	/**
+	 * This screen is the one that is actually displayed to the user. It may be
+	 * 640x400 for japanese SCI1 games. SCI0 games may be undithered in here.
+	 * Only read from this buffer for Save/ShowBits usage.
+	 */
 	byte *_displayScreen;
 
-	Common::Rect getScaledRect(Common::Rect rect);
-
 	ResourceManager *_resMan;
 
 	/**
@@ -176,16 +179,22 @@ private:
 	 */
 	byte *_activeScreen;
 
-	// This variable defines, if upscaled hires is active and what upscaled mode
-	// is used.
+	/**
+	 * This variable defines, if upscaled hires is active and what upscaled mode
+	 * is used.
+	 */
 	GfxScreenUpscaledMode _upscaledHires;
 
-	// This here holds a translation for vertical coordinates between native
-	// (visual) and actual (display) screen.
+	/**
+	 * This here holds a translation for vertical coordinates between native
+	 * (visual) and actual (display) screen.
+	 */
 	int _upscaledMapping[SCI_SCREEN_UPSCALEDMAXHEIGHT + 1];
 
-	// This defines whether or not the font we're drawing is already scaled
-	// to the screen size (and we therefore should not upscale it ourselves).
+	/**
+	 * This defines whether or not the font we're drawing is already scaled
+	 * to the screen size (and we therefore should not upscale it ourselves).
+	 */
 	bool _fontIsUpscaled;
 
 	uint16 getLowResScreenHeight();
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 85c2ece..8a81ea7 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -218,7 +218,7 @@ Common::Error SciEngine::run() {
 
 	// Initialize the game screen
 	_gfxScreen = new GfxScreen(_resMan);
-	_gfxScreen->debugUnditherSetState(ConfMan.getBool("disable_dithering"));
+	_gfxScreen->enableUndithering(ConfMan.getBool("disable_dithering"));
 
 	// Create debugger console. It requires GFX to be initialized
 	_console = new Console(this);


Commit: 389b613190f14c7462043b75e84217633141149b
    https://github.com/scummvm/scummvm/commit/389b613190f14c7462043b75e84217633141149b
Author: Max Horn (max at quendi.de)
Date: 2011-05-09T05:42:45-07:00

Commit Message:
SCI: Fix warning about potential strict-aliasing rules violation

Changed paths:
    engines/sci/graphics/screen.cpp



diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index aa4ee0b..56e6759 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -630,7 +630,7 @@ void GfxScreen::enableUndithering(bool flag) {
 
 int16 *GfxScreen::unditherGetDitheredBgColors() {
 	if (_unditheringEnabled)
-		return (int16 *)&_ditheredPicColors;
+		return _ditheredPicColors;
 	else
 		return NULL;
 }






More information about the Scummvm-git-logs mailing list