diff options
-rw-r--r-- | backends/platform/dc/display.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ps2/systemps2.cpp | 2 | ||||
-rw-r--r-- | graphics/VectorRendererSpec.cpp | 20 | ||||
-rw-r--r-- | graphics/scaler.cpp | 14 | ||||
-rw-r--r-- | graphics/video/mpeg_player.cpp | 8 | ||||
-rw-r--r-- | graphics/video/mpeg_player.h | 3 |
6 files changed, 32 insertions, 17 deletions
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp index f3bfc4b78f..9ff692f3fa 100644 --- a/backends/platform/dc/display.cpp +++ b/backends/platform/dc/display.cpp @@ -197,8 +197,6 @@ void OSystem_Dreamcast::initSize(uint w, uint h) { assert(w <= SCREEN_W && h <= SCREEN_H); - gBitFormat = 4444; - _overlay_visible = false; _overlay_fade = 0.0; _screen_w = w; diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp index adf519cee3..e8a7d11318 100644 --- a/backends/platform/ps2/systemps2.cpp +++ b/backends/platform/ps2/systemps2.cpp @@ -76,8 +76,6 @@ volatile uint32 msecCount = 0; OSystem_PS2 *g_systemPs2; -int gBitFormat = 555; - #define FOREVER 2147483647 namespace Graphics { diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 46c0ec6a67..055a51a4a1 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -151,8 +151,6 @@ inline uint32 fp_sqroot(uint32 x) { } -extern int gBitFormat; - namespace Graphics { VectorRenderer *createRenderer(int mode) { @@ -172,21 +170,27 @@ VectorRenderer *createRenderer(int mode) { 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 } diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp index e1f3775eac..edfb114ef7 100644 --- a/graphics/scaler.cpp +++ b/graphics/scaler.cpp @@ -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" { diff --git a/graphics/video/mpeg_player.cpp b/graphics/video/mpeg_player.cpp index 8c017e5bb5..1910babce4 100644 --- a/graphics/video/mpeg_player.cpp +++ b/graphics/video/mpeg_player.cpp @@ -45,7 +45,7 @@ BaseAnimationState::BaseAnimationState(OSystem *sys, int width, int height) _colorTab = NULL; _rgbToPix = NULL; - _bitFormat = 0; + memset(&_overlayFormat, 0, sizeof(_overlayFormat)); #endif } @@ -353,7 +353,8 @@ void BaseAnimationState::buildLookup(int p, int lines) { 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 @@ void BaseAnimationState::buildLookup() { } // 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 @@ void BaseAnimationState::buildLookup() { 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) { diff --git a/graphics/video/mpeg_player.h b/graphics/video/mpeg_player.h index 7d42618926..48c15261fc 100644 --- a/graphics/video/mpeg_player.h +++ b/graphics/video/mpeg_player.h @@ -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 @@ protected: } _palettes[50]; #else OverlayColor *_overlay; - int _bitFormat; + Graphics::PixelFormat _overlayFormat; int16 *_colorTab; OverlayColor *_rgbToPix; #endif |