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:
@@ -162,8 +162,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Create( int width, int height, bool clear = true );
|
bool 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, unsigned char* data, bool static_data = FALSE );
|
||||||
void Destroy();
|
void Destroy();
|
||||||
|
|
||||||
// creates an identical copy of the image (the = operator
|
// creates an identical copy of the image (the = operator
|
||||||
|
@@ -156,45 +156,44 @@ wxImage::wxImage( const wxImage* image )
|
|||||||
if (image) Ref(*image);
|
if (image) Ref(*image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxImage::Create( int width, int height, bool clear )
|
bool wxImage::Create( int width, int height, bool clear )
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxImageRefData();
|
m_refData = new wxImageRefData();
|
||||||
|
|
||||||
M_IMGDATA->m_data = (unsigned char *) malloc( width*height*3 );
|
M_IMGDATA->m_data = (unsigned char *) malloc( width*height*3 );
|
||||||
if (M_IMGDATA->m_data)
|
if (!M_IMGDATA->m_data)
|
||||||
{
|
{
|
||||||
if (clear) memset(M_IMGDATA->m_data, 0, width*height*3);
|
UnRef();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clear)
|
||||||
|
memset(M_IMGDATA->m_data, 0, width*height*3);
|
||||||
|
|
||||||
M_IMGDATA->m_width = width;
|
M_IMGDATA->m_width = width;
|
||||||
M_IMGDATA->m_height = height;
|
M_IMGDATA->m_height = height;
|
||||||
M_IMGDATA->m_ok = TRUE;
|
M_IMGDATA->m_ok = TRUE;
|
||||||
}
|
|
||||||
else
|
return TRUE;
|
||||||
{
|
|
||||||
UnRef();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
UnRef();
|
||||||
|
|
||||||
|
wxCHECK_MSG( data, FALSE, _T("NULL data in wxImage::Create") );
|
||||||
|
|
||||||
m_refData = new wxImageRefData();
|
m_refData = new wxImageRefData();
|
||||||
|
|
||||||
M_IMGDATA->m_data = data;
|
M_IMGDATA->m_data = data;
|
||||||
if (M_IMGDATA->m_data)
|
|
||||||
{
|
|
||||||
M_IMGDATA->m_width = width;
|
M_IMGDATA->m_width = width;
|
||||||
M_IMGDATA->m_height = height;
|
M_IMGDATA->m_height = height;
|
||||||
M_IMGDATA->m_ok = TRUE;
|
M_IMGDATA->m_ok = TRUE;
|
||||||
M_IMGDATA->m_static = static_data;
|
M_IMGDATA->m_static = static_data;
|
||||||
}
|
|
||||||
else
|
return TRUE;
|
||||||
{
|
|
||||||
UnRef();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxImage::Destroy()
|
void wxImage::Destroy()
|
||||||
|
Reference in New Issue
Block a user