[Scummvm-cvs-logs] SF.net SVN: scummvm:[47756] scummvm/trunk/engines/sci/graphics

m_kiewitz at users.sourceforge.net m_kiewitz at users.sourceforge.net
Sun Jan 31 17:49:22 CET 2010


Revision: 47756
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47756&view=rev
Author:   m_kiewitz
Date:     2010-01-31 16:49:22 +0000 (Sun, 31 Jan 2010)

Log Message:
-----------
SCI: changed the way font class is initialized

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/font.cpp
    scummvm/trunk/engines/sci/graphics/font.h
    scummvm/trunk/engines/sci/graphics/text.cpp

Modified: scummvm/trunk/engines/sci/graphics/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/font.cpp	2010-01-31 16:32:11 UTC (rev 47755)
+++ scummvm/trunk/engines/sci/graphics/font.cpp	2010-01-31 16:49:22 UTC (rev 47756)
@@ -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 @@
 	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 @@
 			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;
 		}
 	}

Modified: scummvm/trunk/engines/sci/graphics/font.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/font.h	2010-01-31 16:32:11 UTC (rev 47755)
+++ scummvm/trunk/engines/sci/graphics/font.h	2010-01-31 16:49:22 UTC (rev 47756)
@@ -32,7 +32,7 @@
 
 class Font {
 public:
-	Font(ResourceManager *resMan, GuiResourceId resourceId);
+	Font(ResourceManager *resMan, GfxScreen *screen, GuiResourceId resourceId);
 	~Font();
 
 	GuiResourceId getResourceId();
@@ -40,10 +40,11 @@
 	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;

Modified: scummvm/trunk/engines/sci/graphics/text.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/text.cpp	2010-01-31 16:32:11 UTC (rev 47755)
+++ scummvm/trunk/engines/sci/graphics/text.cpp	2010-01-31 16:49:22 UTC (rev 47756)
@@ -60,7 +60,7 @@
 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 @@
 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 @@
 				_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;
 		}
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list