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:
@@ -630,28 +630,28 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
int height = (int)dbuf[1];
|
int height = (int)dbuf[1];
|
||||||
if (width > 32767)
|
if (width > 32767)
|
||||||
{
|
{
|
||||||
wxLogError( _T("Image width > 32767 pixels for file\n") );
|
wxLogError( _T("Image width > 32767 pixels for file.") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (height > 32767)
|
if (height > 32767)
|
||||||
{
|
{
|
||||||
wxLogError( _T("Image height > 32767 pixels for file\n") );
|
wxLogError( _T("Image height > 32767 pixels for file.") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
stream.Read(&word, 2);
|
stream.Read(&word, 2);
|
||||||
planes = (int)word;
|
planes = (int)word;
|
||||||
stream.Read(&word, 2);
|
stream.Read(&word, 2);
|
||||||
bpp = (int)word;
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
stream.Read(dbuf, 4 * 4);
|
stream.Read(dbuf, 4 * 4);
|
||||||
comp = (int)dbuf[0];
|
comp = (int)dbuf[0];
|
||||||
if (comp != BI_RGB && comp != BI_RLE4 && comp != BI_RLE8 && comp != BI_BITFIELDS)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
stream.Read(dbuf, 4 * 2);
|
stream.Read(dbuf, 4 * 2);
|
||||||
@@ -661,7 +661,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
/* some more sanity checks */
|
/* some more sanity checks */
|
||||||
if (((comp == BI_RLE4) && (bpp != 4)) || ((comp == BI_RLE8) && (bpp != 8)) || ((comp == BI_BITFIELDS) && (bpp != 16 && bpp != 32)))
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (bpp < 16)
|
if (bpp < 16)
|
||||||
@@ -670,7 +670,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
|
|
||||||
if (!cmap)
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -681,7 +681,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
ptr = image->GetData();
|
ptr = image->GetData();
|
||||||
if (!ptr)
|
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)
|
if (cmap)
|
||||||
free(cmap);
|
free(cmap);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -795,7 +795,7 @@ bool wxBMPHandler::LoadFile( wxImage *image, wxInputStream& stream )
|
|||||||
{
|
{
|
||||||
if (comp == BI_RLE4)
|
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();
|
image->Destroy();
|
||||||
free(cmap);
|
free(cmap);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -1636,11 +1636,7 @@ wxBitmap wxImage::ConvertToBitmap() const
|
|||||||
|
|
||||||
vi = XGetVisualInfo( dpy, VisualIDMask|VisualDepthMask, &vinfo_template, &nitem );
|
vi = XGetVisualInfo( dpy, VisualIDMask|VisualDepthMask, &vinfo_template, &nitem );
|
||||||
|
|
||||||
if (!vi)
|
wxCHECK_MSG( vi, wxNullBitmap, _T("no visual") );
|
||||||
{
|
|
||||||
printf("no visual.\n" );
|
|
||||||
return wxNullBitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
XFree( vi );
|
XFree( vi );
|
||||||
|
|
||||||
@@ -1839,11 +1835,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
|
|||||||
|
|
||||||
vi = XGetVisualInfo( dpy, VisualIDMask|VisualDepthMask, &vinfo_template, &nitem );
|
vi = XGetVisualInfo( dpy, VisualIDMask|VisualDepthMask, &vinfo_template, &nitem );
|
||||||
|
|
||||||
if (!vi)
|
wxCHECK_MSG( vi, wxNullBitmap, _T("no visual") );
|
||||||
{
|
|
||||||
printf("no visual.\n" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((bpp == 16) && (vi->red_mask != 0xf800)) bpp = 15;
|
if ((bpp == 16) && (vi->red_mask != 0xf800)) bpp = 15;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user