CanRead() now restores the stream to its previous state (potential
bug when mixing with other handlers' CanRead() code.) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,8 +2,8 @@
|
|||||||
// Name: gifdecod.cpp
|
// Name: gifdecod.cpp
|
||||||
// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation
|
// Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation
|
||||||
// Author: Guillermo Rodriguez Garcia <guille@iies.es>
|
// Author: Guillermo Rodriguez Garcia <guille@iies.es>
|
||||||
// Version: 3.02
|
// Version: 3.03
|
||||||
// Last rev: 1999/08/18
|
// RCS-ID:
|
||||||
// Copyright: (c) Guillermo Rodriguez Garcia
|
// Copyright: (c) Guillermo Rodriguez Garcia
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -445,9 +445,12 @@ int wxGIFDecoder::dgif(IMAGEN *img, int interl, int bits)
|
|||||||
bool wxGIFDecoder::CanRead()
|
bool wxGIFDecoder::CanRead()
|
||||||
{
|
{
|
||||||
unsigned char buf[3];
|
unsigned char buf[3];
|
||||||
|
off_t pos;
|
||||||
|
|
||||||
|
pos = m_f->TellI();
|
||||||
m_f->SeekI(0, wxFromStart);
|
m_f->SeekI(0, wxFromStart);
|
||||||
m_f->Read(buf, 3);
|
m_f->Read(buf, 3);
|
||||||
|
m_f->SeekI(pos, wxFromStart);
|
||||||
|
|
||||||
return (memcmp(buf, "GIF", 3) == 0);
|
return (memcmp(buf, "GIF", 3) == 0);
|
||||||
}
|
}
|
||||||
@@ -541,8 +544,10 @@ int wxGIFDecoder::ReadGIF()
|
|||||||
/* This line should not be neccessary!
|
/* This line should not be neccessary!
|
||||||
* Some images are not loaded correctly
|
* Some images are not loaded correctly
|
||||||
* without it. A bug in wxStream?
|
* without it. A bug in wxStream?
|
||||||
|
* Yes. Fixed now.
|
||||||
*/
|
*/
|
||||||
// m_f->SeekI(m_f->TellI(), wxFromStart);
|
// m_f->SeekI(m_f->TellI(), wxFromStart);
|
||||||
|
|
||||||
m_f->SeekI(i, wxFromCurrent);
|
m_f->SeekI(i, wxFromCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user