Changeset 2074 for trunk/psLib/src/image/psImageExtraction.c
- Timestamp:
- Oct 12, 2004, 4:40:13 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/image/psImageExtraction.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageExtraction.c
r2067 r2074 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.2 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2004-10-13 0 0:10:50$11 * @version $Revision: 1.23 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2004-10-13 02:40:13 $ 13 13 * 14 14 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 195 195 } 196 196 197 if (col1 < 1) { 198 col1 += image->numCols; 199 } 200 201 if (row1 < 1) { 202 row1 += image->numRows; 203 } 204 197 205 if ( col0 < 0 || 198 206 row0 < 0 || 199 col1 > =image->numCols ||200 row1 > =image->numRows ||201 col0 > col1 ||202 row0 > row1 ) {207 col1 > image->numCols || 208 row1 > image->numRows || 209 col0 >= col1 || 210 row0 >= row1 ) { 203 211 psErrorMsg(PS_ERRORNAME_DOMAIN "psImageTrim", 204 212 PS_ERR_BAD_PARAMETER_VALUE, true, 205 213 PS_ERRORTEXT_psImage_SUBSET_RANGE_INVALID, 206 col0, col1, row0, row1, 207 image->numCols, image->numRows); 214 col0, col1-1, row0, row1-1, 215 image->numCols-1, image->numRows-1); 216 psFree(image); 208 217 return NULL; 209 218 } … … 212 221 213 222 unsigned int elementSize = PSELEMTYPE_SIZEOF(image->type.type); 214 unsigned int numCols = col1-col0 +1;215 unsigned int numRows = row1-row0 +1;223 unsigned int numCols = col1-col0; 224 unsigned int numRows = row1-row0; 216 225 unsigned int rowSize = elementSize*numCols; 217 226 unsigned int colOffset = elementSize * col0; 218 void* imageData = image->rawDataBuffer;227 psU8* imageData = image->rawDataBuffer; 219 228 for (int row = row0; row < row1; row++) { 220 229 memmove(imageData,image->data.U8[row] + colOffset,rowSize); 221 imageData = (psU8*)imageData +rowSize;230 imageData += rowSize; 222 231 } 223 232 … … 265 274 } 266 275 267 if (col1 < 0) {276 if (col1 < 1) { 268 277 col1 += in->numCols; 269 278 } 270 279 271 if (row1 < 0) {280 if (row1 < 1) { 272 281 row1 += in->numRows; 273 282 } … … 275 284 if ( col0 < 0 || 276 285 row0 < 0 || 277 col1 > =in->numCols ||278 row1 > =in->numRows ||286 col1 > in->numCols || 287 row1 > in->numRows || 279 288 col0 >= col1 || 280 289 row0 >= row1) {
Note:
See TracChangeset
for help on using the changeset viewer.
