From 6174a3e4f889f5e69e03b56ee562a3c3b9ed84b6 Mon Sep 17 00:00:00 2001 From: Crayon2000 Date: Tue, 24 Aug 2010 22:50:38 +0000 Subject: [PATCH] [CHG] Small optimization in GRRLIB_Printf --- GRRLIB/GRRLIB/GRRLIB_print.c | 7 ++++--- GRRLIB/GRRLIB/GRRLIB_render.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/GRRLIB/GRRLIB/GRRLIB_print.c b/GRRLIB/GRRLIB/GRRLIB_print.c index 7ecffe0..1a22df1 100644 --- a/GRRLIB/GRRLIB/GRRLIB_print.c +++ b/GRRLIB/GRRLIB/GRRLIB_print.c @@ -45,15 +45,16 @@ void GRRLIB_Printf (const f32 xpos, const f32 ypos, int i, size; char tmp[1024]; + f32 offset = tex->tilew * zoom; va_list argp; va_start(argp, text); - size = vsprintf(tmp, text, argp); + size = vsnprintf(tmp, sizeof(tmp), text, argp); va_end(argp); for (i = 0; i < size; i++) { - u8 c = tmp[i]-tex->tilestart; - GRRLIB_DrawTile(xpos+i*tex->tilew*zoom, ypos, tex, 0, zoom, zoom, color, c); + GRRLIB_DrawTile(xpos+i*offset, ypos, tex, 0, zoom, zoom, color, + tmp[i] - tex->tilestart); } } diff --git a/GRRLIB/GRRLIB/GRRLIB_render.c b/GRRLIB/GRRLIB/GRRLIB_render.c index a2e1d83..ff33c96 100644 --- a/GRRLIB/GRRLIB/GRRLIB_render.c +++ b/GRRLIB/GRRLIB/GRRLIB_render.c @@ -167,11 +167,11 @@ void GRRLIB_DrawImgQuad (const guVector pos[4], GRRLIB_texImg *tex, const u32 c * @param xpos Specifies the x-coordinate of the upper-left corner. * @param ypos Specifies the y-coordinate of the upper-left corner. * @param tex The texture containing the tile to draw. - * @param frame Specifies the frame to draw. * @param degrees Angle of rotation. * @param scaleX Specifies the x-coordinate scale. -1 could be used for flipping the texture horizontally. * @param scaleY Specifies the y-coordinate scale. -1 could be used for flipping the texture vertically. * @param color Color in RGBA format. + * @param frame Specifies the frame to draw. */ void GRRLIB_DrawTile (const f32 xpos, const f32 ypos, const GRRLIB_texImg *tex, const f32 degrees, const f32 scaleX, const f32 scaleY, const u32 color, const int frame) { GXTexObj texObj;