Source cleaning: whitespaces, tabs, -1/wxDefaultCoord/wxNOT_FOUND, TRUE/true, FALSE/false, !!/!IsEmpty().
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29155 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -60,7 +60,7 @@ public:
|
|||||||
// returns the first icon in the bundle
|
// returns the first icon in the bundle
|
||||||
const wxIcon& GetIcon( const wxSize& size ) const;
|
const wxIcon& GetIcon( const wxSize& size ) const;
|
||||||
// equivalent to GetIcon( wxSize( size, size ) )
|
// equivalent to GetIcon( wxSize( size, size ) )
|
||||||
const wxIcon& GetIcon( wxCoord size = -1 ) const
|
const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const
|
||||||
{ return GetIcon( wxSize( size, size ) ); }
|
{ return GetIcon( wxSize( size, size ) ); }
|
||||||
private:
|
private:
|
||||||
// delete all icons
|
// delete all icons
|
||||||
|
@@ -63,8 +63,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -97,8 +97,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
|
virtual bool DoLoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
virtual int GetImageCount( wxInputStream& stream );
|
virtual int GetImageCount( wxInputStream& stream );
|
||||||
@@ -152,8 +152,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=TRUE) ){return FALSE ;};
|
virtual bool SaveFile( wxImage *WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool WXUNUSED(verbose=true) ){return false ;};
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
virtual int GetImageCount( wxInputStream& stream );
|
virtual int GetImageCount( wxInputStream& stream );
|
||||||
#endif // wxUSE_STREAMS
|
#endif // wxUSE_STREAMS
|
||||||
|
@@ -52,8 +52,8 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
|
|
||||||
virtual int GetImageCount( wxInputStream& stream );
|
virtual int GetImageCount( wxInputStream& stream );
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ class WXDLLEXPORT wxImage: public wxObject
|
|||||||
public:
|
public:
|
||||||
wxImage();
|
wxImage();
|
||||||
wxImage( int width, int height, bool clear = true );
|
wxImage( int width, int height, bool clear = true );
|
||||||
wxImage( int width, int height, unsigned char* data, bool static_data = FALSE );
|
wxImage( int width, int height, unsigned char* data, bool static_data = false );
|
||||||
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
wxImage( const wxString& name, long type = wxBITMAP_TYPE_ANY, int index = -1 );
|
||||||
wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
|
wxImage( const wxString& name, const wxString& mimetype, int index = -1 );
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public:
|
|||||||
wxImage( const wxImage* image );
|
wxImage( const wxImage* image );
|
||||||
|
|
||||||
bool Create( int width, int height, bool clear = true );
|
bool Create( int width, int height, bool clear = true );
|
||||||
bool 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
|
||||||
@@ -176,10 +176,10 @@ public:
|
|||||||
// Rotates the image about the given point, 'angle' radians.
|
// Rotates the image about the given point, 'angle' radians.
|
||||||
// Returns the rotated image, leaving this image intact.
|
// Returns the rotated image, leaving this image intact.
|
||||||
wxImage Rotate(double angle, const wxPoint & centre_of_rotation,
|
wxImage Rotate(double angle, const wxPoint & centre_of_rotation,
|
||||||
bool interpolating = TRUE, wxPoint * offset_after_rotation = (wxPoint*) NULL) const;
|
bool interpolating = true, wxPoint * offset_after_rotation = (wxPoint*) NULL) const;
|
||||||
|
|
||||||
wxImage Rotate90( bool clockwise = TRUE ) const;
|
wxImage Rotate90( bool clockwise = true ) const;
|
||||||
wxImage Mirror( bool horizontally = TRUE ) const;
|
wxImage Mirror( bool horizontally = true ) const;
|
||||||
|
|
||||||
// replace one colour with another
|
// replace one colour with another
|
||||||
void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
|
void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
|
||||||
@@ -251,7 +251,7 @@ public:
|
|||||||
unsigned char GetMaskRed() const;
|
unsigned char GetMaskRed() const;
|
||||||
unsigned char GetMaskGreen() const;
|
unsigned char GetMaskGreen() const;
|
||||||
unsigned char GetMaskBlue() const;
|
unsigned char GetMaskBlue() const;
|
||||||
void SetMask( bool mask = TRUE );
|
void SetMask( bool mask = true );
|
||||||
bool HasMask() const;
|
bool HasMask() const;
|
||||||
|
|
||||||
#if wxUSE_PALETTE
|
#if wxUSE_PALETTE
|
||||||
|
@@ -35,8 +35,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -34,8 +34,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1);
|
virtual bool LoadFile(wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1);
|
||||||
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=TRUE);
|
virtual bool SaveFile(wxImage *image, wxOutputStream& stream, bool verbose=true);
|
||||||
virtual bool DoCanRead(wxInputStream& stream);
|
virtual bool DoCanRead(wxInputStream& stream);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -43,8 +43,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -34,8 +34,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
#endif // wxUSE_STREAMS
|
#endif // wxUSE_STREAMS
|
||||||
|
|
||||||
|
@@ -33,8 +33,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -33,8 +33,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -28,8 +28,8 @@ public:
|
|||||||
wxTIFFHandler();
|
wxTIFFHandler();
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
virtual int GetImageCount( wxInputStream& stream );
|
virtual int GetImageCount( wxInputStream& stream );
|
||||||
#endif
|
#endif
|
||||||
|
@@ -33,8 +33,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_STREAMS
|
#if wxUSE_STREAMS
|
||||||
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=-1 );
|
virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=true, int index=-1 );
|
||||||
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE );
|
virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=true );
|
||||||
virtual bool DoCanRead( wxInputStream& stream );
|
virtual bool DoCanRead( wxInputStream& stream );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ public:
|
|||||||
wxChar *WXUNUSED(data),
|
wxChar *WXUNUSED(data),
|
||||||
int WXUNUSED(size),
|
int WXUNUSED(size),
|
||||||
wxIPCFormat WXUNUSED(format) )
|
wxIPCFormat WXUNUSED(format) )
|
||||||
{ return FALSE; };
|
{ return false; };
|
||||||
|
|
||||||
virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic),
|
virtual wxChar *OnRequest ( const wxString& WXUNUSED(topic),
|
||||||
const wxString& WXUNUSED(item),
|
const wxString& WXUNUSED(item),
|
||||||
@@ -90,15 +90,15 @@ public:
|
|||||||
wxChar *WXUNUSED(data),
|
wxChar *WXUNUSED(data),
|
||||||
int WXUNUSED(size),
|
int WXUNUSED(size),
|
||||||
wxIPCFormat WXUNUSED(format) )
|
wxIPCFormat WXUNUSED(format) )
|
||||||
{ return FALSE; };
|
{ return false; };
|
||||||
|
|
||||||
virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic),
|
virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic),
|
||||||
const wxString& WXUNUSED(item) )
|
const wxString& WXUNUSED(item) )
|
||||||
{ return FALSE; };
|
{ return false; };
|
||||||
|
|
||||||
virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic),
|
virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic),
|
||||||
const wxString& WXUNUSED(item) )
|
const wxString& WXUNUSED(item) )
|
||||||
{ return FALSE; };
|
{ return false; };
|
||||||
|
|
||||||
// Callbacks to CLIENT - override at will
|
// Callbacks to CLIENT - override at will
|
||||||
virtual bool OnAdvise ( const wxString& WXUNUSED(topic),
|
virtual bool OnAdvise ( const wxString& WXUNUSED(topic),
|
||||||
@@ -106,10 +106,10 @@ public:
|
|||||||
wxChar *WXUNUSED(data),
|
wxChar *WXUNUSED(data),
|
||||||
int WXUNUSED(size),
|
int WXUNUSED(size),
|
||||||
wxIPCFormat WXUNUSED(format) )
|
wxIPCFormat WXUNUSED(format) )
|
||||||
{ return FALSE; };
|
{ return false; };
|
||||||
|
|
||||||
// Callbacks to BOTH - override at will
|
// Callbacks to BOTH - override at will
|
||||||
// Default behaviour is to delete connection and return TRUE
|
// Default behaviour is to delete connection and return true
|
||||||
virtual bool OnDisconnect(void) = 0;
|
virtual bool OnDisconnect(void) = 0;
|
||||||
|
|
||||||
// return a buffer at least this size, reallocating buffer if needed
|
// return a buffer at least this size, reallocating buffer if needed
|
||||||
@@ -137,7 +137,7 @@ public:
|
|||||||
inline wxServerBase(void) {}
|
inline wxServerBase(void) {}
|
||||||
inline ~wxServerBase(void) {};
|
inline ~wxServerBase(void) {};
|
||||||
|
|
||||||
// Returns FALSE on error (e.g. port number is already in use)
|
// Returns false on error (e.g. port number is already in use)
|
||||||
virtual bool Create(const wxString& serverName) = 0;
|
virtual bool Create(const wxString& serverName) = 0;
|
||||||
|
|
||||||
// Callbacks to SERVER - override at will
|
// Callbacks to SERVER - override at will
|
||||||
|
@@ -76,7 +76,7 @@ bool wxBMPHandler::SaveFile(wxImage *image,
|
|||||||
wxOutputStream& stream,
|
wxOutputStream& stream,
|
||||||
bool verbose)
|
bool verbose)
|
||||||
{
|
{
|
||||||
return SaveDib(image, stream, verbose, TRUE/*IsBmp*/, FALSE/*IsMask*/);
|
return SaveDib(image, stream, verbose, true/*IsBmp*/, false/*IsMask*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBMPHandler::SaveDib(wxImage *image,
|
bool wxBMPHandler::SaveDib(wxImage *image,
|
||||||
@@ -86,13 +86,13 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
|||||||
bool IsMask)
|
bool IsMask)
|
||||||
|
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( image, FALSE, _T("invalid pointer in wxBMPHandler::SaveFile") );
|
wxCHECK_MSG( image, false, _T("invalid pointer in wxBMPHandler::SaveFile") );
|
||||||
|
|
||||||
if ( !image->Ok() )
|
if ( !image->Ok() )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("BMP: Couldn't save invalid image."));
|
wxLogError(_("BMP: Couldn't save invalid image."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the format of the BMP file to save, else use 24bpp
|
// get the format of the BMP file to save, else use 24bpp
|
||||||
@@ -126,7 +126,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
|||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("BMP: wxImage doesn't have own wxPalette."));
|
wxLogError(_("BMP: wxImage doesn't have own wxPalette."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
bpp = 8;
|
bpp = 8;
|
||||||
palette_size = 256;
|
palette_size = 256;
|
||||||
@@ -201,7 +201,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("BMP: Couldn't write the file (Bitmap) header."));
|
wxLogError(_("BMP: Couldn't write the file (Bitmap) header."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !IsMask )
|
if ( !IsMask )
|
||||||
@@ -222,7 +222,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("BMP: Couldn't write the file (BitmapInfo) header."));
|
wxLogError(_("BMP: Couldn't write the file (BitmapInfo) header."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
|||||||
delete palette;
|
delete palette;
|
||||||
#endif // wxUSE_PALETTE
|
#endif // wxUSE_PALETTE
|
||||||
delete q_image;
|
delete q_image;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete []rgbquad;
|
delete []rgbquad;
|
||||||
@@ -433,7 +433,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
|||||||
delete palette;
|
delete palette;
|
||||||
#endif // wxUSE_PALETTE
|
#endif // wxUSE_PALETTE
|
||||||
delete q_image;
|
delete q_image;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
@@ -442,7 +442,7 @@ bool wxBMPHandler::SaveDib(wxImage *image,
|
|||||||
#endif // wxUSE_PALETTE
|
#endif // wxUSE_PALETTE
|
||||||
delete q_image;
|
delete q_image;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -474,7 +474,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("BMP: Couldn't allocate memory."));
|
wxLogError(_("BMP: Couldn't allocate memory."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -492,7 +492,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
wxLogError( _("BMP: Couldn't allocate memory.") );
|
wxLogError( _("BMP: Couldn't allocate memory.") );
|
||||||
if ( cmap )
|
if ( cmap )
|
||||||
delete[] cmap;
|
delete[] cmap;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reading the palette, if it exists:
|
// Reading the palette, if it exists:
|
||||||
@@ -831,7 +831,7 @@ bool wxBMPHandler::DoLoadDib(wxImage * image, int width, int height,
|
|||||||
|
|
||||||
delete[] cmap;
|
delete[] cmap;
|
||||||
|
|
||||||
image->SetMask(FALSE);
|
image->SetMask(false);
|
||||||
|
|
||||||
const wxStreamError err = stream.GetLastError();
|
const wxStreamError err = stream.GetLastError();
|
||||||
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
|
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
|
||||||
@@ -874,13 +874,13 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("DIB Header: Image width > 32767 pixels for file.") );
|
wxLogError( _("DIB Header: Image width > 32767 pixels for file.") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if ( height > 32767 )
|
if ( height > 32767 )
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("DIB Header: Image height > 32767 pixels for file.") );
|
wxLogError( _("DIB Header: Image height > 32767 pixels for file.") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.Read(&aWord, 2);
|
stream.Read(&aWord, 2);
|
||||||
@@ -894,7 +894,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("DIB Header: Unknown bitdepth in file.") );
|
wxLogError( _("DIB Header: Unknown bitdepth in file.") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.Read(dbuf, 4 * 4);
|
stream.Read(dbuf, 4 * 4);
|
||||||
@@ -904,7 +904,7 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("DIB Header: Unknown encoding in file.") );
|
wxLogError( _("DIB Header: Unknown encoding in file.") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.Read(dbuf, 4 * 2);
|
stream.Read(dbuf, 4 * 2);
|
||||||
@@ -918,16 +918,16 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("DIB Header: Encoding doesn't match bitdepth.") );
|
wxLogError( _("DIB Header: Encoding doesn't match bitdepth.") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//read DIB; this is the BMP image or the XOR part of an icon image
|
//read DIB; this is the BMP image or the XOR part of an icon image
|
||||||
if ( !DoLoadDib(image, width, height, bpp, ncolors, comp, offset, stream,
|
if ( !DoLoadDib(image, width, height, bpp, ncolors, comp, offset, stream,
|
||||||
verbose, IsBmp, TRUE) )
|
verbose, IsBmp, true) )
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("Error in reading image DIB .") );
|
wxLogError( _("Error in reading image DIB .") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !IsBmp )
|
if ( !IsBmp )
|
||||||
@@ -936,24 +936,24 @@ bool wxBMPHandler::LoadDib(wxImage *image, wxInputStream& stream,
|
|||||||
//there is no palette, so we will create one
|
//there is no palette, so we will create one
|
||||||
wxImage mask;
|
wxImage mask;
|
||||||
if ( !DoLoadDib(&mask, width, height, 1, 2, BI_RGB, offset, stream,
|
if ( !DoLoadDib(&mask, width, height, 1, 2, BI_RGB, offset, stream,
|
||||||
verbose, IsBmp, FALSE) )
|
verbose, IsBmp, false) )
|
||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("ICO: Error in reading mask DIB.") );
|
wxLogError( _("ICO: Error in reading mask DIB.") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
image->SetMaskFromImage(mask, 255, 255, 255);
|
image->SetMaskFromImage(mask, 255, 255, 255);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBMPHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
bool wxBMPHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
||||||
bool verbose, int WXUNUSED(index))
|
bool verbose, int WXUNUSED(index))
|
||||||
{
|
{
|
||||||
// Read a single DIB fom the file:
|
// Read a single DIB fom the file:
|
||||||
return LoadDib(image, stream, verbose, TRUE/*isBmp*/);
|
return LoadDib(image, stream, verbose, true/*isBmp*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBMPHandler::DoCanRead(wxInputStream& stream)
|
bool wxBMPHandler::DoCanRead(wxInputStream& stream)
|
||||||
@@ -961,7 +961,7 @@ bool wxBMPHandler::DoCanRead(wxInputStream& stream)
|
|||||||
unsigned char hdr[2];
|
unsigned char hdr[2];
|
||||||
|
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// do we have the BMP file signature?
|
// do we have the BMP file signature?
|
||||||
return hdr[0] == 'B' && hdr[1] == 'M';
|
return hdr[0] == 'B' && hdr[1] == 'M';
|
||||||
@@ -1013,13 +1013,13 @@ bool wxICOHandler::SaveFile(wxImage *image,
|
|||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Image too tall for an icon."));
|
wxLogError(_("ICO: Image too tall for an icon."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if ( image->GetWidth () > 255 )
|
if ( image->GetWidth () > 255 )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Image too wide for an icon."));
|
wxLogError(_("ICO: Image too wide for an icon."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int images = 1; // only generate one image
|
int images = 1; // only generate one image
|
||||||
@@ -1045,7 +1045,7 @@ bool wxICOHandler::SaveFile(wxImage *image,
|
|||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Error writing the image file!"));
|
wxLogError(_("ICO: Error writing the image file!"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for each iamage write a description ICONDIRENTRY:
|
// for each iamage write a description ICONDIRENTRY:
|
||||||
@@ -1094,8 +1094,8 @@ bool wxICOHandler::SaveFile(wxImage *image,
|
|||||||
|
|
||||||
// monochome bitmap:
|
// monochome bitmap:
|
||||||
mask.SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_1BPP_BW);
|
mask.SetOption(wxIMAGE_OPTION_BMP_FORMAT, wxBMP_1BPP_BW);
|
||||||
bool IsBmp = FALSE;
|
bool IsBmp = false;
|
||||||
bool IsMask = FALSE;
|
bool IsMask = false;
|
||||||
|
|
||||||
//calculate size and offset of image and mask
|
//calculate size and offset of image and mask
|
||||||
wxCountingOutputStream cStream;
|
wxCountingOutputStream cStream;
|
||||||
@@ -1104,27 +1104,27 @@ bool wxICOHandler::SaveFile(wxImage *image,
|
|||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Error writing the image file!"));
|
wxLogError(_("ICO: Error writing the image file!"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
IsMask = TRUE;
|
IsMask = true;
|
||||||
|
|
||||||
bResult = SaveDib(&mask, cStream, verbose, IsBmp, IsMask);
|
bResult = SaveDib(&mask, cStream, verbose, IsBmp, IsMask);
|
||||||
if ( !bResult )
|
if ( !bResult )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Error writing the image file!"));
|
wxLogError(_("ICO: Error writing the image file!"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
wxUint32 Size = cStream.GetSize();
|
wxUint32 Size = cStream.GetSize();
|
||||||
|
|
||||||
// wxCountingOutputStream::Ok() always returns TRUE for now and this
|
// wxCountingOutputStream::Ok() always returns true for now and this
|
||||||
// "if" provokes VC++ warnings in optimized build
|
// "if" provokes VC++ warnings in optimized build
|
||||||
#if 0
|
#if 0
|
||||||
if ( !cStream.Ok() )
|
if ( !cStream.Ok() )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Error writing the image file!"));
|
wxLogError(_("ICO: Error writing the image file!"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#endif // 0
|
#endif // 0
|
||||||
|
|
||||||
@@ -1168,31 +1168,31 @@ bool wxICOHandler::SaveFile(wxImage *image,
|
|||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Error writing the image file!"));
|
wxLogError(_("ICO: Error writing the image file!"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// actually save it:
|
// actually save it:
|
||||||
IsMask = FALSE;
|
IsMask = false;
|
||||||
bResult = SaveDib(image, stream, verbose, IsBmp, IsMask);
|
bResult = SaveDib(image, stream, verbose, IsBmp, IsMask);
|
||||||
if ( !bResult )
|
if ( !bResult )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Error writing the image file!"));
|
wxLogError(_("ICO: Error writing the image file!"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
IsMask = TRUE;
|
IsMask = true;
|
||||||
|
|
||||||
bResult = SaveDib(&mask, stream, verbose, IsBmp, IsMask);
|
bResult = SaveDib(&mask, stream, verbose, IsBmp, IsMask);
|
||||||
if ( !bResult )
|
if ( !bResult )
|
||||||
{
|
{
|
||||||
if ( verbose )
|
if ( verbose )
|
||||||
wxLogError(_("ICO: Error writing the image file!"));
|
wxLogError(_("ICO: Error writing the image file!"));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of for loop
|
} // end of for loop
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
||||||
@@ -1259,7 +1259,7 @@ bool wxICOHandler::DoLoadFile(wxImage *image, wxInputStream& stream,
|
|||||||
// seek to selected icon:
|
// seek to selected icon:
|
||||||
pCurrentEntry = pIconDirEntry + iSel;
|
pCurrentEntry = pIconDirEntry + iSel;
|
||||||
stream.SeekI(iPos + wxUINT32_SWAP_ON_BE(pCurrentEntry->dwImageOffset), wxFromStart);
|
stream.SeekI(iPos + wxUINT32_SWAP_ON_BE(pCurrentEntry->dwImageOffset), wxFromStart);
|
||||||
bResult = LoadDib(image, stream, TRUE, IsBmp);
|
bResult = LoadDib(image, stream, true, IsBmp);
|
||||||
bool bIsCursorType = (this->GetType() == wxBITMAP_TYPE_CUR) || (this->GetType() == wxBITMAP_TYPE_ANI);
|
bool bIsCursorType = (this->GetType() == wxBITMAP_TYPE_CUR) || (this->GetType() == wxBITMAP_TYPE_ANI);
|
||||||
if ( bResult && bIsCursorType && nType == 2 )
|
if ( bResult && bIsCursorType && nType == 2 )
|
||||||
{
|
{
|
||||||
@@ -1288,7 +1288,7 @@ bool wxICOHandler::DoCanRead(wxInputStream& stream)
|
|||||||
stream.SeekI(0);
|
stream.SeekI(0);
|
||||||
unsigned char hdr[4];
|
unsigned char hdr[4];
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// hdr[2] is one for an icon and two for a cursor
|
// hdr[2] is one for an icon and two for a cursor
|
||||||
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0';
|
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\1' && hdr[3] == '\0';
|
||||||
@@ -1310,7 +1310,7 @@ bool wxCURHandler::DoCanRead(wxInputStream& stream)
|
|||||||
stream.SeekI(0);
|
stream.SeekI(0);
|
||||||
unsigned char hdr[4];
|
unsigned char hdr[4];
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// hdr[2] is one for an icon and two for a cursor
|
// hdr[2] is one for an icon and two for a cursor
|
||||||
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0';
|
return hdr[0] == '\0' && hdr[1] == '\0' && hdr[2] == '\2' && hdr[3] == '\0';
|
||||||
@@ -1343,7 +1343,7 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
|||||||
stream.SeekI(0);
|
stream.SeekI(0);
|
||||||
stream.Read(&FCC1, 4);
|
stream.Read(&FCC1, 4);
|
||||||
if ( FCC1 != riff32 )
|
if ( FCC1 != riff32 )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// we have a riff file:
|
// we have a riff file:
|
||||||
while (stream.IsOk())
|
while (stream.IsOk())
|
||||||
@@ -1375,7 +1375,7 @@ bool wxANIHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
|||||||
// try to read next data chunk:
|
// try to read next data chunk:
|
||||||
stream.Read(&FCC1, 4);
|
stream.Read(&FCC1, 4);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxANIHandler::DoCanRead(wxInputStream& stream)
|
bool wxANIHandler::DoCanRead(wxInputStream& stream)
|
||||||
@@ -1394,16 +1394,16 @@ bool wxANIHandler::DoCanRead(wxInputStream& stream)
|
|||||||
|
|
||||||
stream.SeekI(0);
|
stream.SeekI(0);
|
||||||
if ( !stream.Read(&FCC1, 4) )
|
if ( !stream.Read(&FCC1, 4) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if ( FCC1 != riff32 )
|
if ( FCC1 != riff32 )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// we have a riff file:
|
// we have a riff file:
|
||||||
while ( stream.IsOk() )
|
while ( stream.IsOk() )
|
||||||
{
|
{
|
||||||
if ( FCC1 == anih32 )
|
if ( FCC1 == anih32 )
|
||||||
return TRUE;
|
return true;
|
||||||
// we always have a data size:
|
// we always have a data size:
|
||||||
stream.Read(&datalen, 4);
|
stream.Read(&datalen, 4);
|
||||||
datalen = wxINT32_SWAP_ON_BE(datalen) ;
|
datalen = wxINT32_SWAP_ON_BE(datalen) ;
|
||||||
@@ -1423,11 +1423,11 @@ bool wxANIHandler::DoCanRead(wxInputStream& stream)
|
|||||||
if ( !stream.Read(&FCC1, 4) )
|
if ( !stream.Read(&FCC1, 4) )
|
||||||
{
|
{
|
||||||
// reading failed -- either EOF or IO error, bail out anyhow
|
// reading failed -- either EOF or IO error, bail out anyhow
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxANIHandler::GetImageCount(wxInputStream& stream)
|
int wxANIHandler::GetImageCount(wxInputStream& stream)
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
static bool LINKAGEMODE MatchPixel(wxImage *img, int x, int y, int w, int h, const wxColour& c)
|
static bool LINKAGEMODE MatchPixel(wxImage *img, int x, int y, int w, int h, const wxColour& c)
|
||||||
{
|
{
|
||||||
if ((x<0)||(x>=w)||(y<0)||(y>=h)) return FALSE;
|
if ((x<0)||(x>=w)||(y<0)||(y>=h)) return false;
|
||||||
|
|
||||||
unsigned char r = img->GetRed(x,y);
|
unsigned char r = img->GetRed(x,y);
|
||||||
unsigned char g = img->GetGreen(x,y);
|
unsigned char g = img->GetGreen(x,y);
|
||||||
@@ -45,16 +45,16 @@ static bool LINKAGEMODE MatchPixel(wxImage *img, int x, int y, int w, int h, con
|
|||||||
|
|
||||||
static bool LINKAGEMODE MatchBoundaryPixel(wxImage *img, int x, int y, int w, int h, const wxColour & fill, const wxColour& bound)
|
static bool LINKAGEMODE MatchBoundaryPixel(wxImage *img, int x, int y, int w, int h, const wxColour & fill, const wxColour& bound)
|
||||||
{
|
{
|
||||||
if ((x<0)||(x>=w)||(y<0)||(y>=h)) return TRUE;
|
if ((x<0)||(x>=w)||(y<0)||(y>=h)) return true;
|
||||||
|
|
||||||
unsigned char r = img->GetRed(x,y);
|
unsigned char r = img->GetRed(x,y);
|
||||||
unsigned char g = img->GetGreen(x,y);
|
unsigned char g = img->GetGreen(x,y);
|
||||||
unsigned char b = img->GetBlue(x,y);
|
unsigned char b = img->GetBlue(x,y);
|
||||||
if ( fill.Red() == r && fill.Green() == g && fill.Blue() == b )
|
if ( fill.Red() == r && fill.Green() == g && fill.Blue() == b )
|
||||||
return TRUE;
|
return true;
|
||||||
if ( bound.Red() == r && bound.Green() == g && bound.Blue() == b )
|
if ( bound.Red() == r && bound.Green() == g && bound.Blue() == b )
|
||||||
return TRUE;
|
return true;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -277,14 +277,14 @@ bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
|||||||
const wxColour& col, int style)
|
const wxColour& col, int style)
|
||||||
{
|
{
|
||||||
if (dc->GetBrush().GetStyle() == wxTRANSPARENT)
|
if (dc->GetBrush().GetStyle() == wxTRANSPARENT)
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
int height = 0;
|
int height = 0;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
dc->GetSize(&width, &height);
|
dc->GetSize(&width, &height);
|
||||||
|
|
||||||
//it would be nice to fail if we don't get a sensible size...
|
//it would be nice to fail if we don't get a sensible size...
|
||||||
wxCHECK_MSG(width >= 1 && height >= 1, FALSE,
|
wxCHECK_MSG(width >= 1 && height >= 1, false,
|
||||||
wxT("In FloodFill, dc.GetSize routine failed, method not supported by this DC"));
|
wxT("In FloodFill, dc.GetSize routine failed, method not supported by this DC"));
|
||||||
|
|
||||||
//this is much faster than doing the individual pixels
|
//this is much faster than doing the individual pixels
|
||||||
@@ -302,7 +302,7 @@ bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
|||||||
dc->Blit(0, 0, width, height, &memdc, 0, 0);
|
dc->Blit(0, 0, width, height, &memdc, 0, 0);
|
||||||
memdc.SelectObject(wxNullBitmap);
|
memdc.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_IMAGE
|
#endif // wxUSE_IMAGE
|
||||||
|
@@ -43,10 +43,10 @@ bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
|||||||
{
|
{
|
||||||
wxGIFDecoder *decod;
|
wxGIFDecoder *decod;
|
||||||
int error;
|
int error;
|
||||||
bool ok = TRUE;
|
bool ok = true;
|
||||||
|
|
||||||
// image->Destroy();
|
// image->Destroy();
|
||||||
decod = new wxGIFDecoder(&stream, TRUE);
|
decod = new wxGIFDecoder(&stream, true);
|
||||||
error = decod->ReadGIF();
|
error = decod->ReadGIF();
|
||||||
|
|
||||||
if ((error != wxGIF_OK) && (error != wxGIF_TRUNCATED))
|
if ((error != wxGIF_OK) && (error != wxGIF_TRUNCATED))
|
||||||
@@ -67,7 +67,7 @@ bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete decod;
|
delete decod;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((error == wxGIF_TRUNCATED) && verbose)
|
if ((error == wxGIF_TRUNCATED) && verbose)
|
||||||
@@ -83,7 +83,7 @@ bool wxGIFHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
|||||||
// accept an index of 0. (Instead GoFirstFrame() should be used)
|
// accept an index of 0. (Instead GoFirstFrame() should be used)
|
||||||
// Also if the gif image has only one frame, calling GoFrame(0)
|
// Also if the gif image has only one frame, calling GoFrame(0)
|
||||||
// fails because GoFrame() only works with gif animations.
|
// fails because GoFrame() only works with gif animations.
|
||||||
// (It fails if IsAnimation() returns FALSE)
|
// (It fails if IsAnimation() returns false)
|
||||||
// All valid reasons to NOT call GoFrame when index equals 0.
|
// All valid reasons to NOT call GoFrame when index equals 0.
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
{
|
{
|
||||||
@@ -111,7 +111,7 @@ bool wxGIFHandler::SaveFile( wxImage * WXUNUSED(image),
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogDebug(wxT("GIF: the handler is read-only!!"));
|
wxLogDebug(wxT("GIF: the handler is read-only!!"));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGIFHandler::DoCanRead( wxInputStream& stream )
|
bool wxGIFHandler::DoCanRead( wxInputStream& stream )
|
||||||
|
@@ -146,7 +146,7 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const
|
|||||||
image->Create(GetWidth(), GetHeight());
|
image->Create(GetWidth(), GetHeight());
|
||||||
|
|
||||||
if (!image->Ok())
|
if (!image->Ok())
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
unsigned char *pal = GetPalette();
|
unsigned char *pal = GetPalette();
|
||||||
unsigned char *src = GetData();
|
unsigned char *src = GetData();
|
||||||
@@ -175,7 +175,7 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const
|
|||||||
image->SetMaskColour(255, 0, 255);
|
image->SetMaskColour(255, 0, 255);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
image->SetMask(FALSE);
|
image->SetMask(false);
|
||||||
|
|
||||||
#if wxUSE_PALETTE
|
#if wxUSE_PALETTE
|
||||||
if (pal && colors > 0)
|
if (pal && colors > 0)
|
||||||
@@ -207,7 +207,7 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const
|
|||||||
dst[2] = src[2];
|
dst[2] = src[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -230,14 +230,14 @@ int wxIFFDecoder::GetTransparentColour() const { return m_image->transparent; }
|
|||||||
|
|
||||||
//
|
//
|
||||||
// CanRead:
|
// CanRead:
|
||||||
// Returns TRUE if the file looks like a valid IFF, FALSE otherwise.
|
// Returns true if the file looks like a valid IFF, false otherwise.
|
||||||
//
|
//
|
||||||
bool wxIFFDecoder::CanRead()
|
bool wxIFFDecoder::CanRead()
|
||||||
{
|
{
|
||||||
unsigned char buf[12];
|
unsigned char buf[12];
|
||||||
|
|
||||||
if ( !m_f->Read(buf, WXSIZEOF(buf)) )
|
if ( !m_f->Read(buf, WXSIZEOF(buf)) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
m_f->SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent);
|
m_f->SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent);
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ int wxIFFDecoder::ReadIFF()
|
|||||||
// main decoding loop. searches IFF chunks and handles them.
|
// main decoding loop. searches IFF chunks and handles them.
|
||||||
// terminates when BODY chunk was found or dataptr ran over end of file
|
// terminates when BODY chunk was found or dataptr ran over end of file
|
||||||
//
|
//
|
||||||
bool BMHDok = FALSE, CMAPok = FALSE, CAMGok = FALSE;
|
bool BMHDok = false, CMAPok = false, CAMGok = false;
|
||||||
int bmhd_width = 0, bmhd_height = 0, bmhd_bitplanes = 0, bmhd_transcol = -1;
|
int bmhd_width = 0, bmhd_height = 0, bmhd_bitplanes = 0, bmhd_transcol = -1;
|
||||||
byte bmhd_masking = 0, bmhd_compression = 0;
|
byte bmhd_masking = 0, bmhd_compression = 0;
|
||||||
long camg_viewmode = 0;
|
long camg_viewmode = 0;
|
||||||
@@ -414,7 +414,7 @@ int wxIFFDecoder::ReadIFF()
|
|||||||
bmhd_masking = *(dataptr + 8 + 9);
|
bmhd_masking = *(dataptr + 8 + 9);
|
||||||
bmhd_compression = *(dataptr + 8 + 10); // get compression
|
bmhd_compression = *(dataptr + 8 + 10); // get compression
|
||||||
bmhd_transcol = iff_getword(dataptr + 8 + 12);
|
bmhd_transcol = iff_getword(dataptr + 8 + 12);
|
||||||
BMHDok = TRUE; // got BMHD
|
BMHDok = true; // got BMHD
|
||||||
dataptr += 8 + chunkLen; // to next chunk
|
dataptr += 8 + chunkLen; // to next chunk
|
||||||
}
|
}
|
||||||
else if (strncmp((char *)dataptr, "CMAP", 4) == 0) { // CMAP ?
|
else if (strncmp((char *)dataptr, "CMAP", 4) == 0) { // CMAP ?
|
||||||
@@ -445,14 +445,14 @@ int wxIFFDecoder::ReadIFF()
|
|||||||
wxLogTrace(_T("iff"), _T("Read %d colors from IFF file."),
|
wxLogTrace(_T("iff"), _T("Read %d colors from IFF file."),
|
||||||
colors);
|
colors);
|
||||||
|
|
||||||
CMAPok = TRUE; // got CMAP
|
CMAPok = true; // got CMAP
|
||||||
dataptr += 8 + chunkLen; // to next chunk
|
dataptr += 8 + chunkLen; // to next chunk
|
||||||
} else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ?
|
} else if (strncmp((char *)dataptr, "CAMG", 4) == 0) { // CAMG ?
|
||||||
if (chunkLen < 4 || truncated) {
|
if (chunkLen < 4 || truncated) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
camg_viewmode = iff_getlong(dataptr + 8); // get viewmodes
|
camg_viewmode = iff_getlong(dataptr + 8); // get viewmodes
|
||||||
CAMGok = TRUE; // got CAMG
|
CAMGok = true; // got CAMG
|
||||||
dataptr += 8 + chunkLen; // to next chunk
|
dataptr += 8 + chunkLen; // to next chunk
|
||||||
}
|
}
|
||||||
else if (strncmp((char *)dataptr, "BODY", 4) == 0) { // BODY ?
|
else if (strncmp((char *)dataptr, "BODY", 4) == 0) { // BODY ?
|
||||||
@@ -763,7 +763,7 @@ bool wxIFFHandler::LoadFile(wxImage *image, wxInputStream& stream,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete decod;
|
delete decod;
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((error == wxIFF_TRUNCATED) && verbose)
|
if ((error == wxIFF_TRUNCATED) && verbose)
|
||||||
@@ -784,7 +784,7 @@ bool wxIFFHandler::SaveFile(wxImage * WXUNUSED(image),
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogDebug(wxT("IFF: the handler is read-only!!"));
|
wxLogDebug(wxT("IFF: the handler is read-only!!"));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxIFFHandler::DoCanRead(wxInputStream& stream)
|
bool wxIFFHandler::DoCanRead(wxInputStream& stream)
|
||||||
|
@@ -226,7 +226,7 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
(cinfo.src->term_source)(&cinfo);
|
(cinfo.src->term_source)(&cinfo);
|
||||||
jpeg_destroy_decompress(&cinfo);
|
jpeg_destroy_decompress(&cinfo);
|
||||||
if (image->Ok()) image->Destroy();
|
if (image->Ok()) image->Destroy();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
jpeg_create_decompress( &cinfo );
|
jpeg_create_decompress( &cinfo );
|
||||||
@@ -239,9 +239,9 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
if (!image->Ok()) {
|
if (!image->Ok()) {
|
||||||
jpeg_finish_decompress( &cinfo );
|
jpeg_finish_decompress( &cinfo );
|
||||||
jpeg_destroy_decompress( &cinfo );
|
jpeg_destroy_decompress( &cinfo );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
image->SetMask( FALSE );
|
image->SetMask( false );
|
||||||
ptr = image->GetData();
|
ptr = image->GetData();
|
||||||
stride = cinfo.output_width * 3;
|
stride = cinfo.output_width * 3;
|
||||||
tempbuf = (*cinfo.mem->alloc_sarray)
|
tempbuf = (*cinfo.mem->alloc_sarray)
|
||||||
@@ -254,7 +254,7 @@ bool wxJPEGHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
}
|
}
|
||||||
jpeg_finish_decompress( &cinfo );
|
jpeg_finish_decompress( &cinfo );
|
||||||
jpeg_destroy_decompress( &cinfo );
|
jpeg_destroy_decompress( &cinfo );
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -338,7 +338,7 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("JPEG: Couldn't save image."));
|
wxLogError(_("JPEG: Couldn't save image."));
|
||||||
jpeg_destroy_compress(&cinfo);
|
jpeg_destroy_compress(&cinfo);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
jpeg_create_compress(&cinfo);
|
jpeg_create_compress(&cinfo);
|
||||||
@@ -385,7 +385,7 @@ bool wxJPEGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
|
|||||||
jpeg_finish_compress(&cinfo);
|
jpeg_finish_compress(&cinfo);
|
||||||
jpeg_destroy_compress(&cinfo);
|
jpeg_destroy_compress(&cinfo);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __VISUALC__
|
#ifdef __VISUALC__
|
||||||
@@ -397,7 +397,7 @@ bool wxJPEGHandler::DoCanRead( wxInputStream& stream )
|
|||||||
unsigned char hdr[2];
|
unsigned char hdr[2];
|
||||||
|
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return hdr[0] == 0xFF && hdr[1] == 0xD8;
|
return hdr[0] == 0xFF && hdr[1] == 0xD8;
|
||||||
}
|
}
|
||||||
|
@@ -108,7 +108,7 @@ void RLEdecode(unsigned char *p, unsigned int size, wxInputStream& s)
|
|||||||
// If ((data & 0xC0) != 0xC0), then the value read is a data
|
// If ((data & 0xC0) != 0xC0), then the value read is a data
|
||||||
// byte. Else, it is a counter (cont = val & 0x3F) and the
|
// byte. Else, it is a counter (cont = val & 0x3F) and the
|
||||||
// next byte is the data byte.
|
// next byte is the data byte.
|
||||||
//
|
|
||||||
if ((data & 0xC0) != 0xC0)
|
if ((data & 0xC0) != 0xC0)
|
||||||
{
|
{
|
||||||
*(p++) = (unsigned char)data;
|
*(p++) = (unsigned char)data;
|
||||||
@@ -447,7 +447,7 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("PCX: this is not a PCX file."));
|
wxLogError(_("PCX: this is not a PCX file."));
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
image->Destroy();
|
image->Destroy();
|
||||||
@@ -465,10 +465,10 @@ bool wxPCXHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
image->Destroy();
|
image->Destroy();
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPCXHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
bool wxPCXHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbose )
|
||||||
@@ -495,7 +495,7 @@ bool wxPCXHandler::DoCanRead( wxInputStream& stream )
|
|||||||
{
|
{
|
||||||
unsigned char c = stream.GetC();
|
unsigned char c = stream.GetC();
|
||||||
if ( !stream )
|
if ( !stream )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// not very safe, but this is all we can get from PCX header :-(
|
// not very safe, but this is all we can get from PCX header :-(
|
||||||
return c == 10;
|
return c == 10;
|
||||||
|
@@ -321,7 +321,7 @@ bool wxPNGHandler::DoCanRead( wxInputStream& stream )
|
|||||||
unsigned char hdr[4];
|
unsigned char hdr[4];
|
||||||
|
|
||||||
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return memcmp(hdr, "\211PNG", WXSIZEOF(hdr)) == 0;
|
return memcmp(hdr, "\211PNG", WXSIZEOF(hdr)) == 0;
|
||||||
}
|
}
|
||||||
@@ -600,7 +600,7 @@ wxPNGHandler::LoadFile(wxImage *image,
|
|||||||
free( lines[i] );
|
free( lines[i] );
|
||||||
free( lines );
|
free( lines );
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (verbose)
|
if (verbose)
|
||||||
@@ -626,7 +626,7 @@ error:
|
|||||||
else
|
else
|
||||||
png_destroy_read_struct( &png_ptr, (png_infopp) NULL, (png_infopp) NULL );
|
png_destroy_read_struct( &png_ptr, (png_infopp) NULL, (png_infopp) NULL );
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -645,7 +645,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("Couldn't save PNG image."));
|
wxLogError(_("Couldn't save PNG image."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_set_error_fn(png_ptr, (png_voidp)NULL, wx_png_error, wx_png_warning);
|
png_set_error_fn(png_ptr, (png_voidp)NULL, wx_png_error, wx_png_warning);
|
||||||
@@ -656,7 +656,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
|
|||||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("Couldn't save PNG image."));
|
wxLogError(_("Couldn't save PNG image."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (setjmp(wxinfo.jmpbuf))
|
if (setjmp(wxinfo.jmpbuf))
|
||||||
@@ -664,7 +664,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
|
|||||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError(_("Couldn't save PNG image."));
|
wxLogError(_("Couldn't save PNG image."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: please see the comment near wxPNGInfoStruct declaration for
|
// NB: please see the comment near wxPNGInfoStruct declaration for
|
||||||
@@ -689,7 +689,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
|
|||||||
if (!data)
|
if (!data)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
png_destroy_write_struct( &png_ptr, (png_infopp)NULL );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int y = 0; y < image->GetHeight(); y++)
|
for (int y = 0; y < image->GetHeight(); y++)
|
||||||
@@ -724,7 +724,7 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
|
|||||||
png_write_end( png_ptr, info_ptr );
|
png_write_end( png_ptr, info_ptr );
|
||||||
png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr );
|
png_destroy_write_struct( &png_ptr, (png_infopp)&info_ptr );
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __VISUALC__
|
#ifdef __VISUALC__
|
||||||
|
@@ -70,15 +70,15 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
{
|
{
|
||||||
case wxT('2'):
|
case wxT('2'):
|
||||||
if (verbose) wxLogError(_("Loading Grey Ascii PNM image is not yet implemented."));
|
if (verbose) wxLogError(_("Loading Grey Ascii PNM image is not yet implemented."));
|
||||||
return FALSE;
|
return false;
|
||||||
case wxT('5'):
|
case wxT('5'):
|
||||||
if (verbose) wxLogError(_("Loading Grey Raw PNM image is not yet implemented."));
|
if (verbose) wxLogError(_("Loading Grey Raw PNM image is not yet implemented."));
|
||||||
return FALSE;
|
return false;
|
||||||
case wxT('3'):
|
case wxT('3'):
|
||||||
case wxT('6'): break;
|
case wxT('6'): break;
|
||||||
default:
|
default:
|
||||||
if (verbose) wxLogError(_("PNM: File format is not recognized."));
|
if (verbose) wxLogError(_("PNM: File format is not recognized."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
text_stream.ReadLine(); // for the \n
|
text_stream.ReadLine(); // for the \n
|
||||||
@@ -94,7 +94,7 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
{
|
{
|
||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("PNM: Couldn't allocate memory.") );
|
wxLogError( _("PNM: Couldn't allocate memory.") );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c=='3') // Ascii RBG
|
if (c=='3') // Ascii RBG
|
||||||
@@ -110,14 +110,14 @@ bool wxPNMHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
|
|||||||
if ( !buf_stream )
|
if ( !buf_stream )
|
||||||
{
|
{
|
||||||
if (verbose) wxLogError(_("PNM: File seems truncated."));
|
if (verbose) wxLogError(_("PNM: File seems truncated."));
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c=='6') // Raw RGB
|
if (c=='6') // Raw RGB
|
||||||
buf_stream.Read( ptr, 3*width*height );
|
buf_stream.Read( ptr, 3*width*height );
|
||||||
|
|
||||||
image->SetMask( FALSE );
|
image->SetMask( false );
|
||||||
|
|
||||||
const wxStreamError err = buf_stream.GetLastError();
|
const wxStreamError err = buf_stream.GetLastError();
|
||||||
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
|
return err == wxSTREAM_NO_ERROR || err == wxSTREAM_EOF;
|
||||||
@@ -146,11 +146,11 @@ bool wxPNMHandler::DoCanRead( wxInputStream& stream )
|
|||||||
{
|
{
|
||||||
case '3':
|
case '3':
|
||||||
case '6':
|
case '6':
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -202,7 +202,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("TIFF: Error loading image.") );
|
wxLogError( _("TIFF: Error loading image.") );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TIFFSetDirectory( tif, (tdir_t)index ))
|
if (!TIFFSetDirectory( tif, (tdir_t)index ))
|
||||||
@@ -212,7 +212,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
|
|
||||||
TIFFClose( tif );
|
TIFFClose( tif );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 w, h;
|
uint32 w, h;
|
||||||
@@ -233,7 +233,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
|
|
||||||
TIFFClose( tif );
|
TIFFClose( tif );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
image->Create( (int)w, (int)h );
|
image->Create( (int)w, (int)h );
|
||||||
@@ -245,7 +245,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
_TIFFfree( raster );
|
_TIFFfree( raster );
|
||||||
TIFFClose( tif );
|
TIFFClose( tif );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TIFFReadRGBAImage( tif, w, h, raster, 0 ))
|
if (!TIFFReadRGBAImage( tif, w, h, raster, 0 ))
|
||||||
@@ -257,10 +257,10 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
image->Destroy();
|
image->Destroy();
|
||||||
TIFFClose( tif );
|
TIFFClose( tif );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasmask = FALSE;
|
bool hasmask = false;
|
||||||
|
|
||||||
unsigned char *ptr = image->GetData();
|
unsigned char *ptr = image->GetData();
|
||||||
ptr += w*3*(h-1);
|
ptr += w*3*(h-1);
|
||||||
@@ -273,7 +273,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
unsigned char alpha = (unsigned char)TIFFGetA(raster[pos]);
|
unsigned char alpha = (unsigned char)TIFFGetA(raster[pos]);
|
||||||
if (alpha < 127)
|
if (alpha < 127)
|
||||||
{
|
{
|
||||||
hasmask = TRUE;
|
hasmask = true;
|
||||||
ptr[0] = image->GetMaskRed();
|
ptr[0] = image->GetMaskRed();
|
||||||
ptr++;
|
ptr++;
|
||||||
ptr[0] = image->GetMaskGreen();
|
ptr[0] = image->GetMaskGreen();
|
||||||
@@ -301,7 +301,7 @@ bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbos
|
|||||||
|
|
||||||
image->SetMask( hasmask );
|
image->SetMask( hasmask );
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxTIFFHandler::GetImageCount( wxInputStream& stream )
|
int wxTIFFHandler::GetImageCount( wxInputStream& stream )
|
||||||
@@ -330,7 +330,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
|
|||||||
if (verbose)
|
if (verbose)
|
||||||
wxLogError( _("TIFF: Error saving image.") );
|
wxLogError( _("TIFF: Error saving image.") );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32)image->GetWidth());
|
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32)image->GetWidth());
|
||||||
@@ -355,7 +355,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
|
|||||||
|
|
||||||
TIFFClose( tif );
|
TIFFClose( tif );
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -381,7 +381,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
|
|||||||
if (buf)
|
if (buf)
|
||||||
_TIFFfree(buf);
|
_TIFFfree(buf);
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
ptr += image->GetWidth()*3;
|
ptr += image->GetWidth()*3;
|
||||||
}
|
}
|
||||||
@@ -391,7 +391,7 @@ bool wxTIFFHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbo
|
|||||||
if (buf)
|
if (buf)
|
||||||
_TIFFfree(buf);
|
_TIFFfree(buf);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
|
bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
|
||||||
@@ -399,7 +399,7 @@ bool wxTIFFHandler::DoCanRead( wxInputStream& stream )
|
|||||||
unsigned char hdr[2];
|
unsigned char hdr[2];
|
||||||
|
|
||||||
if ( !stream.Read(&hdr, WXSIZEOF(hdr)) )
|
if ( !stream.Read(&hdr, WXSIZEOF(hdr)) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
return (hdr[0] == 'I' && hdr[1] == 'I') ||
|
return (hdr[0] == 'I' && hdr[1] == 'I') ||
|
||||||
(hdr[0] == 'M' && hdr[1] == 'M');
|
(hdr[0] == 'M' && hdr[1] == 'M');
|
||||||
|
@@ -102,9 +102,9 @@ bool wxXPMHandler::LoadFile(wxImage *image,
|
|||||||
|
|
||||||
wxImage img = decoder.ReadFile(stream);
|
wxImage img = decoder.ReadFile(stream);
|
||||||
if ( !img.Ok() )
|
if ( !img.Ok() )
|
||||||
return FALSE;
|
return false;
|
||||||
*image = img;
|
*image = img;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ bool wxXPMHandler::SaveFile(wxImage * image,
|
|||||||
delete[] symbols;
|
delete[] symbols;
|
||||||
delete[] symbols_data;
|
delete[] symbols_data;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxXPMHandler::DoCanRead(wxInputStream& stream)
|
bool wxXPMHandler::DoCanRead(wxInputStream& stream)
|
||||||
|
@@ -1078,7 +1078,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
|
|||||||
FIXME: UNICODE SUPPORT: must use CHARSET specifier!
|
FIXME: UNICODE SUPPORT: must use CHARSET specifier!
|
||||||
*/
|
*/
|
||||||
wxString szName = szName0;
|
wxString szName = szName0;
|
||||||
if(szName.Find(wxT('.')) != -1) // contains a dot
|
if(szName.Find(wxT('.')) != wxNOT_FOUND) // contains a dot
|
||||||
szName = szName.Left(szName.Find(wxT('.')));
|
szName = szName.Left(szName.Find(wxT('.')));
|
||||||
|
|
||||||
wxString searchPath = GetFullSearchPath(szDirPrefix);
|
wxString searchPath = GetFullSearchPath(szDirPrefix);
|
||||||
@@ -1108,7 +1108,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
|
|||||||
wxString strFullName;
|
wxString strFullName;
|
||||||
if ( !wxFindFileInPath(&strFullName, searchPath, strFile) ) {
|
if ( !wxFindFileInPath(&strFullName, searchPath, strFile) ) {
|
||||||
wxLogVerbose(_("catalog file for domain '%s' not found."), szName.c_str());
|
wxLogVerbose(_("catalog file for domain '%s' not found."), szName.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open file
|
// open file
|
||||||
@@ -1117,18 +1117,18 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
|
|||||||
|
|
||||||
wxFile fileMsg(strFullName);
|
wxFile fileMsg(strFullName);
|
||||||
if ( !fileMsg.IsOpened() )
|
if ( !fileMsg.IsOpened() )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// get the file size
|
// get the file size
|
||||||
off_t nSize = fileMsg.Length();
|
off_t nSize = fileMsg.Length();
|
||||||
if ( nSize == wxInvalidOffset )
|
if ( nSize == wxInvalidOffset )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
// read the whole file in memory
|
// read the whole file in memory
|
||||||
m_pData = new size_t8[nSize];
|
m_pData = new size_t8[nSize];
|
||||||
if ( fileMsg.Read(m_pData, nSize) != nSize ) {
|
if ( fileMsg.Read(m_pData, nSize) != nSize ) {
|
||||||
wxDELETEA(m_pData);
|
wxDELETEA(m_pData);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// examine header
|
// examine header
|
||||||
@@ -1148,7 +1148,7 @@ bool wxMsgCatalogFile::Load(const wxChar *szDirPrefix, const wxChar *szName0,
|
|||||||
wxLogWarning(_("'%s' is not a valid message catalog."), strFullName.c_str());
|
wxLogWarning(_("'%s' is not a valid message catalog."), strFullName.c_str());
|
||||||
|
|
||||||
wxDELETEA(m_pData);
|
wxDELETEA(m_pData);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize
|
// initialize
|
||||||
@@ -1222,7 +1222,7 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
|
|||||||
{
|
{
|
||||||
#if wxUSE_WCHAR_T
|
#if wxUSE_WCHAR_T
|
||||||
wxCSConv *csConv = NULL;
|
wxCSConv *csConv = NULL;
|
||||||
if ( !!m_charset )
|
if ( !m_charset.IsEmpty() )
|
||||||
csConv = new wxCSConv(m_charset);
|
csConv = new wxCSConv(m_charset);
|
||||||
|
|
||||||
wxMBConv& inputConv = csConv ? *((wxMBConv*)csConv) : *wxConvCurrent;
|
wxMBConv& inputConv = csConv ? *((wxMBConv*)csConv) : *wxConvCurrent;
|
||||||
@@ -1239,10 +1239,10 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
|
|||||||
if ( convertEncoding )
|
if ( convertEncoding )
|
||||||
{
|
{
|
||||||
wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM;
|
wxFontEncoding targetEnc = wxFONTENCODING_SYSTEM;
|
||||||
wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(m_charset, FALSE);
|
wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(m_charset, false);
|
||||||
if ( enc == wxFONTENCODING_SYSTEM )
|
if ( enc == wxFONTENCODING_SYSTEM )
|
||||||
{
|
{
|
||||||
convertEncoding = FALSE; // unknown encoding
|
convertEncoding = false; // unknown encoding
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1252,10 +1252,10 @@ void wxMsgCatalogFile::FillHash(wxMessagesHash& hash,
|
|||||||
wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc);
|
wxFontEncodingArray a = wxEncodingConverter::GetPlatformEquivalents(enc);
|
||||||
if (a[0] == enc)
|
if (a[0] == enc)
|
||||||
// no conversion needed, locale uses native encoding
|
// no conversion needed, locale uses native encoding
|
||||||
convertEncoding = FALSE;
|
convertEncoding = false;
|
||||||
if (a.GetCount() == 0)
|
if (a.GetCount() == 0)
|
||||||
// we don't know common equiv. under this platform
|
// we don't know common equiv. under this platform
|
||||||
convertEncoding = FALSE;
|
convertEncoding = false;
|
||||||
targetEnc = a[0];
|
targetEnc = a[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1338,10 +1338,10 @@ bool wxMsgCatalog::Load(const wxChar *szDirPrefix, const wxChar *szName,
|
|||||||
if ( file.Load(szDirPrefix, szName, m_pluralFormsCalculator) )
|
if ( file.Load(szDirPrefix, szName, m_pluralFormsCalculator) )
|
||||||
{
|
{
|
||||||
file.FillHash(m_messages, msgIdCharset, bConvertEncoding);
|
file.FillHash(m_messages, msgIdCharset, bConvertEncoding);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxChar *wxMsgCatalog::GetString(const wxChar *sz, size_t n) const
|
const wxChar *wxMsgCatalog::GetString(const wxChar *sz, size_t n) const
|
||||||
@@ -1425,7 +1425,7 @@ bool wxLocale::Init(const wxChar *szName,
|
|||||||
// the argument to setlocale()
|
// the argument to setlocale()
|
||||||
szLocale = szShort;
|
szLocale = szShort;
|
||||||
|
|
||||||
wxCHECK_MSG( szLocale, FALSE, _T("no locale to set in wxLocale::Init()") );
|
wxCHECK_MSG( szLocale, false, _T("no locale to set in wxLocale::Init()") );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __WXWINCE__
|
#ifdef __WXWINCE__
|
||||||
@@ -1471,7 +1471,7 @@ bool wxLocale::Init(const wxChar *szName,
|
|||||||
|
|
||||||
// load the default catalog with wxWidgets standard messages
|
// load the default catalog with wxWidgets standard messages
|
||||||
m_pMsgCat = NULL;
|
m_pMsgCat = NULL;
|
||||||
bool bOk = TRUE;
|
bool bOk = true;
|
||||||
if ( bLoadDefault )
|
if ( bLoadDefault )
|
||||||
bOk = AddCatalog(wxT("wxstd"));
|
bOk = AddCatalog(wxT("wxstd"));
|
||||||
|
|
||||||
@@ -1523,7 +1523,7 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
// We failed to detect system language, so we will use English:
|
// We failed to detect system language, so we will use English:
|
||||||
if (lang == wxLANGUAGE_UNKNOWN)
|
if (lang == wxLANGUAGE_UNKNOWN)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxLanguageInfo *info = GetLanguageInfo(lang);
|
const wxLanguageInfo *info = GetLanguageInfo(lang);
|
||||||
@@ -1532,7 +1532,7 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
{
|
{
|
||||||
wxLogError(wxT("Unknown language %i."), lang);
|
wxLogError(wxT("Unknown language %i."), lang);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString name = info->Description;
|
wxString name = info->Description;
|
||||||
@@ -1580,7 +1580,7 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
if ( !retloc )
|
if ( !retloc )
|
||||||
{
|
{
|
||||||
wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str());
|
wxLogError(wxT("Cannot set locale to '%s'."), locale.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
|
|
||||||
@@ -1637,7 +1637,7 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
{
|
{
|
||||||
wxLogLastError(wxT("SetThreadLocale"));
|
wxLogLastError(wxT("SetThreadLocale"));
|
||||||
wxLogError(wxT("Cannot set locale to language %s."), name.c_str());
|
wxLogError(wxT("Cannot set locale to language %s."), name.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1679,12 +1679,12 @@ bool wxLocale::Init(int language, int flags)
|
|||||||
if ( !retloc )
|
if ( !retloc )
|
||||||
{
|
{
|
||||||
wxLogError(wxT("Cannot set locale to language %s."), name.c_str());
|
wxLogError(wxT("Cannot set locale to language %s."), name.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(__WXMAC__) || defined(__WXPM__)
|
#elif defined(__WXMAC__) || defined(__WXPM__)
|
||||||
wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
|
wxMB2WXbuf retloc = wxSetlocale(LC_ALL , wxEmptyString);
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return false;
|
||||||
#define WX_NO_LOCALE_SUPPORT
|
#define WX_NO_LOCALE_SUPPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2297,7 +2297,7 @@ wxFontEncoding wxLocale::GetSystemEncoding()
|
|||||||
if ( !encname.empty() )
|
if ( !encname.empty() )
|
||||||
{
|
{
|
||||||
wxFontEncoding enc = wxFontMapper::Get()->
|
wxFontEncoding enc = wxFontMapper::Get()->
|
||||||
CharsetToEncoding(encname, FALSE /* not interactive */);
|
CharsetToEncoding(encname, false /* not interactive */);
|
||||||
|
|
||||||
// on some modern Linux systems (RedHat 8) the default system locale
|
// on some modern Linux systems (RedHat 8) the default system locale
|
||||||
// is UTF8 -- but it isn't supported by wxGTK in ANSI build at all so
|
// is UTF8 -- but it isn't supported by wxGTK in ANSI build at all so
|
||||||
@@ -2736,7 +2736,7 @@ class wxLocaleModule: public wxModule
|
|||||||
DECLARE_DYNAMIC_CLASS(wxLocaleModule)
|
DECLARE_DYNAMIC_CLASS(wxLocaleModule)
|
||||||
public:
|
public:
|
||||||
wxLocaleModule() {}
|
wxLocaleModule() {}
|
||||||
bool OnInit() { return TRUE; }
|
bool OnInit() { return true; }
|
||||||
void OnExit() { wxLocale::DestroyLanguagesDB(); }
|
void OnExit() { wxLocale::DestroyLanguagesDB(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -31,23 +31,23 @@ IMPLEMENT_CLASS(wxClientBase, wxObject)
|
|||||||
IMPLEMENT_CLASS(wxConnectionBase, wxObject)
|
IMPLEMENT_CLASS(wxConnectionBase, wxObject)
|
||||||
|
|
||||||
wxConnectionBase::wxConnectionBase(wxChar *buffer, int size)
|
wxConnectionBase::wxConnectionBase(wxChar *buffer, int size)
|
||||||
: m_connected(TRUE),
|
: m_connected(true),
|
||||||
m_buffer(buffer),
|
m_buffer(buffer),
|
||||||
m_buffersize(size),
|
m_buffersize(size),
|
||||||
m_deletebufferwhendone(FALSE)
|
m_deletebufferwhendone(false)
|
||||||
{
|
{
|
||||||
if ( buffer == (wxChar *)NULL )
|
if ( buffer == (wxChar *)NULL )
|
||||||
{ // behave like next constructor
|
{ // behave like next constructor
|
||||||
m_buffersize = 0;
|
m_buffersize = 0;
|
||||||
m_deletebufferwhendone = TRUE;
|
m_deletebufferwhendone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxConnectionBase::wxConnectionBase()
|
wxConnectionBase::wxConnectionBase()
|
||||||
: m_connected(TRUE),
|
: m_connected(true),
|
||||||
m_buffer(NULL),
|
m_buffer(NULL),
|
||||||
m_buffersize(0),
|
m_buffersize(0),
|
||||||
m_deletebufferwhendone(TRUE)
|
m_deletebufferwhendone(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ wxConnectionBase::wxConnectionBase(wxConnectionBase& copy)
|
|||||||
: m_connected(copy.m_connected),
|
: m_connected(copy.m_connected),
|
||||||
m_buffer(copy.m_buffer),
|
m_buffer(copy.m_buffer),
|
||||||
m_buffersize(copy.m_buffersize),
|
m_buffersize(copy.m_buffersize),
|
||||||
m_deletebufferwhendone(FALSE)
|
m_deletebufferwhendone(false)
|
||||||
|
|
||||||
{
|
{
|
||||||
// copy constructor would require ref-counted pointer to buffer
|
// copy constructor would require ref-counted pointer to buffer
|
||||||
|
Reference in New Issue
Block a user