Ensure bitmap image exists while querying for a row stride
Obtaining bytes per row makes sense only for bitmap image representation so we have to ensure that the bitmap represenation exists before querying for its row stride length. NSImage per se cannot provide this information. Closes #18606.
This commit is contained in:
@@ -324,14 +324,14 @@ int wxBitmapRefData::GetDepth() const
|
||||
else
|
||||
return 32; // a bitmap converted from an nsimage would have this depth
|
||||
}
|
||||
|
||||
int wxBitmapRefData::GetBytesPerRow() const
|
||||
{
|
||||
wxCHECK_MSG( IsOk() , 0 , "Invalid Bitmap");
|
||||
|
||||
if ( m_hBitmap )
|
||||
return (int) CGBitmapContextGetBytesPerRow(m_hBitmap);
|
||||
else
|
||||
return (int) GetBestBytesPerRow( GetWidth() * 4);
|
||||
// Row stride length makes sense only for a bitmap representation
|
||||
EnsureBitmapExists();
|
||||
return (int) CGBitmapContextGetBytesPerRow(m_hBitmap);
|
||||
}
|
||||
|
||||
bool wxBitmapRefData::HasAlpha() const
|
||||
|
Reference in New Issue
Block a user