diff options
author | Johannes Schickel | 2009-06-29 16:49:38 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-06-29 16:49:38 +0000 |
commit | 07cdbd273db8887778a0b15048679ee78b2d72ce (patch) | |
tree | 2a886dabf23f4efd4f75456673e211dcd2f1daf4 | |
parent | bfe8ec6d668a3586ee101da671de73f5fc8bbac8 (diff) | |
download | scummvm-rg350-07cdbd273db8887778a0b15048679ee78b2d72ce.tar.gz scummvm-rg350-07cdbd273db8887778a0b15048679ee78b2d72ce.tar.bz2 scummvm-rg350-07cdbd273db8887778a0b15048679ee78b2d72ce.zip |
Add a "fill" method to Palette.
svn-id: r41952
-rw-r--r-- | engines/kyra/screen.cpp | 6 | ||||
-rw-r--r-- | engines/kyra/screen.h | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index e7aa4af8b7..3c9759d88d 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -3308,6 +3308,12 @@ void Palette::clear() { memset(_palData, 0, _numColors * 3); } +void Palette::fill(int firstCol, int numCols, uint8 value) { + assert(firstCol >= 0 && firstCol + numCols <= _numColors); + + memset(_palData + firstCol * 3, CLIP<int>(value, 0, 63), numCols * 3); +} + void Palette::copy(const Palette &source, int firstCol, int numCols, int dstStart) { if (numCols == -1) numCols = MIN(source.getNumColors(), _numColors) - firstCol; diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index 8744a7107d..ba69aea3cc 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -105,6 +105,15 @@ public: void clear(); /** + * Fill the given indexes with the given component value. + * + * @param firstCol the first color, which should be overwritten. + * @param numCols number of colors, which schould be overwritten. + * @param value color component value, which should be stored. + */ + void fill(int firstCol, int numCols, uint8 value); + + /** * Copy data from another palette. * * @param source palette to copy data from. |