From b623f5953691b2a0614e6f1f4def86bdbb9a4113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Aug 2020 11:53:00 +0200 Subject: New upstream version 5.2.0Beta2.1 --- app/wlib/mswlib/mswbitmap.c | 46 +++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'app/wlib/mswlib/mswbitmap.c') diff --git a/app/wlib/mswlib/mswbitmap.c b/app/wlib/mswlib/mswbitmap.c index e369e78..95b8a69 100644 --- a/app/wlib/mswlib/mswbitmap.c +++ b/app/wlib/mswlib/mswbitmap.c @@ -24,10 +24,12 @@ #include #include #include +#include #include #include #include #include +#include "misc.h" #include "mswint.h" #include "i18n.h" @@ -177,14 +179,15 @@ void mswDrawIcon( memset( bmiInfo->bmiColors, 0, bm->colorcnt * sizeof( RGBQUAD )); memset( &bmiInfo->bmiColors[ bm->transparent ], 0xFF, sizeof( RGBQUAD )); } + StretchDIBits(hDc, offw, offh, - bmiInfo->bmiHeader.biWidth, - bmiInfo->bmiHeader.biHeight, - 0, 0, - bmiInfo->bmiHeader.biWidth, - bmiInfo->bmiHeader.biHeight, - bm->pixels, bmiInfo, - DIB_RGB_COLORS, SRCAND); + (int)ceil(bmiInfo->bmiHeader.biWidth*scaleIcon), + (int)ceil(bmiInfo->bmiHeader.biHeight*scaleIcon), + 0, 0, + bmiInfo->bmiHeader.biWidth, + bmiInfo->bmiHeader.biHeight, + bm->pixels, bmiInfo, + DIB_RGB_COLORS, SRCAND); /* now paint the bitmap with transparent set to black */ if( bm->type == mswIcon_bitmap ) { @@ -221,16 +224,16 @@ void mswDrawIcon( } memset( &bmiInfo->bmiColors[ bm->transparent ], 0, sizeof( RGBQUAD )); } - + /* show the bitmap */ StretchDIBits(hDc, offw, offh, - bmiInfo->bmiHeader.biWidth, - bmiInfo->bmiHeader.biHeight, - 0, 0, - bmiInfo->bmiHeader.biWidth, - bmiInfo->bmiHeader.biHeight, - bm->pixels, bmiInfo, - DIB_RGB_COLORS, SRCPAINT); + (int)ceil(bmiInfo->bmiHeader.biWidth*scaleIcon), + (int)ceil(bmiInfo->bmiHeader.biHeight*scaleIcon), + 0, 0, + bmiInfo->bmiHeader.biWidth, + bmiInfo->bmiHeader.biHeight, + bm->pixels, bmiInfo, + DIB_RGB_COLORS, SRCPAINT); /* forget the data */ free( bmiInfo ); @@ -434,11 +437,14 @@ wIcon_p wIconCreatePixMap( char *pm[]) /* look up pixel info in color table */ k = 0; - while( pixel != keys[ k ] ) + while(k < col && pixel != keys[ k ] ) k++; - - /* save the index into color table */ - *(cq + j) = k; + if (pixel == keys[k]) { + /* save the index into color table */ + *(cq + j) = k; + } else { + *(cq + j) = 0; + } } } free( keys ); @@ -507,4 +513,4 @@ wBitmapCreate( wWin_p parent, wPos_t x, wPos_t y, long option, wIcon_p iconP ) control->data = iconP; return (wControl_p)control; -} \ No newline at end of file +} -- cgit v1.2.3