mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
SCI2: Added some currently unused code for drawing text on a buffer
svn-id: r54143
This commit is contained in:
parent
d8eefdb52a
commit
8504e30dac
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user