Changeset 1606 for trunk/psLib/src/image/psImage.c
- Timestamp:
- Aug 23, 2004, 12:36:04 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImage.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImage.c
r1440 r1606 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1. 39$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-08- 09 23:34:58$12 * @version $Revision: 1.40 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-23 22:36:03 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 43 43 { 44 44 int area = 0; 45 int elementSize = PSELEMTYPE_SIZEOF(type); // element 46 47 // size in 48 // bytes 49 int rowSize = numCols * elementSize; // row 50 51 // size 52 53 // in bytes. 45 int elementSize = PSELEMTYPE_SIZEOF(type); // element size in bytes 46 int rowSize = numCols * elementSize; // row size in bytes. 54 47 55 48 area = numCols * numRows; … … 71 64 image->data.V = psAlloc(sizeof(void *) * numRows); 72 65 if (image->data.V == NULL) { 66 psFree(image); 73 67 psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__); 74 68 } 75 69 76 image->data.V[0] = psAlloc(area * elementSize); 77 if (image->data.V[0] == NULL) { 70 image->rawDataBuffer = psAlloc(area * elementSize); 71 if (image->rawDataBuffer == NULL) { 72 psFree(image); 73 psFree(image->data.V); 78 74 psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__); 79 75 } 80 76 77 // set the row pointers. 78 image->data.V[0] = image->rawDataBuffer; 81 79 for (int i = 1; i < numRows; i++) { 82 80 image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize); … … 119 117 psImageFreeChildren(image); 120 118 121 psFree(image-> data.V[0]);119 psFree(image->rawDataBuffer); 122 120 psFree(image->data.V); 123 121 image->data.V = NULL; … … 167 165 } 168 166 // Resize the image buffer 169 old-> data.V[0]= psRealloc(old->data.V[0], numCols * numRows * elementSize);167 old->rawDataBuffer = psRealloc(old->data.V[0], numCols * numRows * elementSize); 170 168 old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *)); 171 169 172 170 // recreate the row pointers 171 old->data.V[0] = old->rawDataBuffer; 173 172 for (int i = 1; i < numRows; i++) { 174 173 old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
Note:
See TracChangeset
for help on using the changeset viewer.
