X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e691f46b2ec1b5dbbff2e51131e3c532e688a89..d3734d65e66f0b8c7a7aafcbdba922e0f0516d62:/src/gtk1/bitmap.cpp diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 0a27495252..033071565e 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -33,10 +33,7 @@ #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 + #include #endif // GTK+ 2.0/1.2 extern void gdk_wx_draw_bitmap (GdkDrawable *drawable, @@ -99,7 +96,7 @@ bool wxMask::Create( const wxBitmap& bitmap, m_bitmap = (GdkBitmap*) NULL; } - wxImage image( bitmap ); + wxImage image = bitmap.ConvertToImage(); if (!image.Ok()) return FALSE; m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, image.GetWidth(), image.GetHeight(), 1 ); @@ -331,8 +328,8 @@ bool wxBitmap::CreateFromXpm( const char **bits ) } gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); - - M_BMPDATA->m_bpp = visual->depth; // ? + + M_BMPDATA->m_bpp = visual->depth; // Can we get a different depth from create_from_xpm_d() ? return TRUE; } @@ -360,7 +357,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) SetBitmap( gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 ) ); SetDepth( 1 ); - + GdkVisual *visual = wxTheApp->GetGdkVisual(); // Create picture image @@ -460,7 +457,7 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) int bpp = visual->depth; SetDepth( bpp ); - + if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15; if (bpp < 8) bpp = 8; @@ -705,7 +702,7 @@ wxImage wxBitmap::ConvertToImage() const image.Create( GetWidth(), GetHeight() ); char unsigned *data = image.GetData(); - + if (!data) { gdk_image_destroy( gdk_image ); @@ -817,6 +814,7 @@ wxImage wxBitmap::ConvertToImage() const } wxBitmap::wxBitmap( const wxBitmap& bmp ) + : wxGDIObject() { Ref( bmp ); } @@ -954,7 +952,7 @@ bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(pal // Try to save the bitmap via wxImage handlers: { - wxImage image( *this ); + wxImage image = ConvertToImage(); if (image.Ok()) return image.SaveFile( name, type ); } @@ -991,7 +989,8 @@ bool wxBitmap::LoadFile( const wxString &name, int type ) { wxImage image; if (!image.LoadFile( name, type )) return FALSE; - if (image.Ok()) *this = image.ConvertToBitmap(); + if (image.Ok()) + *this = wxBitmap(image); else return FALSE; }