summaryrefslogtreecommitdiff
path: root/src/Fl_Shared_Image.cxx
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-05-25 02:56:59 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-05-25 02:56:59 +0000
commitf79c2375da765077fd6cbd9fbaf9fe20bcbf5a55 (patch)
tree8993637e99c915f3a7f153a998b341e62d753b5c /src/Fl_Shared_Image.cxx
parent30b57935f9fdccee9e830cfded039dfa2a1602b3 (diff)
Tag image data as allocated so that we don't waste memory.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2257 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Shared_Image.cxx')
-rw-r--r--src/Fl_Shared_Image.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx
index db73a295c..3b2e874a2 100644
--- a/src/Fl_Shared_Image.cxx
+++ b/src/Fl_Shared_Image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Shared_Image.cxx,v 1.23.2.10 2002/05/25 02:27:20 easysw Exp $"
+// "$Id: Fl_Shared_Image.cxx,v 1.23.2.11 2002/05/25 02:56:59 easysw Exp $"
//
// Shared image code for the Fast Light Tool Kit (FLTK).
//
@@ -275,6 +275,12 @@ Fl_Shared_Image::copy(int W, int H) {
Fl_Image *temp_image; // New image file
Fl_Shared_Image *temp_shared; // New shared image
+ // See if the new and old sizes are the same...
+ if (image_ && image_->w() == W && image_->h() == H) {
+ refcount_ ++;
+ return (this);
+ }
+
// Make a copy of the image we're sharing...
if (!image_) temp_image = 0;
else temp_image = image_->copy(W, H);
@@ -287,7 +293,7 @@ Fl_Shared_Image::copy(int W, int H) {
temp_shared->refcount_ = 1;
temp_shared->image_ = temp_image;
- temp_shared->alloc_image_ = 0;
+ temp_shared->alloc_image_ = 1;
temp_shared->update();
@@ -455,5 +461,5 @@ Fl_Shared_Image::remove_handler(Fl_Shared_Handler *f) {
//
-// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.10 2002/05/25 02:27:20 easysw Exp $".
+// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.11 2002/05/25 02:56:59 easysw Exp $".
//