aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorColin Snover2016-03-06 21:30:37 -0600
committerColin Snover2016-03-06 21:34:44 -0600
commit266a9fdd25c2320684124f6b9f37e698960a6176 (patch)
tree99121ab820807e9e2c0ddc75c8a7ebe98f48c066 /engines/sci
parent56806161a747b1e806fa75acb56bafe7897dbea0 (diff)
downloadscummvm-rg350-266a9fdd25c2320684124f6b9f37e698960a6176.tar.gz
scummvm-rg350-266a9fdd25c2320684124f6b9f37e698960a6176.tar.bz2
scummvm-rg350-266a9fdd25c2320684124f6b9f37e698960a6176.zip
SCI32: Implement variable size frame drawing
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/graphics/text32.cpp29
1 files changed, 24 insertions, 5 deletions
diff --git a/engines/sci/graphics/text32.cpp b/engines/sci/graphics/text32.cpp
index c1335b9b4d..d980f529de 100644
--- a/engines/sci/graphics/text32.cpp
+++ b/engines/sci/graphics/text32.cpp
@@ -197,13 +197,32 @@ void GfxText32::drawFrame(const Common::Rect &rect, const int16 size, const uint
Common::Rect targetRect = doScaling ? scaleRect(rect) : rect;
byte *bitmap = _segMan->getHunkPointer(_bitmap);
- byte *pixels = bitmap + READ_SCI11ENDIAN_UINT32(bitmap + 28);
+ byte *pixels = bitmap + READ_SCI11ENDIAN_UINT32(bitmap + 28) + rect.top * _width + rect.left;
// NOTE: Not fully disassembled, but this should be right
- // TODO: Implement variable frame size
- assert(size == 1);
- Buffer buffer(_width, _height, pixels);
- buffer.frameRect(targetRect, color);
+ int16 rectWidth = targetRect.width();
+ int16 sidesHeight = targetRect.height() - size * 2;
+ int16 centerWidth = rectWidth - size * 2;
+ int16 stride = _width - rectWidth;
+
+ for (int16 y = 0; y < size; ++y) {
+ memset(pixels, color, rectWidth);
+ pixels += _width;
+ }
+ for (int16 y = 0; y < sidesHeight; ++y) {
+ for (int16 x = 0; x < size; ++x) {
+ *pixels++ = color;
+ }
+ pixels += centerWidth;
+ for (int16 x = 0; x < size; ++x) {
+ *pixels++ = color;
+ }
+ pixels += stride;
+ }
+ for (int16 y = 0; y < size; ++y) {
+ memset(pixels, color, rectWidth);
+ pixels += _width;
+ }
}
void GfxText32::drawChar(const char charIndex) {