diff options
author | Martin Kiewitz | 2010-01-31 16:49:22 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-01-31 16:49:22 +0000 |
commit | af5b9b14ca7d0eb7e5bdc8ddd88180f31680b137 (patch) | |
tree | a875fa7f4c109dab9246e43faf05dcceb0a413c1 /engines/sci | |
parent | 594d82e287acd177b84f0db65ed86080ea1bbc82 (diff) | |
download | scummvm-rg350-af5b9b14ca7d0eb7e5bdc8ddd88180f31680b137.tar.gz scummvm-rg350-af5b9b14ca7d0eb7e5bdc8ddd88180f31680b137.tar.bz2 scummvm-rg350-af5b9b14ca7d0eb7e5bdc8ddd88180f31680b137.zip |
SCI: changed the way font class is initialized
svn-id: r47756
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/graphics/font.cpp | 12 | ||||
-rw-r--r-- | engines/sci/graphics/font.h | 5 | ||||
-rw-r--r-- | engines/sci/graphics/text.cpp | 6 |
3 files changed, 12 insertions, 11 deletions
diff --git a/engines/sci/graphics/font.cpp b/engines/sci/graphics/font.cpp index 82c949f88d..c85ff9bd15 100644 --- a/engines/sci/graphics/font.cpp +++ b/engines/sci/graphics/font.cpp @@ -30,8 +30,8 @@ namespace Sci { -Font::Font(ResourceManager *resMan, GuiResourceId resourceId) - : _resourceId(resourceId), _resMan(resMan) { +Font::Font(ResourceManager *resMan, GfxScreen *screen, GuiResourceId resourceId) + : _resourceId(resourceId), _screen(screen), _resMan(resMan) { assert(resourceId != -1); // Workaround: lsl1sci mixes its own internal fonts with the global @@ -78,9 +78,9 @@ byte *Font::getCharData(byte chr) { return chr < _numChars ? _resourceData + _chars[chr].offset + 2 : 0; } -void Font::draw(GfxScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput) { - int charWidth = MIN<int>(getCharWidth(chr), screen->getWidth() - left); - int charHeight = MIN<int>(getCharHeight(chr), screen->getHeight() - top); +void Font::draw(int16 chr, int16 top, int16 left, byte color, bool greyedOutput) { + int charWidth = MIN<int>(getCharWidth(chr), _screen->getWidth() - left); + int charHeight = MIN<int>(getCharHeight(chr), _screen->getHeight() - top); byte b = 0, mask = 0xFF; int y = top; @@ -92,7 +92,7 @@ void Font::draw(GfxScreen *screen, int16 chr, int16 top, int16 left, byte color, if ((done & 7) == 0) // fetching next data byte b = *(pIn++) & mask; if (b & 0x80) // if MSB is set - paint it - screen->putPixel(left + done, y, 1, color, 0, 0); + _screen->putPixel(left + done, y, 1, color, 0, 0); b = b << 1; } } diff --git a/engines/sci/graphics/font.h b/engines/sci/graphics/font.h index 65406c907a..4a33b484d0 100644 --- a/engines/sci/graphics/font.h +++ b/engines/sci/graphics/font.h @@ -32,7 +32,7 @@ namespace Sci { class Font { public: - Font(ResourceManager *resMan, GuiResourceId resourceId); + Font(ResourceManager *resMan, GfxScreen *screen, GuiResourceId resourceId); ~Font(); GuiResourceId getResourceId(); @@ -40,10 +40,11 @@ public: byte getCharWidth(byte chr); byte getCharHeight(byte chr); byte *getCharData(byte chr); - void draw(GfxScreen *screen, int16 chr, int16 top, int16 left, byte color, bool greyedOutput); + void draw(int16 chr, int16 top, int16 left, byte color, bool greyedOutput); private: ResourceManager *_resMan; + GfxScreen *_screen; Resource *_resource; GuiResourceId _resourceId; diff --git a/engines/sci/graphics/text.cpp b/engines/sci/graphics/text.cpp index 011232ff07..8d0e64b759 100644 --- a/engines/sci/graphics/text.cpp +++ b/engines/sci/graphics/text.cpp @@ -60,7 +60,7 @@ GuiResourceId Text::GetFontId() { Font *Text::GetFont() { if ((_font == NULL) || (_font->getResourceId() != _ports->_curPort->fontId)) { delete _font; - _font = new Font(_resMan, _ports->_curPort->fontId); + _font = new Font(_resMan, _screen, _ports->_curPort->fontId); } return _font; @@ -69,7 +69,7 @@ Font *Text::GetFont() { void Text::SetFont(GuiResourceId fontId) { if ((_font == NULL) || (_font->getResourceId() != fontId)) { delete _font; - _font = new Font(_resMan, fontId); + _font = new Font(_resMan, _screen, fontId); } _ports->_curPort->fontId = _font->getResourceId(); @@ -336,7 +336,7 @@ void Text::Draw(const char *text, int16 from, int16 len, GuiResourceId orgFontId _paint16->eraseRect(rect); } // CharStd - _font->draw(_screen, curChar, _ports->_curPort->top + _ports->_curPort->curTop, _ports->_curPort->left + _ports->_curPort->curLeft, _ports->_curPort->penClr, _ports->_curPort->greyedOutput); + _font->draw(curChar, _ports->_curPort->top + _ports->_curPort->curTop, _ports->_curPort->left + _ports->_curPort->curLeft, _ports->_curPort->penClr, _ports->_curPort->greyedOutput); _ports->_curPort->curLeft += charWidth; } } |