aboutsummaryrefslogtreecommitdiff
path: root/kyra/palette.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2004-11-14 20:11:22 +0000
committerEugene Sandulenko2004-11-14 20:11:22 +0000
commitddda67753e012a2946403933f57115b37e796bf8 (patch)
treebab4ebf24cb0e9cb03082658e5986e32a5fc0d79 /kyra/palette.cpp
parent0cfd573951c2cdd886cea650c43f0c4406e7fa94 (diff)
downloadscummvm-rg350-ddda67753e012a2946403933f57115b37e796bf8.tar.gz
scummvm-rg350-ddda67753e012a2946403933f57115b37e796bf8.tar.bz2
scummvm-rg350-ddda67753e012a2946403933f57115b37e796bf8.zip
Patch #1066256. Mostly indentation fixes and some debug messages removed.
svn-id: r15811
Diffstat (limited to 'kyra/palette.cpp')
-rw-r--r--kyra/palette.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/kyra/palette.cpp b/kyra/palette.cpp
index 8087672e6e..3e66a10b99 100644
--- a/kyra/palette.cpp
+++ b/kyra/palette.cpp
@@ -27,54 +27,54 @@
namespace Kyra {
- Palette::Palette(uint8* data, uint32 size) {
- if (!data) {
- error("resource created without data");
- }
+Palette::Palette(uint8* data, uint32 size) {
+ if (!data) {
+ error("resource created without data");
+ }
+
+ if (size != 768) {
+ Common::MemoryReadStream datastream(data, size);
- if (size != 768) {
- Common::MemoryReadStream datastream(data, size);
-
- datastream.readSint32LE();
- int imageSize = datastream.readSint16LE();
-
- if (imageSize != 768) {
- error("decompresed palette is not 768 byte long!");
- }
-
- // lets uncompress this palette :)
- _palette = new uint8[imageSize];
- assert(_palette);
-
- // made decompression
- if (Compression::decode80(data + 10, _palette) != 768) {
- error("decode80 decompressesize != 768 bytes");
- }
-
- delete [] data;
- data = _palette;
- }
+ datastream.readSint32LE();
+ int imageSize = datastream.readSint16LE();
- // hmm.. common/system.h Docu is wrong or SDL Backend has a bug :)
- // a palette should have this order:
- // R1-G1-B1-A1-R2-G2-B2-A2-...
- // so we need 4 bytes per color
- _palette = new uint8[256 * 4];
+ if (imageSize != 768) {
+ error("decompresed palette is not 768 byte long!");
+ }
- uint8* currentpossrc = &data[0];
- uint8* currentposdst = &_palette[0];
+ // lets uncompress this palette :)
+ _palette = new uint8[imageSize];
+ assert(_palette);
- // creates the original pallette (only first 6 bits are used)
- for (uint32 i = 0; i < 256; i++) {
- currentposdst[0] = currentpossrc[0] << 2;
- currentposdst[1] = currentpossrc[1] << 2;
- currentposdst[2] = currentpossrc[2] << 2;
- currentpossrc += 3;
- currentposdst += 4;
+ // made decompression
+ if (Compression::decode80(data + 10, _palette) != 768) {
+ error("decode80 decompressesize != 768 bytes");
}
delete [] data;
+ data = _palette;
}
+
+ // hmm.. common/system.h Docu is wrong or SDL Backend has a bug :)
+ // a palette should have this order:
+ // R1-G1-B1-A1-R2-G2-B2-A2-...
+ // so we need 4 bytes per color
+ _palette = new uint8[256 * 4];
+
+ uint8* currentpossrc = &data[0];
+ uint8* currentposdst = &_palette[0];
+
+ // creates the original pallette (only first 6 bits are used)
+ for (uint32 i = 0; i < 256; i++) {
+ currentposdst[0] = currentpossrc[0] << 2;
+ currentposdst[1] = currentpossrc[1] << 2;
+ currentposdst[2] = currentpossrc[2] << 2;
+ currentpossrc += 3;
+ currentposdst += 4;
+ }
+
+ delete [] data;
+}
} // end of namespace Kyra