Consistently refuse to create bitmaps with 0 width or height.
Homogenize the behaviour of all ports when creating bitmaps with 0 width or height: just fail always as it doesn't seem to make sense to support this. Closes #16828. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78434 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -21,6 +21,9 @@ Changes in behaviour not resulting in compilation errors
|
||||
other ports, but this can be unexpected for the applications not expecting
|
||||
their idle handlers to be called from inside wxYield().
|
||||
|
||||
- Creating wxBitmap with 0 width or height now always fails in all ports
|
||||
(it used to succeed in wxMSW).
|
||||
|
||||
Changes in behaviour which may result in build errors
|
||||
-----------------------------------------------------
|
||||
|
||||
|
@@ -291,9 +291,16 @@ public:
|
||||
the current colour setting.
|
||||
|
||||
A depth of 32 including an alpha channel is supported under MSW, Mac and GTK+.
|
||||
|
||||
@param width
|
||||
The width of the bitmap in pixels, must be strictly positive.
|
||||
@param height
|
||||
The height of the bitmap in pixels, must be strictly positive.
|
||||
@param depth
|
||||
The number of bits used to represent each bitmap pixel.
|
||||
*/
|
||||
wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
|
||||
|
||||
|
||||
/**
|
||||
@overload
|
||||
*/
|
||||
@@ -413,11 +420,18 @@ public:
|
||||
/**
|
||||
Creates a fresh bitmap.
|
||||
If the final argument is omitted, the display depth of the screen is used.
|
||||
|
||||
|
||||
@param width
|
||||
The width of the bitmap in pixels, must be strictly positive.
|
||||
@param height
|
||||
The height of the bitmap in pixels, must be strictly positive.
|
||||
@param depth
|
||||
The number of bits used to represent each bitmap pixel.
|
||||
|
||||
@return @true if the creation was successful.
|
||||
*/
|
||||
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
|
||||
|
||||
|
||||
/**
|
||||
@overload
|
||||
*/
|
||||
|
@@ -536,7 +536,7 @@ wxBitmap::~wxBitmap()
|
||||
bool wxBitmap::Create( int width, int height, int depth )
|
||||
{
|
||||
UnRef();
|
||||
wxCHECK_MSG(width >= 0 && height >= 0, false, "invalid bitmap size");
|
||||
wxCHECK_MSG(width > 0 && height > 0, false, "invalid bitmap size");
|
||||
m_refData = new wxBitmapRefData(width, height, depth);
|
||||
return true;
|
||||
}
|
||||
|
@@ -755,6 +755,8 @@ bool wxBitmap::DoCreate(int w, int h, int d, WXHDC hdc)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
wxCHECK_MSG( w > 0 && h > 0, false, wxT("invalid bitmap size") );
|
||||
|
||||
m_refData = new wxBitmapRefData;
|
||||
|
||||
GetBitmapData()->m_width = w;
|
||||
|
@@ -1191,6 +1191,8 @@ bool wxBitmap::Create(int w, int h, int d)
|
||||
{
|
||||
UnRef();
|
||||
|
||||
wxCHECK_MSG(w > 0 && h > 0, false, "invalid bitmap size");
|
||||
|
||||
if ( d < 0 )
|
||||
d = wxDisplayDepth() ;
|
||||
|
||||
|
Reference in New Issue
Block a user