From d8db7b11c14c03704c7b1a50bbaff72008eddf7a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 28 Oct 2011 22:18:10 +0300 Subject: SCI: Use the original text buffer width/height when drawing it Fixes the display of overlay text --- engines/sci/graphics/text32.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'engines/sci/graphics/text32.cpp') diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp index 50b782d3e6..ff26845c51 100644 --- a/engines/sci/graphics/text32.cpp +++ b/engines/sci/graphics/text32.cpp @@ -86,6 +86,10 @@ reg_t GfxText32::createTextBitmap(reg_t textObject, uint16 maxWidth, uint16 maxH memset(memoryPtr, backColor, entrySize); byte *bitmap = memoryPtr + BITMAP_HEADER_SIZE; + // Save totalWidth, totalHeight + WRITE_LE_UINT16((void *)memoryPtr, width); + WRITE_LE_UINT16((void *)(memoryPtr + 2), height); + int16 charCount = 0; uint16 curX = 0, curY = 0; const char *txt = text.c_str(); @@ -130,22 +134,20 @@ void GfxText32::drawTextBitmap(reg_t textObject) { byte *surface = memoryPtr + BITMAP_HEADER_SIZE; int curByte = 0; - Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(textObject); Common::Rect planeRect = getPlaneRect(textObject); uint16 x = readSelectorValue(_segMan, textObject, SELECTOR(x)); uint16 y = readSelectorValue(_segMan, textObject, SELECTOR(y)); uint16 skipColor = readSelectorValue(_segMan, textObject, SELECTOR(skip)); uint16 textX = planeRect.left + x; uint16 textY = planeRect.top + y; - uint16 width = nsRect.width() + 1; - uint16 height = nsRect.height() + 1; + // Get totalWidth, totalHeight + uint16 width = READ_LE_UINT16((void *)memoryPtr); + uint16 height = READ_LE_UINT16((void *)(memoryPtr + 2)); // Upscale the coordinates/width if the fonts are already upscaled if (_screen->fontIsUpscaled()) { textX = textX * _screen->getDisplayWidth() / _screen->getWidth(); textY = textY * _screen->getDisplayHeight() / _screen->getHeight(); - width = width * _screen->getDisplayWidth() / _screen->getWidth(); - height = height * _screen->getDisplayHeight() / _screen->getHeight(); } for (int curY = 0; curY < height; curY++) { @@ -282,4 +284,4 @@ int16 GfxText32::Size(Common::Rect &rect, const char *text, GuiResourceId fontId return rect.right; } -} // End of namespace Sci \ No newline at end of file +} // End of namespace Sci -- cgit v1.2.3