aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hdb/gfx.cpp18
-rw-r--r--engines/hdb/gfx.h14
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;