Patch to add support for loading gzipped SVGs:
diff --git a/modules/juce_gui_basics/drawables/juce_Drawable.cpp b/modules/juce_gui_basics/drawables/juce_Drawable.cpp
index 06fdbe000..63cd0ece1 100644
--- a/modules/juce_gui_basics/drawables/juce_Drawable.cpp
+++ b/modules/juce_gui_basics/drawables/juce_Drawable.cpp
@@ -180,7 +180,11 @@ std::unique_ptr<Drawable> Drawable::createFromImageData (const void* data, const
}
else
{
- if (auto svg = parseXMLIfTagMatches (String::createStringFromData (data, (int) numBytes), "svg"))
+ auto svgString = GZIPDecompressorInputStream(new MemoryInputStream(data, numBytes, false), true, GZIPDecompressorInputStream::gzipFormat).readEntireStreamAsString();
+ if(svgString.isEmpty())
+ svgString = String::createStringFromData (data, (int) numBytes);
+
+ if (auto svg = parseXMLIfTagMatches (svgString, "svg"))
result = Drawable::createFromSVG (*svg);
}
Reason:
We’re having somewhat large (~100k) .svg files as Projucer Component Resources. This makes the cpp files quite large and slows down the IDE. gzipping them reduces the size significantly and solves this problem. #584 also surfaced when trying to get hold of this. I think it would also be nice to have an option to save the binary resources of a Projucer Component into a separate .cpp file.