Changeset 6574 for trunk/psLib/src/mathtypes
- Timestamp:
- Mar 13, 2006, 4:22:55 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/mathtypes/psImage.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r6331 r6574 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.9 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2006-0 2-06 22:19:28$11 * @version $Revision: 1.96 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-03-14 02:22:55 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 291 291 double complex value) 292 292 { 293 if (image == NULL) { 294 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL); 293 /* if (image == NULL) { 294 psError(PS_ERR_BAD_PARAMETER_NULL, true, PS_ERRORTEXT_psImage_IMAGE_NULL); 295 return false; 296 } 297 if (x >= image->numRows || y >= image->numCols) { 298 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 299 "Invalid position %d. Position out of range (%d-%d)\n", x, ); 300 return false; 301 } 302 303 if(x < 0) 304 x += image->numRows; 305 if(x < 0) { 306 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid x. Negative number too large\n"); 307 return false; 308 } 309 310 if(y < 0) 311 y += image->numCols; 312 if(y < 0) { 313 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid y. Negative number too large\n"); 314 return false; 315 } 316 317 */ 318 PS_ASSERT_IMAGE_NON_NULL(image, false); 319 PS_ASSERT_INT_NONNEGATIVE(image->col0, false); 320 PS_ASSERT_INT_NONNEGATIVE(image->row0, false); 321 PS_ASSERT_INT_NONNEGATIVE(image->numCols, false); 322 PS_ASSERT_INT_NONNEGATIVE(image->numRows, false); 323 if ( x >= (image->col0 + image->numCols) ) { 324 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 325 "Invalid x-position %d. Position out of range (%d-%d)\n", 326 x, image->col0, image->numCols+image->col0-1 ); 295 327 return false; 296 } 297 if (x >= image->numRows || y >= image->numCols) { 298 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid position. Position too large\n"); 328 } else if ( y >= (image->row0 + image->numRows) ) { 329 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 330 "Invalid y-position %d. Position out of range (%d-%d)\n", 331 y, image->row0, image->numRows+image->row0-1 ); 299 332 return false; 300 } 301 302 if(x < 0) 303 x += image->numRows; 304 if(x < 0) { 305 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid x. Negative number too large\n"); 333 } else if (x < image->col0 && x >= 0) { 334 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 335 "Invalid x-position %d. Position out of range (%d-%d)\n", 336 x, image->col0, image->numCols+image->col0-1 ); 306 337 return false; 307 } 308 309 if(y < 0) 310 y += image->numCols; 311 if(y < 0) { 312 psError(PS_ERR_BAD_PARAMETER_SIZE, true, "Invalid y. Negative number too large\n"); 338 } else if (y < image->row0 && y >= 0) { 339 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 340 "Invalid y-position %d. Position out of range (%d-%d)\n", 341 y, image->row0, image->numRows+image->row0-1 ); 313 342 return false; 343 } else if (x < 0 || y < 0) { 344 if (x < 0) { 345 x += image->numCols; 346 } 347 if (x < 0) { 348 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 349 "Invalid x-position %d. Position out of range (%d-%d)\n", 350 (x+image->col0), image->col0, image->numCols+image->col0-1 ); 351 return false; 352 } 353 if (y < 0) { 354 y += image->numRows; 355 } 356 if (y < 0) { 357 psError(PS_ERR_BAD_PARAMETER_SIZE, true, 358 "Invalid y-position %d. Position out of range (%d-%d)\n", 359 (y+image->row0), image->row0, image->numRows+image->row0-1 ); 360 return false; 361 } 362 } else { 363 x -= image->col0; 364 y -= image->row0; 314 365 } 315 366
Note:
See TracChangeset
for help on using the changeset viewer.
