From 3faf58c601f904e4536aec87ac1acd7000eaf258 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sat, 30 Jun 2012 13:57:03 -0300 Subject: [PATCH] tools/libtxt/font.c (do_draw): we can now have negative coordinates; clip them too --- tools/libtxt/font.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libtxt/font.c b/tools/libtxt/font.c index 915eb04..62ec705 100644 --- a/tools/libtxt/font.c +++ b/tools/libtxt/font.c @@ -256,10 +256,10 @@ static void do_draw(uint8_t *canvas, int width, int heigth, int ix, iy, xt; for (ix = 0; ix != w; ix++) { - if (x+ix >= width) + if (x+ix < 0 || x+ix >= width) continue; for (iy = 0; iy != h; iy++) { - if (y+iy >= heigth) + if (y+iy < 0 || y+iy >= heigth) continue; xt = ox+ix; if (img->data[(oy+iy)*img->span+(xt >> 3)] &