X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/005f5d1878c1d344e79e3c43b2790332dcea68f3..999c13cc6540e85956fcd6d5d145c907ebeb5393:/src/gtk/bitmap.cpp diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index c60e094b35..0a27495252 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -21,13 +21,23 @@ #include "wx/dcmemory.h" #include "wx/app.h" +#ifdef __WXGTK20__ + // need this to get gdk_image_new_bitmap() + #define GDK_ENABLE_BROKEN +#endif + #include #include #include -#if (GTK_MINOR_VERSION > 0) -#include -#endif +#ifdef __WXGTK20__ + #include +#else // GTK+ 1.2 + // VZ: is this still needed? seems to compile fine without it... + #if (GTK_MINOR_VERSION > 0) + #include + #endif +#endif // GTK+ 2.0/1.2 extern void gdk_wx_draw_bitmap (GdkDrawable *drawable, GdkGC *gc, @@ -300,6 +310,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 +339,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 +467,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 +524,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;