[Scummvm-cvs-logs] SF.net SVN: scummvm:[41980] scummvm/branches/gsoc2009-draci/engines/draci

dkasak13 at users.sourceforge.net dkasak13 at users.sourceforge.net
Wed Jul 1 03:02:48 CEST 2009


Revision: 41980
          http://scummvm.svn.sourceforge.net/scummvm/?rev=41980&view=rev
Author:   dkasak13
Date:     2009-07-01 01:02:48 +0000 (Wed, 01 Jul 2009)

Log Message:
-----------
Added Font::drawString overload that takes in a pointer to a byte buffer and a length instead of a Common::String. Changed the former drawString to be a wrapper for the new one.

Modified Paths:
--------------
    scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
    scummvm/branches/gsoc2009-draci/engines/draci/font.h

Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-06-30 22:31:29 UTC (rev 41979)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp	2009-07-01 01:02:48 UTC (rev 41980)
@@ -205,20 +205,20 @@
  * @brief Draw a string to a Draci::Surface
  *
  * @param dst 		Pointer to the destination surface
- * @param str 		String to draw
+ * @param str 		Buffer containing string data
+ * @param len		Length of the data
  * @param x  		Horizontal offset on the surface
  * @param y  		Vertical offset on the surface
  * @param spacing 	Space to leave between individual characters. Defaults to 0. 
  */
 
-void Font::drawString(Surface *dst, const Common::String &str, 
+void Font::drawString(Surface *dst, const byte *str, uint len 
 							int x, int y, int spacing) const {
 	assert(dst != NULL);
 	assert(x >= 0);
 	assert(y >= 0);
 
 	int curx = x;
-	uint len = str.size();
 
 	for (unsigned int i = 0; i < len; ++i) {
 		
@@ -233,6 +233,22 @@
 }
 
 /**
+ * @brief Draw a string to a Draci::Surface
+ *
+ * @param dst 		Pointer to the destination surface
+ * @param str 		String to draw
+ * @param x  		Horizontal offset on the surface
+ * @param y  		Vertical offset on the surface
+ * @param spacing 	Space to leave between individual characters. Defaults to 0. 
+ */
+
+void Font::drawString(Surface *dst, const Common::String &str, 
+							int x, int y, int spacing) const {
+
+	drawString(dst, str, str.size(), x, y, spacing);
+}
+
+/**
  * @brief Calculate the width of a string when drawn in the current font
  *
  * @param str 		String to draw

Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.h
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.h	2009-06-30 22:31:29 UTC (rev 41979)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.h	2009-07-01 01:02:48 UTC (rev 41980)
@@ -62,8 +62,12 @@
 	uint8 getMaxCharWidth() const { return _maxCharWidth; };
 	uint8 getCharWidth(byte chr) const;
 	void drawChar(Surface *dst, uint8 chr, int tx, int ty) const;
+	
+	void drawString(Surface *dst, const byte *str, uint len, int x, int y, 
+					int spacing = 0) const;
 	void drawString(Surface *dst, const Common::String &str, 
 					int x, int y, int spacing = 0) const;
+	
 	int getStringWidth(const Common::String &str, int spacing = 0) const;
 	void setColour(uint8 colour);
 


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