From 332a87aa4357c3138ebf4774efdc1243061f5d44 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 13 Jan 2024 19:32:24 +0100 Subject: #887: Fixes Fl_Shared_Image reference counting - adds documentation to all calls - changes implementation details on ::copy() and copy(w,h) --- FL/Fl_Image.H | 2 +- FL/Fl_Shared_Image.H | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'FL') diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index a8f514f36..8b8b433e8 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -259,7 +259,7 @@ public: \note Since FLTK 1.4.0 this method is 'const'. If you derive your own class from Fl_Image or any subclass your overridden methods of 'Fl_Image::copy() const' - and 'Fl_Image::copy(int, int) const' \b must also be 'const' for inheritage + and 'Fl_Image::copy(int, int) const' \b must also be 'const' for inheritance to work properly. This is different than in FLTK 1.3.x and earlier where these methods have not been 'const'. */ diff --git a/FL/Fl_Shared_Image.H b/FL/Fl_Shared_Image.H index 554197396..acecebf83 100644 --- a/FL/Fl_Shared_Image.H +++ b/FL/Fl_Shared_Image.H @@ -22,6 +22,7 @@ # include "Fl_Image.H" +#undef SHIM_DEBUG /** Test function (typedef) for adding new shared image formats. @@ -120,8 +121,13 @@ protected: virtual ~Fl_Shared_Image(); void add(); void update(); + Fl_Shared_Image *copy_(int W, int H) const; public: +#ifdef SHIM_DEBUG + static void print_pool(); +#endif + /** Returns the filename of the shared image */ const char *name() { return name_; } @@ -147,9 +153,9 @@ public: } Fl_Image *copy(int W, int H) const FL_OVERRIDE; - Fl_Image *copy() const { - return Fl_Image::copy(); - } + Fl_Image *copy() const; + Fl_Image *copy(); + void color_average(Fl_Color c, float i) FL_OVERRIDE; void desaturate() FL_OVERRIDE; void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0) FL_OVERRIDE; -- cgit v1.2.3