mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
If smallest bitmap is too big, use it anyway at full size.
This commit is contained in:
parent
50a6f93b99
commit
52a4a92e14
1 changed files with 13 additions and 9 deletions
|
@ -705,26 +705,30 @@ makeAndDrawBitmap( CEDrawCtx* dctx, HDC hdc, const RECT* bnds,
|
||||||
XP_Bool cached;
|
XP_Bool cached;
|
||||||
XP_U16 index;
|
XP_U16 index;
|
||||||
RECT lrt = *bnds;
|
RECT lrt = *bnds;
|
||||||
|
XP_U16 useSize;
|
||||||
|
|
||||||
SIZE size;
|
SIZE size;
|
||||||
GetTextExtentPoint32( hdc, L"M", 1, &size );
|
GetTextExtentPoint32( hdc, L"M", 1, &size );
|
||||||
|
useSize = size.cx;
|
||||||
if ( center ) {
|
|
||||||
lrt.left += ((lrt.right - lrt.left) - size.cx) / 2;
|
|
||||||
lrt.top += ((lrt.bottom - lrt.top) - size.cx) / 2;
|
|
||||||
}
|
|
||||||
lrt.right = lrt.left + size.cx;
|
|
||||||
lrt.bottom = lrt.top + size.cx;
|
|
||||||
|
|
||||||
for ( index = bitmaps->nBitmaps - 1; ; --index ) {
|
for ( index = bitmaps->nBitmaps - 1; ; --index ) {
|
||||||
const CEBitmapInfo* info = (const CEBitmapInfo*)(bitmaps->bmps[index]);
|
const CEBitmapInfo* info = (const CEBitmapInfo*)(bitmaps->bmps[index]);
|
||||||
if ( index == 0 ) {
|
if ( info->nCols <= useSize && info->nRows <= useSize ) {
|
||||||
break;
|
break;
|
||||||
} else if ( info->nCols <= size.cx && info->nRows <= size.cx ) {
|
} else if ( index == 0 ) {
|
||||||
|
/* none fits */
|
||||||
|
useSize = XP_MAX( info->nCols, info->nRows );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( center ) {
|
||||||
|
lrt.left += ((lrt.right - lrt.left) - useSize) / 2;
|
||||||
|
lrt.top += ((lrt.bottom - lrt.top) - useSize) / 2;
|
||||||
|
}
|
||||||
|
lrt.right = lrt.left + useSize;
|
||||||
|
lrt.bottom = lrt.top + useSize;
|
||||||
|
|
||||||
HBITMAP bm = checkBMCache( dctx, hdc, letters, index, bitmaps, &cached );
|
HBITMAP bm = checkBMCache( dctx, hdc, letters, index, bitmaps, &cached );
|
||||||
|
|
||||||
ceDrawBitmapInRect( hdc, &lrt, bm, XP_TRUE );
|
ceDrawBitmapInRect( hdc, &lrt, bm, XP_TRUE );
|
||||||
|
|
Loading…
Add table
Reference in a new issue