Changeset 15456
- Timestamp:
- Nov 5, 2007, 1:56:33 PM (19 years ago)
- Location:
- trunk/psLib/src/imageops
- Files:
-
- 2 edited
-
psImageStructManip.c (modified) (7 diffs)
-
psImageStructManip.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImageStructManip.c
r14921 r15456 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $11 * @date $Date: 2007- 09-20 23:48:47$10 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2007-11-05 23:56:33 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 32 32 // note that these are relative to the input col0,row0 33 33 // also note that col0,row0 may not be less than input->col0,row0 34 static psImage* imageSubset(psImage* out, 34 static psImage* imageSubset(const char *file, // File name of caller 35 unsigned int lineno, // Line number of caller 36 const char *func, // Function name of caller 37 psImage* out, 35 38 psImage* image, 36 39 psS32 col0, … … 99 102 if (out != NULL) { 100 103 // if a child, need to orphan (disassociate from parent) first 101 psImage *parent = (psImage *) out->parent;104 psImage *parent = (psImage *) out->parent; 102 105 if (parent != NULL) { 103 // break the back-pointer first so we don't loop104 out->parent = NULL;105 106 // drop my entry on my parent's array of children106 // break the back-pointer first so we don't loop 107 out->parent = NULL; 108 109 // drop my entry on my parent's array of children 107 110 psArrayRemoveDataNoFree (out->parent->children, out); 108 111 109 // drop my reference to my old parent110 psFree (parent);112 // drop my reference to my old parent 113 psFree (parent); 111 114 } 112 115 113 // we recycle out->data.V116 // we recycle out->data.V 114 117 psFree(out->p_rawDataBuffer); // free the previous data reference 115 118 } else { 116 out = p sAlloc(sizeof(psImage));119 out = p_psAlloc(file, lineno, func, sizeof(psImage)); 117 120 out->data.V = NULL; 118 121 } 119 122 120 out->data.V = psRealloc(out->data.V,sizeof(psPtr)*numRows); // resize row pointer array 123 out->data.V = p_psRealloc(file, lineno, func, out->data.V, 124 sizeof(psPtr)*numRows); // resize row pointer array 121 125 P_PSIMAGE_SET_TYPE(out, image->type); 122 126 P_PSIMAGE_SET_NUMCOLS(out, numCols); … … 141 145 142 146 // add output image as a child of the input image. 143 image->children = p sArrayAdd (image->children, 16, out);147 image->children = p_psArrayAdd(file, lineno, func, image->children, 16, out); 144 148 psFree (out); // the image->children array is an array of views only 145 149 … … 147 151 } 148 152 149 psImage* psImageSubset(psImage* image, 150 psRegion region) 151 { 152 return imageSubset(NULL,image,region.x0, region.y0, 153 region.x1, region.y1); 153 psImage* p_psImageSubset(const char *file, unsigned int lineno, const char *func, 154 psImage* image, psRegion region) 155 { 156 return imageSubset(file, lineno, func, NULL, image, region.x0, region.y0, region.x1, region.y1); 154 157 } 155 158 … … 158 161 psRegion region = {0, 0, 0, 0}; 159 162 region = psRegionForImage (input, region); 160 psImage *result = imageSubset (output, input, 161 region.x0, region.y0, 162 region.x1, region.y1); 163 psImage *result = imageSubset (__FILE__, __LINE__, __func__, output, input, 164 region.x0, region.y0, region.x1, region.y1); 163 165 return result; 164 166 } … … 318 320 319 321 if ((image->children != NULL) && (image->children->n > 0)) { 320 psAbort ("cannot trim an image with outstanding children");322 psAbort ("cannot trim an image with outstanding children"); 321 323 } 322 324 323 325 if (image->parent != NULL) { 324 return imageSubset(image, 325 (psImage*)image->parent, 326 region.x0+image->col0, 327 region.y0+image->row0, 328 region.x1+image->col0, 329 region.y1+image->row0); 326 return imageSubset(__FILE__, __LINE__, __func__, image, (psImage*)image->parent, 327 region.x0+image->col0, region.y0+image->row0, 328 region.x1+image->col0, region.y1+image->row0); 330 329 } 331 330 -
trunk/psLib/src/imageops/psImageStructManip.h
r12998 r15456 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $8 * @date $Date: 2007- 04-24 22:27:17$7 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2007-11-05 23:56:33 $ 9 9 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 10 10 */ … … 35 35 * 36 36 */ 37 #ifdef DOXYGEN 37 38 psImage* psImageSubset( 38 39 psImage* image, ///< Parent image. 39 40 psRegion region ///< region of subimage 40 41 ); 42 #else // ifdef DOXYGEN 43 psImage* p_psImageSubset( 44 const char *file, ///< File of caller 45 unsigned int lineno, ///< Line number of caller 46 const char *func, ///< Function name of caller 47 psImage* image, ///< Parent image. 48 psRegion region ///< region of subimage 49 ) PS_ATTR_MALLOC; 50 #define psImageSubset(image, region) \ 51 p_psImageSubset(__FILE__, __LINE__, __func__, image, region) 52 #endif // ifdef DOXYGEN 41 53 42 54 /** Makes a copy of the image view on the parent:
Note:
See TracChangeset
for help on using the changeset viewer.
