aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2019-11-15 18:04:30 +0100
committerEugene Sandulenko2019-11-15 18:04:30 +0100
commit705c4b2c8dbc54108ee12d56a384ea9b31df3996 (patch)
tree6715546a21793105b840f354fa1cdb7b649d8073
parent1b7d0fe9a4299d02a27789c2ec45c63930bf0a44 (diff)
downloadscummvm-rg350-705c4b2c8dbc54108ee12d56a384ea9b31df3996.tar.gz
scummvm-rg350-705c4b2c8dbc54108ee12d56a384ea9b31df3996.tar.bz2
scummvm-rg350-705c4b2c8dbc54108ee12d56a384ea9b31df3996.zip
PINK: Fix text color selection and added some debug output
-rw-r--r--engines/pink/objects/actions/action_text.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 448756b1d9..c12a8922ae 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -156,9 +156,9 @@ void ActionText::draw(Graphics::ManagedSurface *surface) {
text.drawToPoint(surface, Common::Rect(0, 0, _xRight - _xLeft, _yBottom - _yTop), Common::Point(_xLeft, _yTop));
}
-#define RED(rgb) ((rgb) & 0xFF)
+#define BLUE(rgb) ((rgb) & 0xFF)
#define GREEN(rgb) (((rgb) >> 8) & 0xFF)
-#define BLUE(rgb) (((rgb) >> 16) & 0xFF)
+#define RED(rgb) (((rgb) >> 16) & 0xFF)
static uint findBestColor(byte *palette, uint32 rgb) {
uint bestColor = 0;
@@ -175,6 +175,9 @@ static uint findBestColor(byte *palette, uint32 rgb) {
min = dist;
}
}
+
+ debug(2, "for color %06x the best color is %02x%02x%02x", rgb, palette[bestColor * 3], palette[bestColor * 3 + 1], palette[bestColor * 3 + 2]);
+
return bestColor;
}
@@ -182,7 +185,9 @@ void ActionText::findColorsInPalette() {
byte palette[256 * 3];
g_system->getPaletteManager()->grabPalette(palette, 0, 256);
+ debug(2, "textcolorindex: %06x", _textRGB);
_textColorIndex = findBestColor(palette, _textRGB);
+ debug(2, "backgroundColorIndex: %06x", _backgroundRGB);
_backgroundColorIndex = findBestColor(palette, _backgroundRGB);
}