X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..3f393e3dbdfb73b7d0500b5c67c6c38dedd0e82e:/src/msw/dib.cpp?ds=sidebyside diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 7340494bae..f5b86d7c2b 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -159,9 +159,9 @@ WORD wxPaletteSize(VOID FAR * pv) NumColors = DibNumColors(lpbi); if (lpbi->biSize == sizeof(BITMAPCOREHEADER)) - return NumColors * sizeof(RGBTRIPLE); + return (WORD)(NumColors * sizeof(RGBTRIPLE)); else - return NumColors * sizeof(RGBQUAD); + return (WORD)(NumColors * sizeof(RGBQUAD)); } /**************************************************************************** @@ -364,7 +364,7 @@ static DWORD PASCAL lread(int fh, void far *pv, DWORD ul) ul -= MAXREAD; hp += MAXREAD; } - if (_lread(fh, (LPSTR) hp, (WORD) ul) != (WORD) ul) + if (_lread(fh, (LPSTR) hp, (WXUINT) ul) != (WXUINT) ul) return 0; return ulT; } @@ -394,7 +394,7 @@ static DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul) ul -= MAXREAD; hp += MAXREAD; } - if (_lwrite(fh, (LPSTR) hp, (WORD) ul) != (WORD) ul) + if (_lwrite(fh, (LPSTR) hp, (WXUINT) ul) != (WXUINT) ul) return 0; return ulT; } @@ -528,7 +528,7 @@ BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) } /* offset to the bits from start of DIB header */ - offBits = (WORD)lpbi->biSize + nNumColors * sizeof(RGBQUAD); + offBits = (WORD)(lpbi->biSize + nNumColors * sizeof(RGBQUAD)); if (bf.bfOffBits != 0L) { @@ -619,6 +619,9 @@ static BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, result = TRUE; } } + + GlobalUnlock (hDIB); // glt + return(result); } @@ -665,7 +668,7 @@ HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo) lpRGB = (RGBQUAD FAR *)((LPSTR)lpInfo + lpInfo->biSize); /* copy colors from the color table to the LogPalette structure */ - for (i = 0; i < lpInfo->biClrUsed; i++, lpRGB++) + for (i = 0; (DWORD)i < lpInfo->biClrUsed; i++, lpRGB++) { npPal->palPalEntry[i].peRed = lpRGB->rgbRed; npPal->palPalEntry[i].peGreen = lpRGB->rgbGreen; @@ -705,12 +708,14 @@ bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal) if (hPalette) { +#if wxUSE_PALETTE if (pal) { *pal = new wxPalette; (*pal)->SetHPALETTE((WXHPALETTE) hPalette); } else +#endif // wxUSE_PALETTE DeleteObject(hPalette); } else if (pal) @@ -925,8 +930,10 @@ HANDLE wxBitmapToDIB (HBITMAP hBitmap, HPALETTE hPal) bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette *colourmap) { HPALETTE hPalette = 0; +#if wxUSE_PALETTE if (colourmap) hPalette = (HPALETTE) colourmap->GetHPALETTE(); +#endif // wxUSE_PALETTE HANDLE dibHandle = wxBitmapToDIB((HBITMAP) bitmap->GetHBITMAP(), hPalette); if (dibHandle) @@ -938,4 +945,3 @@ bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette *colourmap) else return FALSE; } -