Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //------------------------------------------------------------------------------ --- | 1 //------------------------------------------------------------------------------ --- |
| 2 // | 2 // |
| 3 // Little Color Management System | 3 // Little Color Management System |
| 4 // Copyright (c) 1998-2013 Marti Maria Saguer | 4 // Copyright (c) 1998-2013 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 815 Curve[0] = Curve[1] = Curve[2] = NULL; | 815 Curve[0] = Curve[1] = Curve[2] = NULL; |
| 816 } | 816 } |
| 817 | 817 |
| 818 | 818 |
| 819 // Duplicate a gamma table | 819 // Duplicate a gamma table |
| 820 cmsToneCurve* CMSEXPORT cmsDupToneCurve(const cmsToneCurve* In) | 820 cmsToneCurve* CMSEXPORT cmsDupToneCurve(const cmsToneCurve* In) |
| 821 { | 821 { |
| 822 // Xiaochuan Liu | 822 // Xiaochuan Liu |
| 823 // fix openpdf bug(mantis id:0055683, google id:360198) | 823 // fix openpdf bug(mantis id:0055683, google id:360198) |
| 824 // the function CurveSetElemTypeFree in cmslut.c also needs to check poi nter | 824 // the function CurveSetElemTypeFree in cmslut.c also needs to check poi nter |
| 825 if (In == NULL || In ->InterpParams == NULL) return NULL; | 825 if (In == NULL || In ->InterpParams == NULL || In ->Segments == NULL || In - >Table16 == NULL) return NULL; |
|
jun_fang
2014/09/03 18:52:13
Seems that these the checking for |In ->Segments =
| |
| 826 | 826 |
| 827 return AllocateToneCurveStruct(In ->InterpParams ->ContextID, In ->nEntries , In ->nSegments, In ->Segments, In ->Table16); | 827 return AllocateToneCurveStruct(In ->InterpParams ->ContextID, In ->nEntries , In ->nSegments, In ->Segments, In ->Table16); |
| 828 } | 828 } |
| 829 | 829 |
| 830 // Joins two curves for X and Y. Curves should be monotonic. | 830 // Joins two curves for X and Y. Curves should be monotonic. |
| 831 // We want to get | 831 // We want to get |
| 832 // | 832 // |
| 833 // y = Y^-1(X(t)) | 833 // y = Y^-1(X(t)) |
| 834 // | 834 // |
| 835 cmsToneCurve* CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, | 835 cmsToneCurve* CMSEXPORT cmsJoinToneCurve(cmsContext ContextID, |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 // Take a look on SD to see if gamma isn't exponential at all | 1291 // Take a look on SD to see if gamma isn't exponential at all |
| 1292 Std = sqrt((n * sum2 - sum * sum) / (n*(n-1))); | 1292 Std = sqrt((n * sum2 - sum * sum) / (n*(n-1))); |
| 1293 | 1293 |
| 1294 if (Std > Precision) | 1294 if (Std > Precision) |
| 1295 return -1.0; | 1295 return -1.0; |
| 1296 | 1296 |
| 1297 return (sum / n); // The mean | 1297 return (sum / n); // The mean |
| 1298 } | 1298 } |
| OLD | NEW |