# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1351604879 0 # Node ID e0df1916b054ba067f3e6ae820e0e5d32d36bfb8 # Parent 04c74cd0fb354ef5361a02ec1cd2f4002a1a2ff3 Added code to query the control background color on OS/2 when loading images so if they contain an alpha channel they get loaded with the correct background color. If no color is set use DW_CLR_PALEGRAY for now since that is the default. diff -r 04c74cd0fb35 -r e0df1916b054 os2/dw.c --- a/os2/dw.c Mon Oct 29 17:42:44 2012 +0000 +++ b/os2/dw.c Tue Oct 30 13:47:59 2012 +0000 @@ -65,7 +65,7 @@ MRESULT EXPENTRY _scrollwndproc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2); void _do_resize(Box *thisbox, int x, int y); void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y); -int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth); +int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth, unsigned long backrgb); void _free_menu_data(HWND menu); BOOL (API_FUNC _WinQueryDesktopWorkArea)(HWND hwndDesktop, PWRECT pwrcWorkArea) = 0; /* PMPrintf support for dw_debug() */ @@ -6728,7 +6728,7 @@ if(stricmp(file + len - 4, ".ico") == 0) icon = WinLoadFileIcon((PSZ)file, FALSE); else - _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth); + _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT); } } else @@ -6744,7 +6744,7 @@ strcpy(file, filename); strcat(file, image_exts[z]); if(access(file, 04) == 0 && - _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth)) + _load_bitmap_file(file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) break; } } @@ -6816,7 +6816,7 @@ { fwrite( data, 1, len, fp ); fclose( fp ); - if(!_load_bitmap_file( file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth)) + if(!_load_bitmap_file( file, tmp, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) { icon = WinLoadFileIcon((PSZ)file, FALSE); } @@ -7073,7 +7073,7 @@ /* Internal function to load a bitmap from a file and return handles * to the bitmap, presentation space etc. */ -int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth) +int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height, int *depth, unsigned long backrgb) { PBITMAPINFOHEADER2 pBitmapInfoHeader; /* pointer to the first byte of bitmap data */ @@ -7105,8 +7105,27 @@ for(z=0;zhbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth)) + _load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, DW_CLR_DEFAULT)) { icon = _create_icon(src); break; } } } - else if(_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth)) + else if(_load_bitmap_file(file, hwndApp, &src->hbm, &src->hdc, &src->hps, &src->width, &src->height, &src->depth, DW_CLR_DEFAULT)) icon = _create_icon(src); /* Free temporary resources if in use */ if(icon) @@ -10949,7 +10968,7 @@ strcpy(file, filename); strcat(file, image_exts[z]); if(access(file, 04) == 0 && - _load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth)) + _load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) break; } } @@ -10995,7 +11014,7 @@ { fwrite( data, 1, len, fp ); fclose( fp ); - if(!_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth)) + if(!_load_bitmap_file(file, handle, &pixmap->hbm, &pixmap->hdc, &pixmap->hps, &pixmap->width, &pixmap->height, &pixmap->depth, DW_CLR_DEFAULT)) { /* can't use ICO ? */ unlink( file );