X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/62bd5cf059a04bf27edc80ae7437289d26faeffa..ea804aadf91c963d97a56e152d8372c9e689affe:/src/gtk1/bitmap.cpp diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 0a2da3f4e9..80ecdcddac 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -105,17 +105,27 @@ wxBitmap::wxBitmap() wxBitmap::wxBitmap( int width, int height, int depth ) { wxCHECK_RET( (width > 0) && (height > 0), _T("invalid bitmap size") ) - wxCHECK_RET( (depth > 0) || (depth == -1), _T("invalid bitmap depth") ) - - m_refData = new wxBitmapRefData(); - + GdkWindow *parent = (GdkWindow*) &gdk_root_parent; + if (depth == -1) depth = gdk_window_get_visual( parent )->depth; + + wxCHECK_RET( (depth == gdk_window_get_visual( parent )->depth) || + (depth == 1), _T("invalid bitmap depth") ) + m_refData = new wxBitmapRefData(); M_BMPDATA->m_mask = (wxMask *) NULL; - M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth ); M_BMPDATA->m_width = width; M_BMPDATA->m_height = height; - M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; + if (depth == 1) + { + M_BMPDATA->m_bitmap = gdk_pixmap_new( parent, width, height, 1 ); + M_BMPDATA->m_bpp = 1; + } + else + { + M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth ); + M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; + } if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); }