Changeset 11707
- Timestamp:
- Feb 8, 2007, 11:29:50 AM (19 years ago)
- Location:
- trunk/psLib/src/types
- Files:
-
- 2 edited
-
psPixels.c (modified) (5 diffs)
-
psPixels.h (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psPixels.c
r10999 r11707 7 7 * @author Robert DeSonia, MHPCC 8 8 * 9 * @version $Revision: 1.3 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-0 1-09 22:38:53$9 * @version $Revision: 1.31 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-02-08 21:29:50 $ 11 11 * 12 12 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 58 58 } 59 59 60 psPixels* psPixelsAlloc(long nalloc) 61 { 62 psPixels* out = psAlloc(sizeof(psPixels)); 60 psPixels* p_psPixelsAlloc(const char *file, 61 unsigned int lineno, 62 const char *func, 63 long nalloc) 64 { 65 psPixels* out = p_psAlloc(file, lineno, func, sizeof(psPixels)); 63 66 64 67 if (nalloc > 0) { 65 out->data = p sAlloc(sizeof(psPixelCoord)*nalloc);68 out->data = p_psAlloc(file, lineno, func, sizeof(psPixelCoord)*nalloc); 66 69 } else { 67 70 out->data = NULL; … … 83 86 84 87 85 psPixels* psPixelsRealloc(psPixels* pixels, 86 long nalloc) 87 { 88 if (pixels == NULL) { 89 return psPixelsAlloc(nalloc); 88 psPixels* p_psPixelsRealloc(const char *file, 89 unsigned int lineno, 90 const char *func, 91 psPixels* pixels, 92 long nalloc) 93 { 94 if (pixels == NULL) { 95 return p_psPixelsAlloc(file, lineno, func, nalloc); 90 96 } 91 97 92 98 if (nalloc > 0) { 93 pixels->data = p sRealloc(pixels->data, sizeof(psPixelCoord)*nalloc);99 pixels->data = p_psRealloc(file, lineno, func, pixels->data, sizeof(psPixelCoord)*nalloc); 94 100 } else { 95 101 psFree(pixels->data); … … 129 135 } 130 136 131 psPixels* psPixelsCopy(psPixels* out, 132 const psPixels* pixels) 137 psPixels* p_psPixelsCopy(const char *file, 138 unsigned int lineno, 139 const char *func, 140 psPixels* out, 141 const psPixels* pixels) 133 142 { 134 143 if (pixels == NULL) { … … 138 147 } 139 148 140 out = p sPixelsRealloc(out, pixels->n);149 out = p_psPixelsRealloc(file, lineno, func, out, pixels->n); 141 150 142 151 memcpy(out->data,pixels->data, pixels->n*sizeof(psPixelCoord)); -
trunk/psLib/src/types/psPixels.h
r11248 r11707 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 1-23 22:47:23$8 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-02-08 21:29:50 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 52 52 53 53 54 /** Allocates a new psPixels structure 55 * 56 * @return psPixels* new psPixels 57 */ 58 psPixels* psPixelsAlloc( 59 long nalloc ///< the size of the coordinate vectors 60 ) 61 ; 54 /** Allocates a new psPixels structure 55 * 56 * @return psPixels* new psPixels 57 */ 58 #ifdef DOXYGEN 59 psPixels* psPixelsAlloc( 60 long nalloc ///< the size of the coordinate vectors 61 ); 62 #else // ifdef DOXYGEN 63 psPixels* p_psPixelsAlloc( 64 const char *file, ///< File of caller 65 unsigned int lineno, ///< Line number of caller 66 const char *func, ///< Function name of caller 67 long nalloc ///< the size of the coordinate vectors 68 ); 69 #define psPixelsAlloc(nalloc) \ 70 p_psPixelsAlloc(__FILE__, __LINE__, __func__, nalloc) 71 #endif // ifdef DOXYGEN 72 62 73 63 74 /** Checks the type of a particular pointer. 64 75 * 65 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 76 * Uses the appropriate deallocation function in psMemBlock to check the ptr 77 * datatype. 66 78 * 67 79 * @return bool: True if the pointer matches a psPixels structure, false otherwise. … … 76 88 * @return psPixels* resized psPixels 77 89 */ 90 #ifdef DOXYGEN 78 91 psPixels* psPixelsRealloc( 79 92 psPixels* pixels, ///< psPixels to resize, or NULL to create new psPixels 80 93 long nalloc ///< the size of the coordinate vectors 81 94 ); 95 #else // ifdef DOXYGEN 96 psPixels* p_psPixelsRealloc( 97 const char *file, ///< File of caller 98 unsigned int lineno, ///< Line number of caller 99 const char *func, ///< Function name of caller 100 psPixels* pixels, ///< psPixels to resize, or NULL to create new psPixels 101 long nalloc ///< the size of the coordinate vectors 102 ); 103 #define psPixelsRealloc(pixels, nalloc) \ 104 p_psPixelsRealloc(__FILE__, __LINE__, __func__, pixels, nalloc) 105 #endif // ifdef DOXYGEN 106 82 107 83 108 /** Add a pixel location to a psPixels … … 95 120 ); 96 121 122 97 123 /** Copies a psPixels object 98 124 * … … 102 128 * @return psPixels* a new psPixels that is a duplicate to IN 103 129 */ 130 #ifdef DOXYGEN 104 131 psPixels* psPixelsCopy( 105 132 psPixels* out, ///< psPixels struct to recycle, or NULL 106 133 const psPixels* pixels ///< psPixels struct to copy 107 134 ); 135 #else // ifdef DOXYGEN 136 psPixels* p_psPixelsCopy( 137 const char *file, ///< File of caller 138 unsigned int lineno, ///< Line number of caller 139 const char *func, ///< Function name of caller 140 psPixels* out, ///< psPixels struct to recycle, or NULL 141 const psPixels* pixels ///< psPixels struct to copy 142 ); 143 #define psPixelsCopy(out, pixels) \ 144 p_psPixelsCopy(__FILE__, __LINE__, __func__, out, pixels) 145 #endif // ifdef DOXYGEN 146 108 147 109 148 /** Generate a psImage from a psPixels … … 126 165 ); 127 166 167 128 168 /** Generate a psPixels from a mask psImage 129 169 * … … 140 180 psMaskType maskVal ///< the mask bit-values to act upon 141 181 ); 182 142 183 143 184 /** Concatenates two psPixels … … 155 196 const psPixels *pixels ///< psPixels to append to OUT 156 197 ); 198 157 199 158 200 /** Prints a psPixels to specified destination. … … 166 208 ); 167 209 210 168 211 /** Sets the value of the the pixels array at the specified position to value. 169 212 * … … 178 221 ); 179 222 223 180 224 /** Returns the value of the pixels array at the specified position. 181 225 * … … 189 233 ); 190 234 235 191 236 /** Get the number of elements in use from a specified psPixels. (pixels.n) 192 237 * … … 197 242 ); 198 243 244 199 245 /// @} 200 246 #endif // #ifndef PS_PIXELS_H
Note:
See TracChangeset
for help on using the changeset viewer.
