[Scummvm-cvs-logs] scummvm master -> 9f568f5f0bac6018337022bda11cc978c242c36c
bluegr
md5 at scummvm.org
Fri Oct 14 20:16:19 CEST 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
9f568f5f0b SCI: Fixed display of text surfaces in SCI21
Commit: 9f568f5f0bac6018337022bda11cc978c242c36c
https://github.com/scummvm/scummvm/commit/9f568f5f0bac6018337022bda11cc978c242c36c
Author: Filippos Karapetis (md5 at scummvm.org)
Date: 2011-10-14T11:08:26-07:00
Commit Message:
SCI: Fixed display of text surfaces in SCI21
Changed paths:
engines/sci/graphics/text32.cpp
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index 606a935..b4e2776 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);
More information about the Scummvm-git-logs
mailing list