summaryrefslogtreecommitdiff
path: root/FL/Fl_Image.H
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2012-11-09 16:02:08 +0000
committerManolo Gouy <Manolo>2012-11-09 16:02:08 +0000
commitcff894183660e222605b945d841a3cb580082201 (patch)
treee5f6e96ecd4a03e29753703b379e4c51bf6437ff /FL/Fl_Image.H
parent8701434312c150b4c07074feee008129c775ad71 (diff)
Fix STR#2881: the new static function Fl_RGB_Image::max_size(size) allows to control the maximum
memory size allowed when creating an Fl_RGB_Image. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9709 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL/Fl_Image.H')
-rw-r--r--FL/Fl_Image.H17
1 files changed, 17 insertions, 0 deletions
diff --git a/FL/Fl_Image.H b/FL/Fl_Image.H
index 61a426054..357982e63 100644
--- a/FL/Fl_Image.H
+++ b/FL/Fl_Image.H
@@ -23,6 +23,7 @@
# define Fl_Image_H
# include "Enumerations.H"
+#include <stdlib.h>
class Fl_Widget;
struct Fl_Menu_Item;
@@ -167,6 +168,7 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
friend class Fl_Quartz_Graphics_Driver;
friend class Fl_GDI_Graphics_Driver;
friend class Fl_Xlib_Graphics_Driver;
+ static size_t max_size_;
public:
const uchar *array;
@@ -211,6 +213,21 @@ public:
virtual void label(Fl_Widget*w);
virtual void label(Fl_Menu_Item*m);
virtual void uncache();
+ /** Sets the maximum allowed image size in bytes when creating an Fl_RGB_Image object.
+
+ The image size in bytes of an Fl_RGB_Image object is the value of the product w() * h() * d().
+ If this product exceeds size, the created object of a derived class of Fl_RGB_Image
+ won't be loaded with the image data.
+ This does not apply to direct RGB image creation with
+ Fl_RGB_Image::Fl_RGB_Image(const uchar *bits, int W, int H, int D, int LD).
+ The default max_size() value is essentially infinite.
+ */
+ static void max_size(size_t size) { max_size_ = size;}
+ /** Returns the maximum allowed image size in bytes when creating an Fl_RGB_Image object.
+
+ \sa void Fl_RGB_Image::max_size(size_t)
+ */
+ static size_t max_size() {return max_size_;}
};
#endif // !Fl_Image_H