fix prev commit: correctly check on left side too

This commit is contained in:
marschap
2006-04-07 16:40:13 +00:00
parent 0ff8c4e032
commit 7c0590b37b
2 changed files with 10 additions and 11 deletions
+4 -5
View File
@@ -145,13 +145,12 @@ debug_string (Driver *drvthis, int x, int y, char string[])
y --; x --; // Convert 1-based coords to 0-based...
if ((x < 0) || (y < 0) || (x >= width) || (y >= height))
if ((y < 0) || (y >= height))
return;
for (i = 0; string[i] != '\0'; i++) {
if (x + i >= width)
break;
framebuf[(y * width) + x + i] = string[i];
for (i = 0; (string[i] != '\0') && (x < width); i++, x++) {
if (x >= 0) // no write left of left border
framebuf[(y * width) + x] = string[i];
}
}
+6 -6
View File
@@ -174,13 +174,12 @@ text_string (Driver *drvthis, int x, int y, char string[])
x--; y--; // Convert 1-based coords to 0-based...
if ((x < 0) || (y < 0) || (x >= width) || (y >= height))
if ((y < 0) || (y >= height))
return;
for (i = 0; string[i] != '\0'; i++) {
if (x + i >= width) // no write over right border
break;
framebuf[(y * width) + x + i] = string[i];
for (i = 0; (string[i] != '\0') && (x < width); i++, x++) {
if (x >= 0) // no write left of left border
framebuf[(y * width) + x] = string[i];
}
}
@@ -193,7 +192,8 @@ text_chr (Driver *drvthis, int x, int y, char c)
{
y--; x--;
framebuf[(y * width) + x] = c;
if ((x >= 0) && (y >= 0) && (x < width) && (y < height))
framebuf[(y * width) + x] = c;
}
/////////////////////////////////////////////////////////////////