From a4cabd9cf7b19ff7d37d0762f4d69755c49d4c7b Mon Sep 17 00:00:00 2001 From: ehouse Date: Fri, 16 Jun 2006 01:15:44 +0000 Subject: [PATCH] Allow no space for REM text when no tiles left to allow more room for scores. --- xwords4/wince/cedraw.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/xwords4/wince/cedraw.c b/xwords4/wince/cedraw.c index 8f32427c8..7d0b63998 100755 --- a/xwords4/wince/cedraw.c +++ b/xwords4/wince/cedraw.c @@ -579,17 +579,15 @@ DRAW_FUNC_NAME(scoreBegin)( DrawCtx* p_dctx, const XP_Rect* rect, static void formatRemText( HDC hdc, XP_S16 nTilesLeft, XP_Bool isVertical, XP_UCHAR* buf ) { - if ( nTilesLeft <= 0 ) { - buf[0] = 0; - } else { - char* fmt; - if ( isVertical ) { - fmt = "Rem" XP_CR "%d"; - } else { - fmt = "Rem:%d"; - } - sprintf( buf, fmt, nTilesLeft ); + char* fmt; + XP_ASSERT( nTilesLeft > 0 ); + + if ( isVertical ) { + fmt = "Rem" XP_CR "%d"; + } else { + fmt = "Rem:%d"; } + sprintf( buf, fmt, nTilesLeft ); } /* formatRemText */ DLSTATIC void @@ -602,8 +600,12 @@ DRAW_FUNC_NAME(measureRemText)( DrawCtx* p_dctx, const XP_Rect* r, HDC hdc = globals->hdc; XP_UCHAR buf[16]; - formatRemText( hdc, nTilesLeft, dctx->scoreIsVertical, buf ); - measureText( dctx, buf, CE_REM_PADDING, width, height ); + if ( nTilesLeft > 0 ) { + formatRemText( hdc, nTilesLeft, dctx->scoreIsVertical, buf ); + measureText( dctx, buf, CE_REM_PADDING, width, height ); + } else { + *width = *height = 0; + } } /* ce_draw_measureRemText */ DLSTATIC void