[Scummvm-cvs-logs] SF.net SVN: scummvm:[41475] scummvm/branches/gsoc2009-draci/engines/draci
dkasak13 at users.sourceforge.net
dkasak13 at users.sourceforge.net
Fri Jun 12 12:37:47 CEST 2009
Revision: 41475
http://scummvm.svn.sourceforge.net/scummvm/?rev=41475&view=rev
Author: dkasak13
Date: 2009-06-12 10:37:46 +0000 (Fri, 12 Jun 2009)
Log Message:
-----------
Made DraciFont::drawString() return early if the string is too long to fit on the screen.
Modified Paths:
--------------
scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
Modified: scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp 2009-06-12 10:26:58 UTC (rev 41474)
+++ scummvm/branches/gsoc2009-draci/engines/draci/draci.cpp 2009-06-12 10:37:46 UTC (rev 41475)
@@ -136,8 +136,12 @@
testString = "I'm smaller than the font above me.";
font.drawString(surf, testString,
(320 - font.getStringWidth(testString, 1)) / 2, 150, 1);
+
+ // Overflow handling test
+ testString = "Checking overflooooooooooooooooooooooooow...";
+ font.drawString(surf, testString, 50, 170, 1);
+
_system->unlockScreen();
-
_system->updateScreen();
// Draw and animate the dragon
Modified: scummvm/branches/gsoc2009-draci/engines/draci/font.cpp
===================================================================
--- scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-06-12 10:26:58 UTC (rev 41474)
+++ scummvm/branches/gsoc2009-draci/engines/draci/font.cpp 2009-06-12 10:37:46 UTC (rev 41475)
@@ -166,6 +166,12 @@
uint len = str.size();
for (unsigned int i = 0; i < len; ++i) {
+
+ // Return early if there's no more space on the screen
+ if (curx >= dst->w) {
+ return;
+ }
+
drawChar(dst, str[i], curx, y);
curx += getCharWidth(str[i]) + spacing;
}
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