diff options
author | Nipun Garg | 2019-07-13 03:52:04 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:18 +0200 |
commit | 190b550caaa8b5070e9fdda78555b30e1a340af3 (patch) | |
tree | cd07b8936ea6cbfb133faaa737b7083379cc72a0 | |
parent | 0bd8e53f88ef40318a90a0c8568d88762ee841a4 (diff) | |
download | scummvm-rg350-190b550caaa8b5070e9fdda78555b30e1a340af3.tar.gz scummvm-rg350-190b550caaa8b5070e9fdda78555b30e1a340af3.tar.bz2 scummvm-rg350-190b550caaa8b5070e9fdda78555b30e1a340af3.zip |
HDB: Replace original color functions
With the ones from Graphics::PixelFormat
-rw-r--r-- | engines/hdb/gfx.cpp | 18 | ||||
-rw-r--r-- | engines/hdb/gfx.h | 14 |
2 files changed, 8 insertions, 24 deletions
diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index 4b2f7b6e21..1000d97694 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -243,7 +243,7 @@ void Gfx::setFade(bool fadeIn, bool black, int steps) { } void Gfx::updateFade() { - uint r, g, b; + uint8 r, g, b; static int waitAFrame = 0; if (!_fadeInfo.active && !_fadeInfo.stayFaded) @@ -271,11 +271,11 @@ void Gfx::updateFade() { for (int x = 0; x < kScreenWidth; x++) { value = *ptr; if (value) { - *ptr = rgbTo565( - (getR(value) * _fadeInfo.curStep) >> 8, - (getG(value) * _fadeInfo.curStep) >> 8, - (getB(value) * _fadeInfo.curStep) >> 8 - ); + g_hdb->_format.colorToRGB(value, r, g, b); + r = (r * _fadeInfo.curStep) >> 8; + g = (g * _fadeInfo.curStep) >> 8; + b = (b * _fadeInfo.curStep) >> 8; + *ptr = g_hdb->_format.RGBToColor(r, g, b); } ptr++; } @@ -287,13 +287,11 @@ void Gfx::updateFade() { ptr = (uint16 *)fadeBuffer1.getBasePtr(0, y); for (int x = 0; x < kScreenWidth; x++) { value = *ptr; - r = getR(value); - g = getG(value); - b = getB(value); + g_hdb->_format.colorToRGB(value, r, g, b); r += (255 - r) * (256 - _fadeInfo.curStep) / 256; g += (255 - g) * (256 - _fadeInfo.curStep) / 256; b += (255 - b) * (256 - _fadeInfo.curStep) / 256; - *ptr = rgbTo565(r, g, b); + *ptr = g_hdb->_format.RGBToColor(r, g, b); ptr++; } } diff --git a/engines/hdb/gfx.h b/engines/hdb/gfx.h index d0d9681200..a9df0c349e 100644 --- a/engines/hdb/gfx.h +++ b/engines/hdb/gfx.h @@ -166,20 +166,6 @@ public: void turnOnBonusStars(int which); void drawBonusStars(); - // Macro to convert RGB into 16-bit - uint16 rgbTo565(int r, int g, int b) { - return (uint16) ( - ((r & 0xf8) << 8) | - ((g & 0xfc) << 3) | - ((b & 0xf8) >> 3) - ); - } - - // Macros to get RGB from 565 short -#define getR( x ) ( ( x & 0xf800 ) >> 8 ) -#define getG( x ) ( ( x & 0x07e0 ) >> 3 ) -#define getB( x ) ( ( x & 0x001f ) << 3 ) - private: int _numTiles; TileLookup *_tLookupArray; |