X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/005f5d1878c1d344e79e3c43b2790332dcea68f3..ee3510132b8b4160f848bd4f502a6f5315f90dbc:/src/gtk1/bitmap.cpp diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index c60e094b35..94a89e1d5c 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -300,6 +300,8 @@ bool wxBitmap::Create( int width, int height, int depth ) bool wxBitmap::CreateFromXpm( const char **bits ) { + UnRef(); + wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") ) GdkVisual *visual = wxTheApp->GetGdkVisual(); @@ -327,6 +329,8 @@ bool wxBitmap::CreateFromXpm( const char **bits ) bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) { + UnRef(); + wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") ) wxCHECK_MSG( depth == -1 || depth == 1, FALSE, wxT("invalid bitmap depth") ) @@ -453,7 +457,11 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) // We handle 8-bit bitmaps ourselves using the colour cube, 12-bit // visuals are not supported by GDK so we do these ourselves, too. // 15-bit and 16-bit should actually work and 24-bit certainly does. +#ifdef __sgi + if (!image.HasMask() && (bpp > 16)) +#else if (!image.HasMask() && (bpp > 12)) +#endif { static bool s_hasInitialized = FALSE; @@ -506,7 +514,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) if (bpp > 8) { if ((visual->red_mask > visual->green_mask) && (visual->green_mask > visual->blue_mask)) b_o = RGB; - else if ((visual->red_mask > visual->blue_mask) && (visual->blue_mask > visual->green_mask)) b_o = RGB; + else if ((visual->red_mask > visual->blue_mask) && (visual->blue_mask > visual->green_mask)) b_o = RBG; else if ((visual->blue_mask > visual->red_mask) && (visual->red_mask > visual->green_mask)) b_o = BRG; else if ((visual->blue_mask > visual->green_mask) && (visual->green_mask > visual->red_mask)) b_o = BGR; else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask)) b_o = GRB;