X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e5d4ef7410d597bdf6d426ceedc656dbefd69e90..b9efe021b554fa3967d1442cf758435c5cd5ae8f:/src/msw/dib.cpp diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 285fd9142e..1a57decc31 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -48,10 +48,6 @@ #include #endif -#ifdef __GNUWIN32_OLD__ - #include "wx/msw/gnuwin32/extra.h" -#endif - #include "wx/image.h" #include "wx/msw/dib.h" @@ -69,7 +65,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 +114,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 +599,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 +670,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; }