X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3c87527e89228b537800d06e1c32a62900417beb..ecef04c293db3e3ebcdb12062fdc40b9b35c8c3e:/src/common/gifdecod.cpp diff --git a/src/common/gifdecod.cpp b/src/common/gifdecod.cpp index 32a89223c3..0a8a6f525b 100644 --- a/src/common/gifdecod.cpp +++ b/src/common/gifdecod.cpp @@ -2,8 +2,8 @@ // Name: gifdecod.cpp // Purpose: wxGIFDecoder, GIF reader for wxImage and wxAnimation // Author: Guillermo Rodriguez Garcia -// Version: 3.02 -// Last rev: 1999/08/18 +// Version: 3.04 +// RCS-ID: $Id$ // Copyright: (c) Guillermo Rodriguez Garcia // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -20,16 +20,15 @@ #endif #ifndef WX_PRECOMP -# include "wx/setup.h" +# include "wx/defs.h" #endif -#if wxUSE_STREAMS +#if wxUSE_STREAMS && wxUSE_GIF #include #include -#include "wx/defs.h" #include "wx/gifdecod.h" - + //--------------------------------------------------------------------------- // wxGIFDecoder constructor and destructor @@ -132,7 +131,7 @@ bool wxGIFDecoder::ConvertToImage(wxImage *image) const return TRUE; } - + //--------------------------------------------------------------------------- // Data accessors //--------------------------------------------------------------------------- @@ -203,7 +202,7 @@ bool wxGIFDecoder::GoNextFrame(bool cyclic) } else return FALSE; -} +} bool wxGIFDecoder::GoPrevFrame(bool cyclic) { @@ -294,7 +293,7 @@ int wxGIFDecoder::getcode(int bits, int ab_fin) /* adjust total number of bits extracted from the buffer */ m_restbits = m_restbits + 8; } - + /* find number of bits remaining for next code */ m_restbits = (m_restbits - bits); @@ -446,8 +445,8 @@ bool wxGIFDecoder::CanRead() { unsigned char buf[3]; - m_f->SeekI(0, wxFromStart); m_f->Read(buf, 3); + m_f->SeekI(-3, wxFromCurrent); return (memcmp(buf, "GIF", 3) == 0); } @@ -477,7 +476,6 @@ int wxGIFDecoder::ReadGIF() return E_FORMATO; /* check for and animated GIF support (ver. >= 89a) */ - m_f->SeekI(0, wxFromStart); m_f->Read(buf, 6); if (memcmp(buf + 3, "89a", 3) < 0) @@ -507,7 +505,13 @@ int wxGIFDecoder::ReadGIF() pprev = NULL; pimg = NULL; +#if defined(__VISAGECPP__) +// VA just can't stand while(1) + bool bOs2var = TRUE; + while(bOs2var) +#else while (1) +#endif { type = (unsigned char)m_f->GetC(); @@ -535,14 +539,16 @@ int wxGIFDecoder::ReadGIF() } else /* other extension, skip */ - { + { while ((i = (unsigned char)m_f->GetC()) != 0) { /* This line should not be neccessary! * Some images are not loaded correctly * without it. A bug in wxStream? + * Yes. Fixed now. */ // m_f->SeekI(m_f->TellI(), wxFromStart); + m_f->SeekI(i, wxFromCurrent); } } @@ -621,4 +627,4 @@ int wxGIFDecoder::ReadGIF() return E_OK; } -#endif // wxUSE_STREAM +#endif // wxUSE_STREAMS && wxUSE_GIF