[Scummvm-cvs-logs] CVS: scummvm/graphics scummfont.cpp,1.2,1.2.2.1
Max Horn
fingolfin at users.sourceforge.net
Mon Dec 20 14:55:04 CET 2004
Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17358
Modified Files:
Tag: branch-0-7-0
scummfont.cpp
Log Message:
clipping fixes from HEAD
Index: scummfont.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/scummfont.cpp,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -d -r1.2 -r1.2.2.1
--- scummfont.cpp 16 Apr 2004 12:12:37 -0000 1.2
+++ scummfont.cpp 20 Dec 2004 22:54:33 -0000 1.2.2.1
@@ -62,16 +62,20 @@
}
//void ScummFont::drawChar(byte chr, int xx, int yy, OverlayColor color) {
-void ScummFont::drawChar(const Surface *dst, byte chr, int x, int y, uint32 color) const {
+void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
assert(dst != 0);
- byte *ptr = (byte *)dst->pixels + x * dst->bytesPerPixel + y * dst->pitch;
+ byte *ptr = (byte *)dst->getBasePtr(tx, ty);
const byte *tmp = guifont + 6 + guifont[4] + chr * 8;
uint buffer = 0;
uint mask = 0;
- for (y = 0; y < 8; y++) {
- for (x = 0; x < 8; x++) {
+ for (int y = 0; y < 8; y++) {
+ if (ty + y < 0 || ty + y >= dst->h)
+ continue;
+ for (int x = 0; x < 8; x++) {
+ if (tx + x < 0 || tx + x >= dst->w)
+ continue;
unsigned char c;
mask >>= 1;
if (mask == 0) {
More information about the Scummvm-git-logs
mailing list