summaryrefslogtreecommitdiff
path: root/src/Fl_SVG_Image.cxx
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2020-06-15 19:05:34 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2020-06-15 19:05:47 +0200
commit46b89686df06102af64454bc7b2e722c1ff16927 (patch)
tree8e73dc3298cb6a24069c8f2fd8abedb7f71e9ca0 /src/Fl_SVG_Image.cxx
parent91b78572c7ab2e4bd7692d2aa5352fcbbb33b236 (diff)
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.
Diffstat (limited to 'src/Fl_SVG_Image.cxx')
-rw-r--r--src/Fl_SVG_Image.cxx6
1 files changed, 6 insertions, 0 deletions
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
//