[Scummvm-cvs-logs] SF.net SVN: scummvm:[35995] scummvm/trunk

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Thu Jan 22 05:59:09 CET 2009


Revision: 35995
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35995&view=rev
Author:   fingolfin
Date:     2009-01-22 04:59:09 +0000 (Thu, 22 Jan 2009)

Log Message:
-----------
Got rid of several occurrences of gBitFormat

Modified Paths:
--------------
    scummvm/trunk/backends/platform/dc/display.cpp
    scummvm/trunk/backends/platform/ps2/systemps2.cpp
    scummvm/trunk/graphics/VectorRendererSpec.cpp
    scummvm/trunk/graphics/scaler.cpp
    scummvm/trunk/graphics/video/mpeg_player.cpp
    scummvm/trunk/graphics/video/mpeg_player.h

Modified: scummvm/trunk/backends/platform/dc/display.cpp
===================================================================
--- scummvm/trunk/backends/platform/dc/display.cpp	2009-01-22 04:45:19 UTC (rev 35994)
+++ scummvm/trunk/backends/platform/dc/display.cpp	2009-01-22 04:59:09 UTC (rev 35995)
@@ -197,8 +197,6 @@
 {
   assert(w <= SCREEN_W && h <= SCREEN_H);
 
-  gBitFormat = 4444;
-
   _overlay_visible = false;
   _overlay_fade = 0.0;
   _screen_w = w;

Modified: scummvm/trunk/backends/platform/ps2/systemps2.cpp
===================================================================
--- scummvm/trunk/backends/platform/ps2/systemps2.cpp	2009-01-22 04:45:19 UTC (rev 35994)
+++ scummvm/trunk/backends/platform/ps2/systemps2.cpp	2009-01-22 04:59:09 UTC (rev 35995)
@@ -76,8 +76,6 @@
 
 OSystem_PS2 *g_systemPs2;
 
-int gBitFormat = 555;
-
 #define FOREVER 2147483647
 
 namespace Graphics {

Modified: scummvm/trunk/graphics/VectorRendererSpec.cpp
===================================================================
--- scummvm/trunk/graphics/VectorRendererSpec.cpp	2009-01-22 04:45:19 UTC (rev 35994)
+++ scummvm/trunk/graphics/VectorRendererSpec.cpp	2009-01-22 04:59:09 UTC (rev 35995)
@@ -151,8 +151,6 @@
 }
 
 
-extern int gBitFormat;
-
 namespace Graphics {
 
 VectorRenderer *createRenderer(int mode) {
@@ -172,21 +170,27 @@
 		return 0; \
 	}
 
+
 	// FIXME/TODO: This looks like a real gross hack.
 	// It might be fine to assume that '1555' only happens for PSP
 	// so it could maybe be handled via DISABLE_FANCY_THEMES,
 	// same goes for 4444, which is only used by DC port.
-	if (gBitFormat == 1555) {
+	PixelFormat format = g_system->getOverlayFormat();
+	if (format == createPixelFormat<1555>()) {
 		CREATE_RENDERER_16(1555)
-	} else if (gBitFormat == 4444) {
+	}
+	if (format == createPixelFormat<4444>()) {
 		CREATE_RENDERER_16(4444)
-	} else if (gBitFormat == 555) {
+	}
+	if (format == createPixelFormat<555>()) {
 		CREATE_RENDERER_16(555)
-	} else if (gBitFormat == 565) {
+	}
+	if (format == createPixelFormat<565>()) {
 		CREATE_RENDERER_16(565)
-	} else {
-		return 0;
 	}
+
+	return 0;
+
 #undef CREATE_RENDERER_16
 #endif
 }

Modified: scummvm/trunk/graphics/scaler.cpp
===================================================================
--- scummvm/trunk/graphics/scaler.cpp	2009-01-22 04:45:19 UTC (rev 35994)
+++ scummvm/trunk/graphics/scaler.cpp	2009-01-22 04:59:09 UTC (rev 35995)
@@ -29,6 +29,20 @@
 
 int gBitFormat = 565;
 
+static const Graphics::PixelFormat gPixelFormat555 = {
+	2,
+	3, 3, 3, 8,
+	10, 5, 0, 0
+	};
+
+static const Graphics::PixelFormat gPixelFormat565 = {
+	2,
+	3, 2, 3, 8,
+	11, 5, 0, 0
+	};
+
+
+
 #ifndef DISABLE_HQ_SCALERS
 // RGB-to-YUV lookup table
 extern "C" {

Modified: scummvm/trunk/graphics/video/mpeg_player.cpp
===================================================================
--- scummvm/trunk/graphics/video/mpeg_player.cpp	2009-01-22 04:45:19 UTC (rev 35994)
+++ scummvm/trunk/graphics/video/mpeg_player.cpp	2009-01-22 04:59:09 UTC (rev 35995)
@@ -45,7 +45,7 @@
 
 	_colorTab = NULL;
 	_rgbToPix = NULL;
-	_bitFormat = 0;
+	memset(&_overlayFormat, 0, sizeof(_overlayFormat));
 #endif
 }
 
@@ -353,7 +353,8 @@
 
 void BaseAnimationState::buildLookup() {
 	// Do we already have lookup tables for this bit format?
-	if (gBitFormat == _bitFormat && _colorTab && _rgbToPix)
+	Graphics::PixelFormat format = _sys->getOverlayFormat();
+	if (format == _overlayFormat && _colorTab && _rgbToPix)
 		return;
 
 	free(_colorTab);
@@ -389,7 +390,6 @@
 	}
 
 	// Set up entries 0-255 in rgb-to-pixel value tables.
-	Graphics::PixelFormat format = _sys->getOverlayFormat();
 	for (i = 0; i < 256; i++) {
 		r_2_pix_alloc[i + 256] = format.RGBToColor(i, 0, 0);
 		g_2_pix_alloc[i + 256] = format.RGBToColor(0, i, 0);
@@ -407,7 +407,7 @@
 		b_2_pix_alloc[i + 512] = b_2_pix_alloc[511];
 	}
 
-	_bitFormat = gBitFormat;
+	_overlayFormat = format;
 }
 
 void BaseAnimationState::plotYUV(int width, int height, byte *const *dat) {

Modified: scummvm/trunk/graphics/video/mpeg_player.h
===================================================================
--- scummvm/trunk/graphics/video/mpeg_player.h	2009-01-22 04:45:19 UTC (rev 35994)
+++ scummvm/trunk/graphics/video/mpeg_player.h	2009-01-22 04:59:09 UTC (rev 35995)
@@ -27,6 +27,7 @@
 #define GRAPHICS_VIDEO_MPEG_PLAYER_H
 
 #include "common/scummsys.h"
+#include "graphics/pixelformat.h"
 
 // Uncomment this if you are using libmpeg2 0.3.1.
 // #define USE_MPEG2_0_3_1
@@ -122,7 +123,7 @@
 	} _palettes[50];
 #else
 	OverlayColor *_overlay;
-	int _bitFormat;
+	Graphics::PixelFormat _overlayFormat;
 	int16 *_colorTab;
 	OverlayColor *_rgbToPix;
 #endif


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list