fix prev commit: correctly check on left side too
This commit is contained in:
@@ -145,13 +145,12 @@ debug_string (Driver *drvthis, int x, int y, char string[])
|
|||||||
|
|
||||||
y --; x --; // Convert 1-based coords to 0-based...
|
y --; x --; // Convert 1-based coords to 0-based...
|
||||||
|
|
||||||
if ((x < 0) || (y < 0) || (x >= width) || (y >= height))
|
if ((y < 0) || (y >= height))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; string[i] != '\0'; i++) {
|
for (i = 0; (string[i] != '\0') && (x < width); i++, x++) {
|
||||||
if (x + i >= width)
|
if (x >= 0) // no write left of left border
|
||||||
break;
|
framebuf[(y * width) + x] = string[i];
|
||||||
framebuf[(y * width) + x + i] = string[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,13 +174,12 @@ text_string (Driver *drvthis, int x, int y, char string[])
|
|||||||
|
|
||||||
x--; y--; // Convert 1-based coords to 0-based...
|
x--; y--; // Convert 1-based coords to 0-based...
|
||||||
|
|
||||||
if ((x < 0) || (y < 0) || (x >= width) || (y >= height))
|
if ((y < 0) || (y >= height))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; string[i] != '\0'; i++) {
|
for (i = 0; (string[i] != '\0') && (x < width); i++, x++) {
|
||||||
if (x + i >= width) // no write over right border
|
if (x >= 0) // no write left of left border
|
||||||
break;
|
framebuf[(y * width) + x] = string[i];
|
||||||
framebuf[(y * width) + x + i] = string[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,7 +192,8 @@ text_chr (Driver *drvthis, int x, int y, char c)
|
|||||||
{
|
{
|
||||||
y--; x--;
|
y--; x--;
|
||||||
|
|
||||||
framebuf[(y * width) + x] = c;
|
if ((x >= 0) && (y >= 0) && (x < width) && (y < height))
|
||||||
|
framebuf[(y * width) + x] = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user