libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/cvd image.h


From: Edward Rosten
Subject: [libcvd-members] libcvd/cvd image.h
Date: Wed, 28 Mar 2007 21:59:49 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Edward Rosten <edrosten>        07/03/28 21:59:49

Modified files:
        cvd            : image.h 

Log message:
        Resize now does not perform allocation if the image has a refcount of 1
        and the correct size. This means that img_load and the lazy img_convert 
        work in place, where possible.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/image.h?cvsroot=libcvd&r1=1.33&r2=1.34

Patches:
Index: image.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/image.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- image.h     16 Jan 2007 23:51:57 -0000      1.33
+++ image.h     28 Mar 2007 21:59:49 -0000      1.34
@@ -776,23 +776,32 @@
                        dup_from(&tmp);
                }
 
-               ///Resize the image (destroying the data). The image is resized 
even if the new size is the same as the old one.
+               ///Resize the image (destroying the data).
+               ///This does not affect any other images pointing to this data.
                ///@param size The new size of the image
                void resize(const ImageRef& size)
                {
+                       if(size != BasicImage<T>::my_size || *num_copies > 1)
+                       {
                        Image<T> new_im(size);
                        *this = new_im;
                }
+               }
 
-               ///Resize the image (destroying the data). The image is resized 
even if the new size is the same as the old one.
-               //The resized image is filled with val
+               ///Resize the image (destroying the data). 
+               ///This does not affect any other images pointing to this data.
+               //The resized image is filled with val.
                ///@param size The new size of the image
                ///@param val  The value to fill the image with
                void resize(const ImageRef& size, const T& val)
                {
+                       if(*num_copies > 1 || size != BasicImage<T>::my_size)
+                       {
                        Image<T> new_im(size, val);
                        *this = new_im;
                }
+                               else fill(val);
+               }
 
                ///The destructor removes the image data
                ~Image()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]