From eb314f565340ff69922710d281d02b709ca77548 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 17 Sep 2022 09:03:34 +0200 Subject: Allow use of Fl_Window::default_icon() with a scaled image - Part 2. Default icons are handled according to their scaled size, if there scaled. --- src/Fl_x.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Fl_x.cxx') diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index e5c970b0a..5b7e2a731 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -2707,6 +2707,11 @@ static void icons_to_property(const Fl_RGB_Image *icons[], int count, const Fl_RGB_Image *image; image = icons[i]; + bool need_delete = false; + if (image->w() != image->data_w() || image->h() != image->data_h()) { + image = (Fl_RGB_Image*)image->copy(); + need_delete = true; + } data[0] = image->data_w(); data[1] = image->data_h(); @@ -2736,6 +2741,7 @@ static void icons_to_property(const Fl_RGB_Image *icons[], int count, } in += extra_data; } + if (need_delete) delete image; } } -- cgit v1.2.3