summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswbitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/wlib/mswlib/mswbitmap.c')
-rw-r--r--app/wlib/mswlib/mswbitmap.c46
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
+}