summaryrefslogtreecommitdiff
path: root/src/Fl_Image.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-08-05 17:50:25 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-08-05 17:50:25 +0000
commita11a31ff78af62e73735b5e012849523a612e26a (patch)
tree539acb40340746b970e5f151def2ae9105b8821d /src/Fl_Image.cxx
parent685100b1222821dedec2e0b22f55ca18027a99df (diff)
Range check Fl_Text_Buffer::search_forward().
Don't use png_read_destroy() - it doesn't free all memory. Add uncache() method to image classes. Memory/initialization bugs in Fl_File_Chooser (valgrind) Make sure both Fl_Window constructors have default cursor initialization code... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2562 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Image.cxx')
-rw-r--r--src/Fl_Image.cxx42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx
index cb3478423..b66a01fe7 100644
--- a/src/Fl_Image.cxx
+++ b/src/Fl_Image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Image.cxx,v 1.5.2.3.2.21 2002/05/24 14:19:19 easysw Exp $"
+// "$Id: Fl_Image.cxx,v 1.5.2.3.2.22 2002/08/05 17:50:25 easysw Exp $"
//
// Image drawing code for the Fast Light Tool Kit (FLTK).
//
@@ -41,6 +41,9 @@ void fl_restore_clip(); // from fl_rect.cxx
Fl_Image::~Fl_Image() {
}
+void Fl_Image::uncache() {
+}
+
void Fl_Image::draw(int XP, int YP, int, int, int, int) {
draw_empty(XP, YP);
}
@@ -116,11 +119,22 @@ Fl_Image::measure(const Fl_Label *lo, // I - Label
//
Fl_RGB_Image::~Fl_RGB_Image() {
- if (id) fl_delete_offscreen((Fl_Offscreen)id);
- if (mask) fl_delete_bitmask(mask);
+ uncache();
if (alloc_array) delete[] (uchar *)array;
}
+void Fl_RGB_Image::uncache() {
+ if (id) {
+ fl_delete_offscreen(id);
+ id = 0;
+ }
+
+ if (mask) {
+ fl_delete_bitmask(mask);
+ mask = 0;
+ }
+}
+
Fl_Image *Fl_RGB_Image::copy(int W, int H) {
// Optimize the simple copy where the width and height are the same,
// or when we are copying an empty image...
@@ -185,15 +199,7 @@ void Fl_RGB_Image::color_average(Fl_Color c, float i) {
if (!w() || !h() || !d() || !array) return;
// Delete any existing pixmap/mask objects...
- if (id) {
- fl_delete_offscreen(id);
- id = 0;
- }
-
- if (mask) {
- fl_delete_bitmask(mask);
- mask = 0;
- }
+ uncache();
// Allocate memory as needed...
uchar *new_array,
@@ -254,15 +260,7 @@ void Fl_RGB_Image::desaturate() {
if (d() < 3) return;
// Delete any existing pixmap/mask objects...
- if (id) {
- fl_delete_offscreen(id);
- id = 0;
- }
-
- if (mask) {
- fl_delete_bitmask(mask);
- mask = 0;
- }
+ uncache();
// Allocate memory for a grayscale image...
uchar *new_array,
@@ -393,5 +391,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
//
-// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.21 2002/05/24 14:19:19 easysw Exp $".
+// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.22 2002/08/05 17:50:25 easysw Exp $".
//