Fix: images were not being loaded from zip files.

wxImage::LoadFile requires the file to be seekable to peek at the header.
We work around this by buffering the header in a wrapper class.
This commit is contained in:
Twan van Laarhoven
2020-04-28 22:46:34 +02:00
parent 5f615b3117
commit d64dee7834
2 changed files with 93 additions and 5 deletions
+5 -3
View File
@@ -144,8 +144,9 @@ void Package::clearKeepFlag() {
}
}
// ----------------------------------------------------------------------------- : Package : inside
// ----------------------------------------------------------------------------- : Streams
/// Class to use as a superclass
class FileInputStream_aux {
protected:
wxFileInputStream file_stream;
@@ -164,8 +165,7 @@ public:
, wxZipInputStream(file_stream)
{}
ZipFileInputStream(const String& filename, wxZipEntry* entry)
: FileInputStream_aux(filename)
, wxZipInputStream(file_stream)
: ZipFileInputStream(filename)
{
OpenEntry(*entry);
}
@@ -184,6 +184,8 @@ public:
{}
};
// ----------------------------------------------------------------------------- : Package : inside
unique_ptr<wxInputStream> Package::openIn(const String& file) {
if (!file.empty() && file.GetChar(0) == _('/')) {
// absolute path, open file from another package