summaryrefslogtreecommitdiff
path: root/src/fl_images_core.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2017-10-04 16:26:51 +0000
committerManolo Gouy <Manolo>2017-10-04 16:26:51 +0000
commit0b797d704c718aba64720734377f7b23aa0098f5 (patch)
treed47f4b010fe23df1c6423f149c283aff4256c874 /src/fl_images_core.cxx
parent7a9d5be6cb2ae831b3c2409788d3a31aa61d62b9 (diff)
Fl_SVG_Image class: add support for compressed .svgz image files.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12477 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_images_core.cxx')
-rw-r--r--src/fl_images_core.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx
index 5af696764..3ed225c8c 100644
--- a/src/fl_images_core.cxx
+++ b/src/fl_images_core.cxx
@@ -35,7 +35,9 @@
#include <stdio.h>
#include <stdlib.h>
#include "flstring.h"
-
+#if defined(HAVE_LIBZ)
+#include <zlib.h>
+#endif
//
// Define a simple global image registration function that registers
@@ -90,6 +92,15 @@ fl_check_images(const char *name, // I - Filename
#endif // HAVE_LIBJPEG
#ifdef FLTK_USE_NANOSVG
+# if defined(HAVE_LIBZ)
+ if (header[0] == 0x1f && header[1] == 0x8b) { // denotes gzip'ed data
+ gzFile gzf = (gzFile)Fl_SVG_Image::gzopen(name);
+ if (gzf) {
+ gzread(gzf, header, headerlen);
+ gzclose(gzf);
+ }
+ }
+# endif // HAVE_LIBZ
if ( (headerlen > 5 && memcmp(header, "<?xml", 5) == 0) ||
memcmp(header, "<svg", 4) == 0)
return new Fl_SVG_Image(name);