aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorJohannes Schickel2012-02-02 02:38:17 +0100
committerJohannes Schickel2012-02-02 02:39:41 +0100
commit66c3279b2f69a483ec3cc5ff1d8ed84e33621162 (patch)
treebd6e139c83b994a7e9ae61c00f14ff86f2a24d5d /graphics
parent6402d308747cc3d5969ca760101ebf6f34546bd2 (diff)
downloadscummvm-rg350-66c3279b2f69a483ec3cc5ff1d8ed84e33621162.tar.gz
scummvm-rg350-66c3279b2f69a483ec3cc5ff1d8ed84e33621162.tar.bz2
scummvm-rg350-66c3279b2f69a483ec3cc5ff1d8ed84e33621162.zip
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.
Diffstat (limited to 'graphics')
-rw-r--r--graphics/fonts/ttf.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/graphics/fonts/ttf.cpp b/graphics/fonts/ttf.cpp
index faf59a9ec5..06231799ce 100644
--- a/graphics/fonts/ttf.cpp
+++ b/graphics/fonts/ttf.cpp
@@ -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;