diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:00 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:00 +0200 |
commit | b623f5953691b2a0614e6f1f4def86bdbb9a4113 (patch) | |
tree | 18102bd36f7e22eb2ba2b9f880e4cb29346f4cb8 /app/wlib/mswlib/mswbitmap.c | |
parent | 359b557176b9bb2ff1aed2082641eed39c358d0d (diff) |
New upstream version 5.2.0Beta2.1upstream/5.2.0Beta2.1
Diffstat (limited to 'app/wlib/mswlib/mswbitmap.c')
-rw-r--r-- | app/wlib/mswlib/mswbitmap.c | 46 |
1 files changed, 26 insertions, 20 deletions
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 <windows.h> #include <string.h> #include <malloc.h> +#include <math.h> #include <stdlib.h> #include <commdlg.h> #include <stdio.h> #include <assert.h> +#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 +} |