From 325c4b8666b16bfcb4458047d0d57a81b5456a70 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Thu, 30 Jan 2020 18:54:18 +0100 Subject: New public static variable bool Fl_Image::register_images_done Allows an app to detect whether fl_register_images() was called or not. --- FL/Fl_Image.H | 1 + src/Fl_Image.cxx | 2 ++ src/fl_images_core.cxx | 1 + 3 files changed, 4 insertions(+) diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index 687aa6057..c6fb55967 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -226,6 +226,7 @@ public: static void scaling_algorithm(Fl_RGB_Scaling algorithm) {scaling_algorithm_ = algorithm; } /** Gets what algorithm is used when resizing a source image to draw it. */ static Fl_RGB_Scaling scaling_algorithm() {return scaling_algorithm_;} + static bool register_images_done; }; diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index f4bf30b3e..b02d43f75 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -297,6 +297,8 @@ int Fl_Image::draw_scaled(int X, int Y, int W, int H) { return 1; } +/** True after fl_register_images() was called, false before */ +bool Fl_Image::register_images_done = false; // // RGB image class... diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx index 58fcd2e5f..d610fb8c4 100644 --- a/src/fl_images_core.cxx +++ b/src/fl_images_core.cxx @@ -57,6 +57,7 @@ static Fl_Image *fl_check_images(const char *name, uchar *header, int headerlen) */ void fl_register_images() { Fl_Shared_Image::add_handler(fl_check_images); + Fl_Image::register_images_done = true; } -- cgit v1.2.3