aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Hesse2012-07-08 00:19:24 +0200
committerSven Hesse2012-07-30 01:44:45 +0200
commitbaec4d87781d24786f0b76e83efee3bca7f9afea (patch)
treea489d41a4ad0e3aed743a7e17a3db4c46a221ae6
parent57b1b7ad2496be6f6c2545877576e3c818dc6ef6 (diff)
downloadscummvm-rg350-baec4d87781d24786f0b76e83efee3bca7f9afea.tar.gz
scummvm-rg350-baec4d87781d24786f0b76e83efee3bca7f9afea.tar.bz2
scummvm-rg350-baec4d87781d24786f0b76e83efee3bca7f9afea.zip
GOB: Move recolor() into class Surface
-rw-r--r--engines/gob/pregob/onceupon/onceupon.cpp18
-rw-r--r--engines/gob/pregob/onceupon/onceupon.h1
-rw-r--r--engines/gob/surface.cpp6
-rw-r--r--engines/gob/surface.h2
4 files changed, 15 insertions, 12 deletions
diff --git a/engines/gob/pregob/onceupon/onceupon.cpp b/engines/gob/pregob/onceupon/onceupon.cpp
index 1d1bfd4629..53fa3bcece 100644
--- a/engines/gob/pregob/onceupon/onceupon.cpp
+++ b/engines/gob/pregob/onceupon/onceupon.cpp
@@ -1492,12 +1492,6 @@ enum CharGenState {
kCharGenStateFinish // Finished
};
-void OnceUpon::recolor(Surface &surface, uint8 from, uint8 to) {
- for (Pixel p = surface.get(); p.isValid(); ++p)
- if (p.get() == from)
- p.set(to);
-}
-
void OnceUpon::charGenSetup(uint stage) {
Surface choix(320, 200, 1), elchoix(320, 200, 1), paperDoll(65, 137, 1);
@@ -1518,12 +1512,14 @@ void OnceUpon::charGenSetup(uint stage) {
_vm->_draw->_backSurface->blit(choix, 0, 38, 159, 121, 140, 54);
// Recolor the paper doll parts
- if (_colorHair != 0xFF)
- recolor(elchoix , 0x0C, _colorHair);
- if (_colorJacket != 0xFF)
- recolor(paperDoll, 0x0A, _colorJacket);
+ if (_colorHair != 0xFF)
+ elchoix.recolor(0x0C, _colorHair);
+
+ if (_colorJacket != 0xFF)
+ paperDoll.recolor(0x0A, _colorJacket);
+
if (_colorTrousers != 0xFF)
- recolor(paperDoll, 0x09, _colorTrousers);
+ paperDoll.recolor(0x09, _colorTrousers);
_vm->_draw->_backSurface->blit(paperDoll, 32, 51);
diff --git a/engines/gob/pregob/onceupon/onceupon.h b/engines/gob/pregob/onceupon/onceupon.h
index 3b924a11e6..80fcba35bd 100644
--- a/engines/gob/pregob/onceupon/onceupon.h
+++ b/engines/gob/pregob/onceupon/onceupon.h
@@ -314,7 +314,6 @@ private:
void charGenSetup(uint stage);
void charGenDrawName();
- static void recolor(Surface &surface, uint8 from, uint8 to);
static bool enterString(Common::String &name, int16 key, uint maxLength, const Font &font);
diff --git a/engines/gob/surface.cpp b/engines/gob/surface.cpp
index 3eaf741be2..afbb7c3bae 100644
--- a/engines/gob/surface.cpp
+++ b/engines/gob/surface.cpp
@@ -684,6 +684,12 @@ void Surface::shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom,
}
+void Surface::recolor(uint8 from, uint8 to) {
+ for (Pixel p = get(); p.isValid(); ++p)
+ if (p.get() == from)
+ p.set(to);
+}
+
void Surface::putPixel(uint16 x, uint16 y, uint32 color) {
if ((x >= _width) || (y >= _height))
return;
diff --git a/engines/gob/surface.h b/engines/gob/surface.h
index 09be8d1a49..8f895a7910 100644
--- a/engines/gob/surface.h
+++ b/engines/gob/surface.h
@@ -156,6 +156,8 @@ public:
void shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom,
uint32 color, uint8 strength);
+ void recolor(uint8 from, uint8 to);
+
void putPixel(uint16 x, uint16 y, uint32 color);
void drawLine(uint16 x0, uint16 y0, uint16 x1, uint16 y1, uint32 color);
void drawRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color);