X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e5d4ef7410d597bdf6d426ceedc656dbefd69e90..d35dce3a2e3ca417093eaa192f1e9e54e55a22ba:/src/msw/dib.cpp diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 285fd9142e..a76592f9b0 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -69,7 +69,7 @@ static inline WORD GetNumberOfColours(WORD bitsPerPixel) { // only 1, 4 and 8bpp bitmaps use palettes (well, they could be used with // 24bpp ones too but we don't support this as I think it's quite uncommon) - return bitsPerPixel <= 8 ? 1 << bitsPerPixel : 0; + return (WORD)(bitsPerPixel <= 8 ? 1 << bitsPerPixel : 0); } // wrapper around ::GetObject() for DIB sections @@ -118,7 +118,7 @@ bool wxDIB::Create(int width, int height, int depth) info->bmiHeader.biHeight = height; info->bmiHeader.biPlanes = 1; - info->bmiHeader.biBitCount = depth; + info->bmiHeader.biBitCount = (WORD)depth; info->bmiHeader.biSizeImage = GetLineSize(width, depth)*height; m_handle = ::CreateDIBSection @@ -603,7 +603,7 @@ wxPalette *wxDIB::CreatePalette() const // initialize the palette header pPalette->palVersion = 0x300; // magic number, not in docs but works - pPalette->palNumEntries = biClrUsed; + pPalette->palNumEntries = (WORD)biClrUsed; // and the colour table (it starts right after the end of the header) const RGBQUAD *pRGB = (RGBQUAD *)((char *)&ds.dsBmih + ds.dsBmih.biSize); @@ -674,9 +674,9 @@ bool wxDIB::Create(const wxImage& image) // RGB order is reversed, and we need to premultiply // all channels by alpha value for use with ::AlphaBlend. const unsigned char a = *alpha++; - *dst++ = (src[2] * a + 127) / 255; - *dst++ = (src[1] * a + 127) / 255; - *dst++ = (src[0] * a + 127) / 255; + *dst++ = (unsigned char)((src[2] * a + 127) / 255); + *dst++ = (unsigned char)((src[1] * a + 127) / 255); + *dst++ = (unsigned char)((src[0] * a + 127) / 255); *dst++ = a; src += 3; }