From 46b89686df06102af64454bc7b2e722c1ff16927 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 15 Jun 2020 19:05:34 +0200 Subject: Allow using an Fl_SVG_Image object as window icon. Fix for issue #90: Setting an svg image as a window icon causes a segfault. --- src/Fl_SVG_Image.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Fl_SVG_Image.cxx') diff --git a/src/Fl_SVG_Image.cxx b/src/Fl_SVG_Image.cxx index c4c593d0a..c76bc962b 100644 --- a/src/Fl_SVG_Image.cxx +++ b/src/Fl_SVG_Image.cxx @@ -266,6 +266,12 @@ void Fl_SVG_Image::color_average(Fl_Color c, float i) { Fl_RGB_Image::color_average(c, i); } +/** Makes sure the object is fully initialized. + This function rasterizes the SVG image if that was not done before. */ +void Fl_SVG_Image::normalize() { + if (!array) resize(w(), h()); +} + #endif // FLTK_USE_NANOSVG // -- cgit v1.2.3