X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72045d5768a126191a907bc640c28e81a11afdd6..a7d354c6d75a32033f62b8ecadd837519b35b3ef:/src/common/imaggif.cpp diff --git a/src/common/imaggif.cpp b/src/common/imaggif.cpp index 22a8dc04cc..fdb9a4971d 100644 --- a/src/common/imaggif.cpp +++ b/src/common/imaggif.cpp @@ -89,7 +89,9 @@ bool wxGIFHandler::SaveFile( wxImage * WXUNUSED(image), wxOutputStream& WXUNUSED(stream), bool verbose ) { if (verbose) + { wxLogDebug(wxT("GIF: the handler is read-only!!")); + } return false; } @@ -98,6 +100,20 @@ bool wxGIFHandler::DoCanRead( wxInputStream& stream ) { wxGIFDecoder decod; return decod.CanRead(stream); + // it's ok to modify the stream position here +} + +int wxGIFHandler::DoGetImageCount( wxInputStream& stream ) +{ + wxGIFDecoder decod; + wxGIFErrorCode error = decod.LoadGIF(stream); + if ( (error != wxGIF_OK) && (error != wxGIF_TRUNCATED) ) + return -1; + + // NOTE: this function modifies the current stream position but it's ok + // (see wxImageHandler::GetImageCount) + + return decod.GetFrameCount(); } #endif // wxUSE_STREAMS