diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-24 21:26:53 +0200 |
commit | df247efec654e512242e4f4f1b0212034f9e01fe (patch) | |
tree | 25c02e16957f3aa613af30c140fd8e8a3d52fda6 /app/wlib/mswlib/mswbitmap.c | |
parent | d0b6a8a4ec298024f14f704f9e40a6f9d324ccf3 (diff) | |
parent | a5ade52caa489cf0a713e0f02b764000d203140e (diff) |
Merge branch 'release/debian/1%5.2.0Beta2.1-1' into masterdebian/1%5.2.0Beta2.1-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 +} |