Changeset 1653 for trunk/psLib/src/image/psImage.c
- Timestamp:
- Aug 27, 2004, 3:18:28 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImage.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImage.c
r1634 r1653 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.4 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08-2 7 19:05:40$12 * @version $Revision: 1.42 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-28 01:18:28 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 * That is the routine used to generate matrices. 18 18 */ 19 20 /******************************************************************************/21 22 /* INCLUDE FILES */23 24 /******************************************************************************/25 19 26 20 #include <string.h> … … 33 27 34 28 static void imageFree(psImage* image); 35 36 /*****************************************************************************/37 38 /* FUNCTION IMPLEMENTATION - PUBLIC */39 40 /*****************************************************************************/41 29 42 30 psImage* psImageAlloc(unsigned int numCols, … … 52 40 if (area < 1) { 53 41 psError(__func__, 54 "Invalid value for number of rows or columns " "(numRows=%d, numCols=%d).", numRows, numCols); 42 "Invalid value for number of rows or columns " 43 "(numRows=%d, numCols=%d).", 44 numRows, numCols); 55 45 return NULL; 56 46 } … … 129 119 const psElemType type) 130 120 { 131 int elementSize = PSELEMTYPE_SIZEOF(type); // element 132 133 // size in 134 // bytes 135 int rowSize = numCols * elementSize; // row 136 137 // size 138 139 // in bytes. 121 int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 122 int rowSize = numCols * elementSize; // row size in bytes. 140 123 141 124 if (old == NULL) { … … 145 128 146 129 if (old->type.dimen != PS_DIMEN_IMAGE) { 147 psError(__func__, "Can not realloc image because input is not an image."); 130 psError(__func__, 131 "Can not realloc image because input is not an image."); 148 132 return NULL; 149 133 } … … 166 150 167 151 /* image already the right size/type? */ 168 if (numCols == old->numCols && numRows == old->numRows && type == old->type.type) { 152 if (numCols == old->numCols && numRows == old->numRows && 153 type == old->type.type) { 169 154 return old; 170 155 } 171 156 // Resize the image buffer 172 old->rawDataBuffer = psRealloc(old->data.V[0], numCols * numRows * elementSize); 157 old->rawDataBuffer = psRealloc(old->data.V[0], 158 numCols * numRows * elementSize); 173 159 old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *)); 174 160
Note:
See TracChangeset
for help on using the changeset viewer.
