From b8a50851fd1bc77fb910bdfdac0eab106a430e6b Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 23 Mar 2018 17:03:24 +0000 Subject: [PATCH] Fix Fl_Image::copy() and its versions for derived image classes following the introduction of Fl_Image::scale() git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12786 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl_Bitmap.H | 2 +- FL/Fl_Image.H | 12 +++++------- FL/Fl_Pixmap.H | 2 +- FL/Fl_SVG_Image.H | 2 +- FL/Fl_Shared_Image.H | 2 +- FL/Fl_Tiled_Image.H | 2 +- src/Fl_Image.cxx | 9 ++++----- 7 files changed, 14 insertions(+), 17 deletions(-) diff --git a/FL/Fl_Bitmap.H b/FL/Fl_Bitmap.H index cb638e66e..03f1a62e8 100644 --- a/FL/Fl_Bitmap.H +++ b/FL/Fl_Bitmap.H @@ -55,7 +55,7 @@ public: Fl_Image(W,H,0), array((const uchar *)bits), alloc_array(0), id_(0), cache_scale_(1) {data((const char **)&array, 1);} virtual ~Fl_Bitmap(); virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } + Fl_Image *copy() { return Fl_Image::copy(); } virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} virtual void label(Fl_Widget*w); diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H index 7b6024b65..beb22f719 100644 --- a/FL/Fl_Image.H +++ b/FL/Fl_Image.H @@ -164,13 +164,11 @@ public: virtual ~Fl_Image(); virtual Fl_Image *copy(int W, int H); /** - The copy() method creates a copy of the specified - image. If the width and height are provided, the image is - resized to the specified size. The image should be deleted (or in - the case of Fl_Shared_Image, released) when you are done - with it. + Creates a copy of the specified image. + The image should be deleted (or in the case of Fl_Shared_Image, released) + when you are done with it. */ - Fl_Image *copy() { return copy(w(), h()); } + Fl_Image *copy() { Fl_Image *img = copy(data_w(), data_h()); img->scale(w(), h(), 0, 1); return img;} virtual void color_average(Fl_Color c, float i); /** The inactive() method calls @@ -268,7 +266,7 @@ public: Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY); virtual ~Fl_RGB_Image(); virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } + Fl_Image *copy() { return Fl_Image::copy(); } virtual void color_average(Fl_Color c, float i); virtual void desaturate(); virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); diff --git a/FL/Fl_Pixmap.H b/FL/Fl_Pixmap.H index 7a4c50144..fa45b3fbb 100644 --- a/FL/Fl_Pixmap.H +++ b/FL/Fl_Pixmap.H @@ -69,7 +69,7 @@ public: explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id_(0), mask_(0) {set_data((const char*const*)D); measure();} virtual ~Fl_Pixmap(); virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } + Fl_Image *copy() { return Fl_Image::copy(); } virtual void color_average(Fl_Color c, float i); virtual void desaturate(); virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); diff --git a/FL/Fl_SVG_Image.H b/FL/Fl_SVG_Image.H index d9c5b76c8..37d41d177 100644 --- a/FL/Fl_SVG_Image.H +++ b/FL/Fl_SVG_Image.H @@ -124,7 +124,7 @@ public: Fl_SVG_Image(const char *filename, const char *svg_data = NULL); virtual ~Fl_SVG_Image(); virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } + Fl_Image *copy() { return Fl_Image::copy(); } void resize(int width, int height); virtual void desaturate(); virtual void color_average(Fl_Color c, float i); diff --git a/FL/Fl_Shared_Image.H b/FL/Fl_Shared_Image.H index 9b5dad13d..89d40d9ac 100644 --- a/FL/Fl_Shared_Image.H +++ b/FL/Fl_Shared_Image.H @@ -100,7 +100,7 @@ public: void reload(); virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } + Fl_Image *copy() { return Fl_Image::copy(); } virtual void color_average(Fl_Color c, float i); virtual void desaturate(); virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0); diff --git a/FL/Fl_Tiled_Image.H b/FL/Fl_Tiled_Image.H index 8528275be..0eb17e2e2 100644 --- a/FL/Fl_Tiled_Image.H +++ b/FL/Fl_Tiled_Image.H @@ -43,7 +43,7 @@ class FL_EXPORT Fl_Tiled_Image : public Fl_Image { virtual ~Fl_Tiled_Image(); virtual Fl_Image *copy(int W, int H); - Fl_Image *copy() { return copy(w(), h()); } + Fl_Image *copy() { return Fl_Image::copy(); } virtual void color_average(Fl_Color c, float i); virtual void desaturate(); virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0); diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index c2ad08ca0..4cc6a8603 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -79,11 +79,10 @@ void Fl_Image::draw_empty(int X, int Y) { } /** - The copy() method creates a copy of the specified - image. If the width and height are provided, the image is - resized to the specified size. The image should be deleted (or in - the case of Fl_Shared_Image, released) when you are done - with it. +Creates a resized copy of the specified image. +The image should be deleted (or in the case of Fl_Shared_Image, released) +when you are done with it. + \param W,H width and height of the returned copied image */ Fl_Image *Fl_Image::copy(int W, int H) { return new Fl_Image(W, H, d());