X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/deb2fec01e097102e2799d7d0797f66dbae4f0c4..543f08a67631f2849872d5d3ee7cb99047718560:/src/common/imagpng.cpp diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 1a27982b12..7609aae068 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -346,6 +346,15 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos return TRUE; } +bool wxPNGHandler::CanRead( wxInputStream& stream ) +{ + unsigned char hdr[4]; + + stream.Read(&hdr, 4); + stream.SeekI(-4, wxFromCurrent); + return (hdr[0] == 0x89 && hdr[1] == 'P' && hdr[2] == 'N' && hdr[3] == 'G'); +} + #endif // wxUSE_STREAMS