X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e90c1d2a19361551eb07778280f22be3e759cf64..df4ac4c7e93cfc6a6253331285c0f8a50b0e22b2:/src/msw/dibutils.cpp diff --git a/src/msw/dibutils.cpp b/src/msw/dibutils.cpp index cd99d6f028..ff95213838 100644 --- a/src/msw/dibutils.cpp +++ b/src/msw/dibutils.cpp @@ -33,7 +33,9 @@ #include "wx/msw/dibutils.h" #ifdef __WXWINE__ - #include +/* Why module.h? No longer finds this header. + #include +*/ #endif #if defined(__WIN32__) @@ -78,7 +80,7 @@ /* - * Clear the System Palette so that we can ensure an identity palette + * Clear the System Palette so that we can ensure an identity palette * mapping for fast performance. */ @@ -102,7 +104,7 @@ void wxClearSystemPalette(void) UINT nMapped = 0; BOOL bOK = FALSE; int nOK = 0; - + // *** Reset everything in the system palette to black for(Counter = 0; Counter < 256; Counter++) { @@ -162,26 +164,25 @@ int wxDibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi) // write file header BITMAPFILEHEADER bmf; - bmf.bfType = 'BM'; + bmf.bfType = BFT_BITMAP; bmf.bfSize = sizeof(bmf) + size; bmf.bfReserved1 = 0; bmf.bfReserved2 = 0; bmf.bfOffBits = sizeof(bmf) + (char FAR*)(wxDibPtr(lpbi)) - (char FAR*)lpbi; -#if defined( __WATCOMC__) || defined(__VISUALC__) || defined(__SC__) || defined(__SALFORDC__) || defined(__MWERKS__) || defined(wxUSE_NORLANDER_HEADERS) - if (_hwrite(fh, (LPCSTR)(&bmf), sizeof(bmf))<0 || - _hwrite(fh, (LPCSTR)lpbi, size)<0) { - _lclose(fh); -// printf("la regamos1"); - return 0; - } -#else - if (_hwrite(fh, (LPBYTE)(&bmf), sizeof(bmf))<0 || - _hwrite(fh, (LPBYTE)lpbi, size)<0) { +#if 1 // defined( __WATCOMC__) || defined(__VISUALC__) || defined(__SC__) || defined(__SALFORDC__) || defined(__MWERKS__) || wxUSE_NORLANDER_HEADERS + #define HWRITE_2ND_ARG_TYPE LPCSTR +#else // don't know who needs this... + #define HWRITE_2ND_ARG_TYPE LPBYTE +#endif + + if ( _hwrite(fh, (HWRITE_2ND_ARG_TYPE)(&bmf), sizeof(bmf)) < 0 || + _hwrite(fh, (HWRITE_2ND_ARG_TYPE)lpbi, size) < 0 ) + { _lclose(fh); -// printf("la regamos1"); return 0; } -#endif + +#undef HWRITE_2ND_ARG_TYPE _lclose(fh); return 1; @@ -294,7 +295,7 @@ PDIB wxDibReadBitmapInfo(HFILE fh) off = _llseek(fh,0L,SEEK_CUR); if (sizeof(bf) != _lread(fh,(LPSTR)&bf,sizeof(bf))) - return FALSE; + return NULL; /* * do we have a RC HEADER? @@ -306,7 +307,7 @@ PDIB wxDibReadBitmapInfo(HFILE fh) } if (sizeof(bi) != _lread(fh,(LPSTR)&bi,sizeof(bi))) - return FALSE; + return NULL; /* * what type of bitmap info is this? @@ -322,8 +323,8 @@ PDIB wxDibReadBitmapInfo(HFILE fh) bi.biSize = sizeof(BITMAPINFOHEADER); bi.biWidth = (DWORD)bc.bcWidth; bi.biHeight = (DWORD)bc.bcHeight; - bi.biPlanes = (UINT)bc.bcPlanes; - bi.biBitCount = (UINT)bc.bcBitCount; + bi.biPlanes = (WORD)bc.bcPlanes; + bi.biBitCount = (WORD)bc.bcBitCount; bi.biCompression = BI_RGB; bi.biSizeImage = 0; bi.biXPelsPerMeter = 0; @@ -417,7 +418,7 @@ BOOL wxDibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage) return FALSE; nColors = wxDibNumColors(pdib); - + if (nColors == 3 && wxDibCompression(pdib) == BI_BITFIELDS) nColors = 0; @@ -550,7 +551,7 @@ static void xlatClut4(BYTE FAR *pb, DWORD dwSize, BYTE FAR *xlat) #define RLE_EOF 1 #define RLE_JMP 2 -static void xlatRle8(BYTE FAR *pb, DWORD dwSize, BYTE FAR *xlat) +static void xlatRle8(BYTE FAR *pb, DWORD WXUNUSED(dwSize), BYTE FAR *xlat) { BYTE cnt; BYTE b; @@ -596,7 +597,7 @@ static void xlatRle8(BYTE FAR *pb, DWORD dwSize, BYTE FAR *xlat) } } -static void xlatRle4(BYTE FAR *pb, DWORD dwSize, BYTE FAR *xlat) +static void xlatRle4(BYTE FAR *WXUNUSED(pb), DWORD WXUNUSED(dwSize), BYTE FAR *WXUNUSED(xlat)) { } @@ -709,7 +710,7 @@ HPALETTE wxMakePalette(const BITMAPINFO FAR* Info, UINT flags) HPALETTE hPalette; const RGBQUAD FAR* rgb = Info->bmiColors; - WORD nColors = Info->bmiHeader.biClrUsed; + WORD nColors = (WORD)Info->bmiHeader.biClrUsed; if (nColors) { LOGPALETTE* logPal = (LOGPALETTE*) new BYTE[sizeof(LOGPALETTE) + (nColors-1)*sizeof(PALETTEENTRY)];