fixed bitmap constructor for monochrome bitmaps

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-04-21 12:35:02 +00:00
parent 7ddb3812fd
commit eefa26bed1
3 changed files with 35 additions and 12 deletions

View File

@@ -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") )
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();
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
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);
}