diff options
author | Matthew Hoops | 2011-05-05 19:48:57 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-05 19:48:57 -0400 |
commit | 44ad7d45baa628e59105ecf3a1977b369b40c395 (patch) | |
tree | 02a16fb136fb1d63a88f7203c561456e400c8d32 /common | |
parent | 04dd4cabdf9ff9749023bde18f4871302f8f6b05 (diff) | |
download | scummvm-rg350-44ad7d45baa628e59105ecf3a1977b369b40c395.tar.gz scummvm-rg350-44ad7d45baa628e59105ecf3a1977b369b40c395.tar.bz2 scummvm-rg350-44ad7d45baa628e59105ecf3a1977b369b40c395.zip |
COMMON: Remove convertCrsrCursor()
Graphics::MacCursor is its replacement
Diffstat (limited to 'common')
-rw-r--r-- | common/macresman.cpp | 128 | ||||
-rw-r--r-- | common/macresman.h | 19 |
2 files changed, 0 insertions, 147 deletions
diff --git a/common/macresman.cpp b/common/macresman.cpp index 489f8f93ce..0ecb430532 100644 --- a/common/macresman.cpp +++ b/common/macresman.cpp @@ -550,132 +550,4 @@ void MacResManager::readMap() { } } -void MacResManager::convertCrsrCursor(SeekableReadStream *data, byte **cursor, int &w, int &h, int &hotspotX, - int &hotspotY, int &keycolor, bool colored, byte **palette, int &palSize) { - - data->readUint16BE(); // type - data->readUint32BE(); // offset to pixel map - data->readUint32BE(); // offset to pixel data - data->readUint32BE(); // expanded cursor data - data->readUint16BE(); // expanded data depth - data->readUint32BE(); // reserved - - // Grab B/W icon data - *cursor = new byte[16 * 16]; - for (int i = 0; i < 32; i++) { - byte imageByte = data->readByte(); - for (int b = 0; b < 8; b++) - cursor[0][i * 8 + b] = (byte)((imageByte & (0x80 >> b)) > 0 ? 0x0F : 0x00); - } - - // Apply mask data - for (int i = 0; i < 32; i++) { - byte imageByte = data->readByte(); - for (int b = 0; b < 8; b++) - if ((imageByte & (0x80 >> b)) == 0) - cursor[0][i * 8 + b] = 0xff; - } - - hotspotY = data->readUint16BE(); - hotspotX = data->readUint16BE(); - w = h = 16; - keycolor = 0xff; - - // Use b/w cursor on backends which don't support cursor palettes - if (!colored) - return; - - data->readUint32BE(); // reserved - data->readUint32BE(); // cursorID - - // Color version of cursor - data->readUint32BE(); // baseAddr - - // Keep only lowbyte for now - data->readByte(); - int iconRowBytes = data->readByte(); - - if (!iconRowBytes) - return; - - int iconBounds[4]; - iconBounds[0] = data->readUint16BE(); - iconBounds[1] = data->readUint16BE(); - iconBounds[2] = data->readUint16BE(); - iconBounds[3] = data->readUint16BE(); - - data->readUint16BE(); // pmVersion - data->readUint16BE(); // packType - data->readUint32BE(); // packSize - - data->readUint32BE(); // hRes - data->readUint32BE(); // vRes - - data->readUint16BE(); // pixelType - data->readUint16BE(); // pixelSize - data->readUint16BE(); // cmpCount - data->readUint16BE(); // cmpSize - - data->readUint32BE(); // planeByte - data->readUint32BE(); // pmTable - data->readUint32BE(); // reserved - - // Pixel data for cursor - int iconDataSize = iconRowBytes * (iconBounds[3] - iconBounds[1]); - byte *iconData = new byte[iconDataSize]; - - if (!iconData) { - error("Cannot allocate iconData in macresman.cpp"); - } - - data->read(iconData, iconDataSize); - - // Color table - data->readUint32BE(); // ctSeed - data->readUint16BE(); // ctFlag - uint16 ctSize = data->readUint16BE() + 1; - - *palette = new byte[ctSize * 3]; - - // Read just high byte of 16-bit color - for (int c = 0; c < ctSize; c++) { - // We just use indices 0..ctSize, so ignore color ID - data->readUint16BE(); // colorID[c] - - palette[0][c * 3 + 0] = data->readByte(); - data->readByte(); - - palette[0][c * 3 + 1] = data->readByte(); - data->readByte(); - - palette[0][c * 3 + 2] = data->readByte(); - data->readByte(); - } - - palSize = ctSize; - - int pixelsPerByte = (iconBounds[2] - iconBounds[0]) / iconRowBytes; - int bpp = 8 / pixelsPerByte; - - // build a mask to make sure the pixels are properly shifted out - int bitmask = 0; - for (int m = 0; m < bpp; m++) { - bitmask <<= 1; - bitmask |= 1; - } - - // Extract pixels from bytes - for (int j = 0; j < iconDataSize; j++) - for (int b = 0; b < pixelsPerByte; b++) { - int idx = j * pixelsPerByte + (pixelsPerByte - 1 - b); - - if (cursor[0][idx] != 0xff) // if mask is not there - cursor[0][idx] = (byte)((iconData[j] >> (b * bpp)) & bitmask); - } - - delete[] iconData; - - assert(data->size() - data->pos() == 0); -} - } // End of namespace Common diff --git a/common/macresman.h b/common/macresman.h index fdb3ce491d..f588d8f853 100644 --- a/common/macresman.h +++ b/common/macresman.h @@ -152,25 +152,6 @@ public: String getBaseFileName() const { return _baseFileName; } /** - * Convert cursor from crsr format to format suitable for feeding to CursorMan - * @param data Pointer to the cursor datax - * @param cursor Pointer to memory where result cursor will be stored. The memory - * block will be malloc()'ed - * @param w Pointer to int where the cursor width will be stored - * @param h Pointer to int where the cursor height will be stored - * @param hotspotX Storage for cursor hotspot X coordinate - * @param hotspotY Storage for cursor hotspot Y coordinate - * @param keycolor Pointer to int where the transpared color value will be stored - * @param colored If set to true then colored cursor will be returned (if any). - * b/w version will be used otherwise - * @param palette Pointer to memory where the cursor palette will be stored. - * The memory will be malloc()'ed - * @param palSize Pointer to integer where the palette size will be stored. - */ - static void convertCrsrCursor(SeekableReadStream *data, byte **cursor, int &w, int &h, int &hotspotX, - int &hotspotY, int &keycolor, bool colored, byte **palette, int &palSize); - - /** * Return list of resource IDs with specified type ID */ MacResIDArray getResIDArray(uint32 typeID); |