summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswbitmap.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:12 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:12 +0200
commite50482f994b6ebcce864a412111d376e99205cdb (patch)
treeff3192c6aaf213c4922521bed988e4ed4147f537 /app/wlib/mswlib/mswbitmap.c
parentd3897ce090dbeb220ed2c782f095597e417cf3cc (diff)
parentb623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff)
Update upstream source from tag 'upstream/5.2.0Beta2.1'
Update to upstream version '5.2.0Beta2.1' with Debian dir 1576f25f4c1496abfed44af31ead67d32c7be650
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
+}