From da3ef5ab6bac4726a0c319f3d0b4986f3df677a5 Mon Sep 17 00:00:00 2001 From: ehouse Date: Thu, 6 May 2004 04:11:04 +0000 Subject: [PATCH] fix hires scoreboard drawing --- palm/palmdraw.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/palm/palmdraw.c b/palm/palmdraw.c index 1bc3c5ee8..4271fd0e6 100644 --- a/palm/palmdraw.c +++ b/palm/palmdraw.c @@ -681,6 +681,11 @@ palmMeasureDrawText( PalmDrawCtx* dctx, XP_Rect* bounds, XP_UCHAR* txt, if ( vertical && isTurn ) { height += 5; /* for the horizontal bars */ } +#ifdef FEATURE_HIGHRES + if ( dctx->doHiRes ) { + height *= 2; + } +#endif XP_ASSERT( height <= bounds->height ); XP_ASSERT( maxWidth <= bounds->width ); @@ -1009,7 +1014,20 @@ splitString( XP_UCHAR* str, XP_U16* nBufsP, XP_UCHAR** bufs ) } /* splitString */ #define VALUE_HINT_RECT_HEIGHT 12 -#define VALUE_HINT_RECT_HEIGHT_HR 29 +#define VALUE_HINT_RECT_HEIGHT_HR 24 +static XP_U16 +getMiniLineHt( PalmDrawCtx* dctx ) +{ + if ( 0 ) { +#ifdef FEATURE_HIGHRES + } else if ( dctx->doHiRes ) { + return VALUE_HINT_RECT_HEIGHT_HR; +#endif + } else { + return VALUE_HINT_RECT_HEIGHT; + } +} /* getMiniLineHt */ + static void palm_draw_measureMiniWText( DrawCtx* p_dctx, unsigned char* str, XP_U16* widthP, XP_U16* heightP ) @@ -1030,20 +1048,11 @@ palm_draw_measureMiniWText( DrawCtx* p_dctx, unsigned char* str, XP_STRLEN(bufs[i]) ); maxWidth = XP_MAX( maxWidth, oneWidth ); - height += VALUE_HINT_RECT_HEIGHT; + height += getMiniLineHt((PalmDrawCtx*)p_dctx); } *widthP = maxWidth; - *heightP = height + 2; - -/* if ( 0 ) { */ -/* #ifdef FEATURE_HIGHRES */ -/* } else if ( ((PalmDrawCtx*)p_dctx)->doHiRes ) { */ -/* *heightP = VALUE_HINT_RECT_HEIGHT_HR; */ -/* #endif */ -/* } else { */ -/* *heightP = VALUE_HINT_RECT_HEIGHT; */ -/* } */ + *heightP = height + 3; HIGHRES_POP_LOC( (PalmDrawCtx*)p_dctx ); } /* palm_draw_measureMiniWText */ @@ -1107,7 +1116,7 @@ palm_draw_drawMiniWindow( DrawCtx* p_dctx, unsigned char* text, WinDrawChars( (const char*)txt, len, localR.topLeft.x + ((localR.extent.x-width)/2), localR.topLeft.y + 1 + offset ); - offset += VALUE_HINT_RECT_HEIGHT; + offset += getMiniLineHt( dctx ); } HIGHRES_POP_LOC( dctx );