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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Nov 8 17:12:58 CET 2010


Revision: 54143
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54143&view=rev
Author:   thebluegr
Date:     2010-11-08 16:12:58 +0000 (Mon, 08 Nov 2010)

Log Message:
-----------
SCI2: Added some currently unused code for drawing text on a buffer

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

Modified: scummvm/trunk/engines/sci/graphics/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/font.cpp	2010-11-08 16:09:59 UTC (rev 54142)
+++ scummvm/trunk/engines/sci/graphics/font.cpp	2010-11-08 16:12:58 UTC (rev 54143)
@@ -99,4 +99,32 @@
 	}
 }
 
+#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

Modified: scummvm/trunk/engines/sci/graphics/font.h
===================================================================
--- scummvm/trunk/engines/sci/graphics/font.h	2010-11-08 16:09:59 UTC (rev 54142)
+++ scummvm/trunk/engines/sci/graphics/font.h	2010-11-08 16:12:58 UTC (rev 54143)
@@ -56,6 +56,10 @@
 	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);


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