Oops, I didn't see Robert had already corrected 16bit BMP typo
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
837904f262
commit
c7abc967cd
@ -630,28 +630,28 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
int height = (int)dbuf[1];
|
||||
if (width > 32767)
|
||||
{
|
||||
wxLogError( _T("Image width > 32767 pixels for file\n") );
|
||||
wxLogError( _T("Image width > 32767 pixels for file.") );
|
||||
return FALSE;
|
||||
}
|
||||
if (height > 32767)
|
||||
{
|
||||
wxLogError( _T("Image height > 32767 pixels for file\n") );
|
||||
wxLogError( _T("Image height > 32767 pixels for file.") );
|
||||
return FALSE;
|
||||
}
|
||||
stream.Read(&word, 2);
|
||||
planes = (int)word;
|
||||
stream.Read(&word, 2);
|
||||
bpp = (int)word;
|
||||
if (bpp!=1 && bpp!=4 && bpp!=8 && bpp !=16 && bpp!=24 && bpp!=32)
|
||||
if (bpp != 1 && bpp != 4 && bpp != 8 && bpp != 16 && bpp != 24 && bpp != 32)
|
||||
{
|
||||
wxLogError( _T("unknown bitdepth in file\n") );
|
||||
wxLogError( _T("unknown bitdepth in file.") );
|
||||
return FALSE;
|
||||
}
|
||||
stream.Read(dbuf, 4 * 4);
|
||||
comp = (int)dbuf[0];
|
||||
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
|
||||
{
|
||||
wxLogError( _T("unknown encoding in Windows BMP file\n") );
|
||||
wxLogError( _T("unknown encoding in Windows BMP file.") );
|
||||
return FALSE;
|
||||
}
|
||||
stream.Read(dbuf, 4 * 2);
|
||||
@ -661,7 +661,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
/* some more sanity checks */
|
||||
if (((comp == BI_RLE4) && (bpp != 4)) || ((comp == BI_RLE8) && (bpp != 8)) || ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
|
||||
{
|
||||
wxLogError( _T("encoding of BMP doesn't match bitdepth\n") );
|
||||
wxLogError( _T("encoding of BMP doesn't match bitdepth.") );
|
||||
return FALSE;
|
||||
}
|
||||
if (bpp < 16)
|
||||
@ -670,7 +670,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
|
||||
if (!cmap)
|
||||
{
|
||||
wxLogError( _T("Cannot allocate RAM for color map in BMP file\n") );
|
||||
wxLogError( _T("Cannot allocate RAM for color map in BMP file.") );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -681,7 +681,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
ptr = image->GetData();
|
||||
if (!ptr)
|
||||
{
|
||||
wxLogError( _T("Cannot allocate RAM for RGB data in file\n") );
|
||||
wxLogError( _T("Cannot allocate RAM for RGB data in file.") );
|
||||
if (cmap)
|
||||
free(cmap);
|
||||
return FALSE;
|
||||
@ -795,7 +795,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
||||
{
|
||||
if (comp == BI_RLE4)
|
||||
{
|
||||
wxLogError( _T("can't deal with 4bit encoded yet.\n") );
|
||||
wxLogError( _T("can't deal with 4bit encoded yet.") );
|
||||
image->Destroy();
|
||||
free(cmap);
|
||||
return FALSE;
|
||||
@ -1636,11 +1636,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
||||
|
||||
vi = XGetVisualInfo( dpy, VisualIDMask|VisualDepthMask, &vinfo_template, &nitem );
|
||||
|
||||
if (!vi)
|
||||
{
|
||||
printf("no visual.\n" );
|
||||
return wxNullBitmap;
|
||||
}
|
||||
wxCHECK_MSG( vi, wxNullBitmap, _T("no visual") );
|
||||
|
||||
XFree( vi );
|
||||
|
||||
@ -1839,11 +1835,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
||||
|
||||
vi = XGetVisualInfo( dpy, VisualIDMask|VisualDepthMask, &vinfo_template, &nitem );
|
||||
|
||||
if (!vi)
|
||||
{
|
||||
printf("no visual.\n" );
|
||||
return;
|
||||
}
|
||||
wxCHECK_MSG( vi, wxNullBitmap, _T("no visual") );
|
||||
|
||||
if ((bpp == 16) && (vi->red_mask != 0xf800)) bpp = 15;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user