OLD | NEW |
1 //------------------------------------------------------------------------------
--- | 1 //------------------------------------------------------------------------------
--- |
2 // | 2 // |
3 // Little Color Management System | 3 // Little Color Management System |
4 // Copyright (c) 1998-2012 Marti Maria Saguer | 4 // Copyright (c) 1998-2012 Marti Maria Saguer |
5 // | 5 // |
6 // Permission is hereby granted, free of charge, to any person obtaining | 6 // Permission is hereby granted, free of charge, to any person obtaining |
7 // a copy of this software and associated documentation files (the "Software"), | 7 // a copy of this software and associated documentation files (the "Software"), |
8 // to deal in the Software without restriction, including without limitation | 8 // to deal in the Software without restriction, including without limitation |
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 cmsStage* NewMPE; | 384 cmsStage* NewMPE; |
385 | 385 |
386 n = Rows * Cols; | 386 n = Rows * Cols; |
387 | 387 |
388 // Check for overflow | 388 // Check for overflow |
389 if (n == 0) return NULL; | 389 if (n == 0) return NULL; |
390 if (n >= UINT_MAX / Cols) return NULL; | 390 if (n >= UINT_MAX / Cols) return NULL; |
391 if (n >= UINT_MAX / Rows) return NULL; | 391 if (n >= UINT_MAX / Rows) return NULL; |
392 if (n < Rows || n < Cols) return NULL; | 392 if (n < Rows || n < Cols) return NULL; |
393 | 393 |
394 NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigMatrixElemType, Cols, Ro
ws, | 394 NewMPE = _cmsStageAllocPlaceholder(ContextID, cmsSigMatrixElemType, Rows, Co
ls, |
395 EvaluateMatrix, MatrixElemDup, MatrixElemTy
peFree, NULL ); | 395 EvaluateMatrix, MatrixElemDup, MatrixElemTy
peFree, NULL ); |
396 if (NewMPE == NULL) return NULL; | 396 if (NewMPE == NULL) return NULL; |
397 | 397 |
398 | 398 |
399 NewElem = (_cmsStageMatrixData*) _cmsMallocZero(ContextID, sizeof(_cmsStageM
atrixData)); | 399 NewElem = (_cmsStageMatrixData*) _cmsMallocZero(ContextID, sizeof(_cmsStageM
atrixData)); |
400 if (NewElem == NULL) return NULL; | 400 if (NewElem == NULL) return NULL; |
401 | 401 |
402 | 402 |
403 NewElem ->Double = (cmsFloat64Number*) _cmsCalloc(ContextID, n, sizeof(cmsFl
oat64Number)); | 403 NewElem ->Double = (cmsFloat64Number*) _cmsCalloc(ContextID, n, sizeof(cmsFl
oat64Number)); |
404 | 404 |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 // Some clipping.... | 1784 // Some clipping.... |
1785 for (j=0; j < 3; j++) { | 1785 for (j=0; j < 3; j++) { |
1786 if (x[j] < 0) x[j] = 0; | 1786 if (x[j] < 0) x[j] = 0; |
1787 else | 1787 else |
1788 if (x[j] > 1.0) x[j] = 1.0; | 1788 if (x[j] > 1.0) x[j] = 1.0; |
1789 } | 1789 } |
1790 } | 1790 } |
1791 | 1791 |
1792 return TRUE; | 1792 return TRUE; |
1793 } | 1793 } |
OLD | NEW |