mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
GRAPHICS: Obtain pointer to dst surface after bounds checks in TTF renderer.
This should really make sure we are not drawing outside the surface bounds.
This commit is contained in:
parent
6402d30874
commit
66c3279b2f
@ -323,7 +323,6 @@ void TTFFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const
|
||||
int h = glyph.image.h;
|
||||
|
||||
const uint8 *srcPos = (const uint8 *)glyph.image.getBasePtr(0, 0);
|
||||
uint8 *dstPos = (uint8 *)dst->getBasePtr(x, y);
|
||||
|
||||
// Make sure we are not drawing outside the screen bounds
|
||||
if (x < 0) {
|
||||
@ -350,6 +349,8 @@ void TTFFont::drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const
|
||||
if (h <= 0)
|
||||
return;
|
||||
|
||||
uint8 *dstPos = (uint8 *)dst->getBasePtr(x, y);
|
||||
|
||||
if (dst->format.bytesPerPixel == 1) {
|
||||
for (int cy = 0; cy < h; ++cy) {
|
||||
uint8 *rDst = dstPos;
|
||||
|
Loading…
x
Reference in New Issue
Block a user