diff options
| author | Manolo Gouy <Manolo> | 2017-10-04 11:46:33 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-10-04 11:46:33 +0000 |
| commit | 5e6bf76b0a75f84dcdaa277d1aef7ab76e2d0631 (patch) | |
| tree | a6b337e3d88fc23fe1941e09d22a0b28f5e31223 /src/fl_images_core.cxx | |
| parent | 6434d5d602344631cef2a75c015fa9e72035852d (diff) | |
Fl_SVG_Image class: add support for compressed .svgz image files.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12475 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/fl_images_core.cxx')
| -rw-r--r-- | src/fl_images_core.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx index 5af696764..0a048fa5d 100644 --- a/src/fl_images_core.cxx +++ b/src/fl_images_core.cxx @@ -32,10 +32,13 @@ #include <FL/Fl_PNG_Image.H> #include <FL/Fl_PNM_Image.H> #include <FL/Fl_SVG_Image.H> +#include <FL/Fl_System_Driver.H> #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 +93,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) { + gzFile gzf = (gzFile)fl_gzopen(name, "r"); + 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); |
