wxImage::Create() should be bool, not void

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20578 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-05-11 00:59:42 +00:00
parent d9ef4e06ed
commit aaa9782834
2 changed files with 23 additions and 24 deletions

View File

@ -162,8 +162,8 @@ public:
#endif
#endif
void Create( int width, int height, bool clear = true );
void Create( int width, int height, unsigned char* data, bool static_data = FALSE );
bool Create( int width, int height, bool clear = true );
bool Create( int width, int height, unsigned char* data, bool static_data = FALSE );
void Destroy();
// creates an identical copy of the image (the = operator

View File

@ -156,45 +156,44 @@ wxImage::wxImage( const wxImage* image )
if (image) Ref(*image);
}
void wxImage::Create( int width, int height, bool clear )
bool wxImage::Create( int width, int height, bool clear )
{
UnRef();
m_refData = new wxImageRefData();
M_IMGDATA->m_data = (unsigned char *) malloc( width*height*3 );
if (M_IMGDATA->m_data)
{
if (clear) memset(M_IMGDATA->m_data, 0, width*height*3);
M_IMGDATA->m_width = width;
M_IMGDATA->m_height = height;
M_IMGDATA->m_ok = TRUE;
}
else
if (!M_IMGDATA->m_data)
{
UnRef();
return FALSE;
}
if (clear)
memset(M_IMGDATA->m_data, 0, width*height*3);
M_IMGDATA->m_width = width;
M_IMGDATA->m_height = height;
M_IMGDATA->m_ok = TRUE;
return TRUE;
}
void wxImage::Create( int width, int height, unsigned char* data, bool static_data )
bool wxImage::Create( int width, int height, unsigned char* data, bool static_data )
{
UnRef();
wxCHECK_MSG( data, FALSE, _T("NULL data in wxImage::Create") );
m_refData = new wxImageRefData();
M_IMGDATA->m_data = data;
if (M_IMGDATA->m_data)
{
M_IMGDATA->m_width = width;
M_IMGDATA->m_height = height;
M_IMGDATA->m_ok = TRUE;
M_IMGDATA->m_static = static_data;
}
else
{
UnRef();
}
M_IMGDATA->m_width = width;
M_IMGDATA->m_height = height;
M_IMGDATA->m_ok = TRUE;
M_IMGDATA->m_static = static_data;
return TRUE;
}
void wxImage::Destroy()