diff options
author | Filippos Karapetis | 2011-10-14 21:08:26 +0300 |
---|---|---|
committer | Filippos Karapetis | 2011-10-14 21:08:26 +0300 |
commit | 9f568f5f0bac6018337022bda11cc978c242c36c (patch) | |
tree | 274739823a915f6a6b360539818a964155505797 | |
parent | 8609e22e404c06c20c6726ee38425fa4436b6c11 (diff) | |
download | scummvm-rg350-9f568f5f0bac6018337022bda11cc978c242c36c.tar.gz scummvm-rg350-9f568f5f0bac6018337022bda11cc978c242c36c.tar.bz2 scummvm-rg350-9f568f5f0bac6018337022bda11cc978c242c36c.zip |
SCI: Fixed display of text surfaces in SCI21
-rw-r--r-- | engines/sci/graphics/text32.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp index 606a9359ac..b4e27765ad 100644 --- a/engines/sci/graphics/text32.cpp +++ b/engines/sci/graphics/text32.cpp @@ -38,6 +38,8 @@ namespace Sci { +#define BITMAP_HEADER_SIZE 46 + GfxText32::GfxText32(SegManager *segMan, GfxCache *fonts, GfxScreen *screen) : _segMan(segMan), _cache(fonts), _screen(screen) { } @@ -69,11 +71,12 @@ reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxH if (maxHeight > 0) height = maxHeight; - int entrySize = width * height; + int entrySize = width * height + BITMAP_HEADER_SIZE; reg_t memoryId = _segMan->allocateHunkEntry("TextBitmap()", entrySize); writeSelector(_segMan, textObject, SELECTOR(bitmap), memoryId); byte *memoryPtr = _segMan->getHunkPointer(memoryId); memset(memoryPtr, 0, entrySize); + byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE; int16 charCount = 0; uint16 curX = 0, curY = 0; @@ -86,7 +89,7 @@ reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxH for (int i = 0; i < charCount; i++) { unsigned char curChar = txt[i]; - font->drawToBuffer(curChar, curY, curX, foreColor, dimmed, memoryPtr, width, height); + font->drawToBuffer(curChar, curY, curX, foreColor, dimmed, bitmap, width, height); curX += font->getCharWidth(curChar); } @@ -104,18 +107,14 @@ void GfxText32::disposeTextBitmap(reg_t hunkId) { _segMan->freeHunkEntry(hunkId); } -#define BITMAP_HEADER_SIZE 46 - void GfxText32::drawTextBitmap(reg_t textObject) { reg_t hunkId = readSelector(_segMan, textObject, SELECTOR(bitmap)); - byte *surface = _segMan->getHunkPointer(hunkId); + byte *memoryPtr = _segMan->getHunkPointer(hunkId); - if (!surface) + if (!memoryPtr) error("Attempt to draw an invalid text bitmap"); - // Skip the bitmap header in SCI21 - SCI3 - if (getSciVersion() >= SCI_VERSION_2_1) - surface += BITMAP_HEADER_SIZE; + byte *surface = memoryPtr + BITMAP_HEADER_SIZE; int curByte = 0; Common::Rect nsRect = getNSRect(textObject); |