X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd21c82639bd7158fffdae4bf33280af8a767459..a766986f6d443ba1d50e3af25f3306fa56e4518e:/src/x11/bitmap.cpp diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index 3abc8df228..856f0288b8 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -227,7 +227,7 @@ bool wxMask::Create( const wxBitmap& bitmap ) // wxBitmap //----------------------------------------------------------------------------- -class wxBitmapRefData: public wxObjectRefData +class wxBitmapRefData : public wxGDIRefData { public: wxBitmapRefData(); @@ -237,6 +237,8 @@ public: // shouldn't be called more than once as it doesn't free the existing data bool Create(int width, int height, int depth); + virtual bool IsOk() const { return m_pixmap || m_bitmap; } + Pixmap m_pixmap; Pixmap m_bitmap; Display *m_display; @@ -430,12 +432,12 @@ wxBitmap::wxBitmap(const char* const* bits) Create(bits, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); } -wxObjectRefData *wxBitmap::CreateRefData() const +wxGDIRefData *wxBitmap::CreateGDIRefData() const { return new wxBitmapRefData; } -wxObjectRefData *wxBitmap::CloneRefData(const wxObjectRefData *data) const +wxGDIRefData *wxBitmap::CloneGDIRefData(const wxGDIRefData *data) const { return new wxBitmapRefData(*wx_static_cast(const wxBitmapRefData *, data)); } @@ -593,10 +595,11 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) M_BMPDATA->m_pixmap = XCreatePixmap( xdisplay, xroot, width, height, depth ); - // Create mask + // Create mask if necessary + const bool hasMask = image.HasMask(); XImage *mask_image = (XImage*) NULL; - if (image.HasMask()) + if ( hasMask ) { mask_image = XCreateImage( xdisplay, xvisual, 1, ZPixmap, 0, 0, width, height, 32, 0 ); mask_image->data = (char*) malloc( mask_image->bytes_per_line * mask_image->height ); @@ -646,8 +649,6 @@ bool wxBitmap::CreateFromImage( const wxImage& image, int depth ) unsigned char *colorCube = wxTheApp->GetVisualInfo(M_BMPDATA->m_display)->m_colorCube; - bool hasMask = image.HasMask(); - int index = 0; for (int y = 0; y < height; y++) { @@ -935,11 +936,6 @@ wxBitmap::~wxBitmap() { } -bool wxBitmap::IsOk() const -{ - return (m_refData != NULL); -} - int wxBitmap::GetHeight() const { wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") ); @@ -1360,7 +1356,7 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, Pixmap mask = 0; int ErrorStatus = XpmReadFileToPixmap( xdisplay, xroot, - (char*) name.c_str(), + (char*) ((const char*) name.c_str()), &pixmap, &mask, &xpmAttr); if (ErrorStatus == XpmSuccess) @@ -1372,7 +1368,7 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, XpmFreeAttributes(&xpmAttr); - M_BMPHANDLERDATA->m_bitmap = (WXPixmap) pixmap; + M_BMPHANDLERDATA->m_bitmap = (Pixmap) pixmap; if (mask) { @@ -1497,7 +1493,7 @@ bool wxXPMDataHandler::Create(wxBitmap *bitmap, const void* bits, XpmFreeAttributes(&xpmAttr); - M_BMPHANDLERDATA->m_pixmap = (WXPixmap) pixmap; + M_BMPHANDLERDATA->m_pixmap = (Pixmap) pixmap; if (mask) {