]> git.sesse.net Git - ccbs/commitdiff
Make my_draw_text() clip horizontally.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 19 Feb 2005 19:16:03 +0000 (19:16 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 19 Feb 2005 19:16:03 +0000 (19:16 +0000)
bigscreen/fonts.cpp

index e65e3564281ce3f26e7dd6f1924d8f1bb910b32c..a2ac91b5a91c121cca23e7a8b79f947c65ea617c 100644 (file)
@@ -68,7 +68,9 @@ unsigned my_draw_text(const widestring &str, unsigned char *buf, double size, in
 
                                unsigned char *dst = buf + dsty * 800*4 + (x + xpos + slot->bitmap_left)*4;
                                unsigned char *src = bm->buffer + y * bm->width;
-                               for (xx = 0; xx < bm->width; xx++) {
+
+                               int width = (x + xpos + slot->bitmap_left + bm->width >= 800) ? (799 - x - xpos - slot->bitmap_left) : bm->width;
+                               for (xx = 0; xx < width; xx++) {
                                        *dst = (*dst * (256-*src) + r * *src) >> 8;
                                        *dst++;
                                        *dst = (*dst * (256-*src) + g * *src) >> 8;