summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswbitmap.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2018-03-19 19:56:15 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2018-03-19 19:56:15 +0100
commit1542c122b3672fe83e027411ad2445772e2d0ed3 (patch)
treee535bc621bd7ffa9d5ce89e0d495df5d1c4ab6fd /app/wlib/mswlib/mswbitmap.c
parent773810e6583142d7d15263e6481c42aebed6d7f1 (diff)
parentd1a8285f818eb7e5c3d6a05709ea21a808490b8c (diff)
Update upstream source from tag 'upstream/5.1.0'
Update to upstream version '5.1.0' with Debian dir 93ca74b8b4602fce4c9c7740e0cfdde25f086673
Diffstat (limited to 'app/wlib/mswlib/mswbitmap.c')
-rw-r--r--app/wlib/mswlib/mswbitmap.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/app/wlib/mswlib/mswbitmap.c b/app/wlib/mswlib/mswbitmap.c
index 7371834..e369e78 100644
--- a/app/wlib/mswlib/mswbitmap.c
+++ b/app/wlib/mswlib/mswbitmap.c
@@ -144,7 +144,7 @@ void mswDrawIcon(
COLORREF col;
/* draw the bitmap by dynamically creating a Windows DIB in memory */
-
+ /* BITMAPINFO already has one RGBQUAD color struct, so only allocate the rest */
bmiInfo = malloc( sizeof( BITMAPINFO ) + (bm->colorcnt - 1) * sizeof( RGBQUAD ));
if( !bmiInfo ) {
fprintf( stderr, "could not allocate memory for bmiInfo\n" );
@@ -201,17 +201,19 @@ void mswDrawIcon(
if( disabled ) {
/* create a gray scale palette */
for( i = 0; i < bm->colorcnt; i ++ ) {
- byt = ( 30 * bm->colormap[ i ].rgbRed +
- 59 * bm->colormap[ i ].rgbGreen +
- 11 * bm->colormap[ i ].rgbBlue )/100;
-
- /* if totally black, use a dark gray */
- if( byt == 0 )
- byt = 0x66;
-
- bmiInfo->bmiColors[ i ].rgbRed = byt;
- bmiInfo->bmiColors[ i ].rgbGreen = byt;
- bmiInfo->bmiColors[ i ].rgbBlue = byt;
+ if (i != bm->transparent) {
+ byt = (30 * bm->colormap[i].rgbRed +
+ 59 * bm->colormap[i].rgbGreen +
+ 11 * bm->colormap[i].rgbBlue) / 100;
+
+ /* if totally black, use a dark gray */
+ if (byt == 0)
+ byt = 0x66;
+
+ bmiInfo->bmiColors[i].rgbRed = byt;
+ bmiInfo->bmiColors[i].rgbGreen = byt;
+ bmiInfo->bmiColors[i].rgbBlue = byt;
+ }
}
} else {
/* copy the palette */