fix timer formatting

This commit is contained in:
ehouse 2009-09-20 05:00:23 +00:00
parent 250e223a20
commit a5556469ef

View file

@ -908,18 +908,19 @@ gtk_draw_score_pendingScore( DrawCtx* p_dctx, const XP_Rect* rect,
} /* gtk_draw_score_pendingScore */ } /* gtk_draw_score_pendingScore */
static void static void
gtkFormatTimerText( XP_UCHAR* buf, XP_S16 secondsLeft ) gtkFormatTimerText( XP_UCHAR* buf, XP_U16 bufLen, XP_S16 secondsLeft )
{ {
XP_U16 minutes, seconds; XP_U16 minutes, seconds;
if ( secondsLeft < 0 ) { if ( secondsLeft < 0 ) {
*buf++ = '-'; *buf++ = '-';
--bufLen;
secondsLeft *= -1; secondsLeft *= -1;
} }
minutes = secondsLeft / 60; minutes = secondsLeft / 60;
seconds = secondsLeft % 60; seconds = secondsLeft % 60;
XP_SNPRINTF( buf, VSIZE(buf), "% 1d:%02d", minutes, seconds ); XP_SNPRINTF( buf, bufLen, "% 1d:%02d", minutes, seconds );
} /* gtkFormatTimerText */ } /* gtkFormatTimerText */
static void static void
@ -930,7 +931,7 @@ gtk_draw_drawTimer( DrawCtx* p_dctx, const XP_Rect* rInner,
GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx; GtkDrawCtx* dctx = (GtkDrawCtx*)p_dctx;
XP_UCHAR buf[10]; XP_UCHAR buf[10];
gtkFormatTimerText( buf, secondsLeft ); gtkFormatTimerText( buf, VSIZE(buf), secondsLeft );
/* gdk_gc_set_clip_rectangle( dctx->drawGC, (GdkRectangle*)rInner ); */ /* gdk_gc_set_clip_rectangle( dctx->drawGC, (GdkRectangle*)rInner ); */
gtkEraseRect( dctx, rInner ); gtkEraseRect( dctx, rInner );