X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9b72a74d94bca6303a65a3a13958461eb6c7290a..ee3510132b8b4160f848bd4f502a6f5315f90dbc:/src/gtk1/bitmap.cpp diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 4f5ad6a770..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") ) @@ -510,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;