diff options
author | Colin Snover | 2016-06-18 21:20:52 -0500 |
---|---|---|
committer | Colin Snover | 2016-06-21 08:17:28 -0500 |
commit | 820e6b8bd3783f78605f477a6f3f1548ffd8db98 (patch) | |
tree | 14bba9cf843b7c71c91b84babf2ccf7b088123be /engines/sci/graphics | |
parent | 52505dc57f7cf244e7bc318746add0ce002b6e60 (diff) | |
download | scummvm-rg350-820e6b8bd3783f78605f477a6f3f1548ffd8db98.tar.gz scummvm-rg350-820e6b8bd3783f78605f477a6f3f1548ffd8db98.tar.bz2 scummvm-rg350-820e6b8bd3783f78605f477a6f3f1548ffd8db98.zip |
SCI32: Fixes to GfxText32
1. Inline borderSize constant in createFontBitmap for consistency
2. Fix "DrawTextBox GetLongest=0" warning to only appear in games
that actually had this check (SQ6 and MGDX)
3. "Fix" implementation of getTextSize for SCI2.1early, which
gave lines with word wrap disabled a height of 0
4. Add inlining hints to some methods in BitmapResource that were
missing them for some reason
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/text32.cpp | 21 | ||||
-rw-r--r-- | engines/sci/graphics/text32.h | 4 |
2 files changed, 15 insertions, 10 deletions
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp index d3b5bf5396..993c5c90ca 100644 --- a/engines/sci/graphics/text32.cpp +++ b/engines/sci/graphics/text32.cpp @@ -121,7 +121,6 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect & int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth; int16 scriptHeight = g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight; - int borderSize = 1; mulinc(_textRect, Ratio(_scaledWidth, scriptWidth), Ratio(_scaledHeight, scriptHeight)); CelObjView view(celInfo.resourceId, celInfo.loopNo, celInfo.celNo); @@ -159,7 +158,7 @@ reg_t GfxText32::createFontBitmap(const CelInfo32 &celInfo, const Common::Rect & error("TODO: Implement transparent text"); } else { if (borderColor != -1) { - drawFrame(bitmapRect, borderSize, _borderColor, false); + drawFrame(bitmapRect, 1, _borderColor, false); } drawTextBox(); @@ -237,7 +236,8 @@ void GfxText32::drawTextBox() { int16 textRectWidth = _textRect.width(); _drawPosition.y = _textRect.top; uint charIndex = 0; - if (g_sci->getGameId() != GID_PHANTASMAGORIA) { + + if (g_sci->getGameId() == GID_SQ6 || g_sci->getGameId() == GID_MOTHERGOOSEHIRES) { if (getLongest(&charIndex, textRectWidth) == 0) { error("DrawTextBox GetLongest=0"); } @@ -591,11 +591,16 @@ Common::Rect GfxText32::getTextSize(const Common::String &text, int16 maxWidth, } } else { result.right = getTextWidth(0, 10000); - // NOTE: In the original engine code, the bottom was not decremented - // by 1, which means that the rect was actually a pixel taller than - // the height of the font. This was not the case in the other branch, - // which decremented the bottom by 1 at the end of the loop. - result.bottom = _font->getHeight() + 1; + + if (getSciVersion() < SCI_VERSION_2_1_MIDDLE) { + result.bottom = 0; + } else { + // NOTE: In the original engine code, the bottom was not decremented + // by 1, which means that the rect was actually a pixel taller than + // the height of the font. This was not the case in the other branch, + // which decremented the bottom by 1 at the end of the loop. + result.bottom = _font->getHeight() + 1; + } } if (doScaling) { diff --git a/engines/sci/graphics/text32.h b/engines/sci/graphics/text32.h index 88cf149da7..9892740c42 100644 --- a/engines/sci/graphics/text32.h +++ b/engines/sci/graphics/text32.h @@ -133,7 +133,7 @@ public: setScaledHeight(scaledHeight); } - reg_t getObject() const { + inline reg_t getObject() const { return _object; } @@ -180,7 +180,7 @@ public: return READ_SCI11ENDIAN_UINT32(_bitmap + 20); } - void setHunkPaletteOffset(uint32 hunkPaletteOffset) { + inline void setHunkPaletteOffset(uint32 hunkPaletteOffset) { if (hunkPaletteOffset) { hunkPaletteOffset += getBitmapHeaderSize(); } |