aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2010-11-08 16:12:58 +0000
committerFilippos Karapetis2010-11-08 16:12:58 +0000
commit8504e30dac5d3d362242277e4270dcec07a68798 (patch)
tree713d4ce418eb821b9936544356ca32b9ad75ca5b
parentd8eefdb52ad67e7df32411502ba7c2c02c04125d (diff)
downloadscummvm-rg350-8504e30dac5d3d362242277e4270dcec07a68798.tar.gz
scummvm-rg350-8504e30dac5d3d362242277e4270dcec07a68798.tar.bz2
scummvm-rg350-8504e30dac5d3d362242277e4270dcec07a68798.zip
SCI2: Added some currently unused code for drawing text on a buffer
svn-id: r54143
-rw-r--r--engines/sci/graphics/font.cpp28
-rw-r--r--engines/sci/graphics/font.h4
2 files changed, 32 insertions, 0 deletions
diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp
index f06dbea05e..3a6ab75cd0 100644
--- a/engines/sci/graphics/font.cpp
+++ b/engines/sci/graphics/font.cpp
@@ -99,4 +99,32 @@ void GfxFontFromResource::draw(uint16 chr, int16 top, int16 left, byte color, bo
}
}
+#ifdef ENABLE_SCI32
+
+void GfxFontFromResource::drawToBuffer(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput, byte *buffer, int16 bufWidth, int16 bufHeight) {
+ int charWidth = MIN<int>(getCharWidth(chr), bufWidth - left);
+ int charHeight = MIN<int>(getCharHeight(chr), bufHeight - top);
+ byte b = 0, mask = 0xFF;
+ int y = 0;
+ int16 greyedTop = top;
+
+ byte *pIn = getCharData(chr);
+ for (int i = 0; i < charHeight; i++, y++) {
+ if (greyedOutput)
+ mask = ((greyedTop++) % 2) ? 0xAA : 0x55;
+ for (int done = 0; done < charWidth; done++) {
+ if ((done & 7) == 0) // fetching next data byte
+ b = *(pIn++) & mask;
+ if (b & 0x80) { // if MSB is set - paint it
+ _screen->putFontPixel(top, left + done, y, color);
+ int offset = (top + y) * bufWidth + (left + done);
+ buffer[offset] = color;
+ }
+ b = b << 1;
+ }
+ }
+}
+
+#endif
+
} // End of namespace Sci
diff --git a/engines/sci/graphics/font.h b/engines/sci/graphics/font.h
index b9bee0fa9e..d8afb73a73 100644
--- a/engines/sci/graphics/font.h
+++ b/engines/sci/graphics/font.h
@@ -56,6 +56,10 @@ public:
byte getHeight();
byte getCharWidth(uint16 chr);
void draw(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput);
+#ifdef ENABLE_SCI32
+ // SCI2/2.1 equivalent
+ void drawToBuffer(uint16 chr, int16 top, int16 left, byte color, bool greyedOutput, byte *buffer, int16 width, int16 height);
+#endif
private:
byte getCharHeight(uint16 chr);