< prev index next >

src/java.desktop/share/native/liblcms/cmsgamma.c

Print this page

        

*** 28,38 **** // file: // //--------------------------------------------------------------------------------- // // Little Color Management System ! // Copyright (c) 1998-2013 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, --- 28,38 ---- // file: // //--------------------------------------------------------------------------------- // // Little Color Management System ! // Copyright (c) 1998-2020 Marti Maria Saguer // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense,
*** 327,337 **** p ->InterpParams = _cmsComputeInterpParams(ContextID, p ->nEntries, 1, 1, p->Table16, CMS_LERP_FLAGS_16BITS); if (p->InterpParams != NULL) return p; Error: ! if (p -> Segments) _cmsFree(ContextID, p ->Segments); if (p -> Evals) _cmsFree(ContextID, p -> Evals); if (p ->Table16) _cmsFree(ContextID, p ->Table16); _cmsFree(ContextID, p); return NULL; } --- 327,338 ---- p ->InterpParams = _cmsComputeInterpParams(ContextID, p ->nEntries, 1, 1, p->Table16, CMS_LERP_FLAGS_16BITS); if (p->InterpParams != NULL) return p; Error: ! if (p -> SegInterp) _cmsFree(ContextID, p -> SegInterp); ! if (p -> Segments) _cmsFree(ContextID, p -> Segments); if (p -> Evals) _cmsFree(ContextID, p -> Evals); if (p ->Table16) _cmsFree(ContextID, p ->Table16); _cmsFree(ContextID, p); return NULL; }
*** 844,854 **** // Parametric curves // // Parameters goes as: Curve, a, b, c, d, e, f // Type is the ICC type +1 ! // if type is negative, then the curve is analyticaly inverted cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]) { cmsCurveSegment Seg0; int Pos = 0; cmsUInt32Number size; --- 845,855 ---- // Parametric curves // // Parameters goes as: Curve, a, b, c, d, e, f // Type is the ICC type +1 ! // if type is negative, then the curve is analytically inverted cmsToneCurve* CMSEXPORT cmsBuildParametricToneCurve(cmsContext ContextID, cmsInt32Number Type, const cmsFloat64Number Params[]) { cmsCurveSegment Seg0; int Pos = 0; cmsUInt32Number size;
*** 915,925 **** } if (Curve -> Evals) _cmsFree(ContextID, Curve -> Evals); ! if (Curve) _cmsFree(ContextID, Curve); } // Utility function, free 3 gamma tables void CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]) { --- 916,926 ---- } if (Curve -> Evals) _cmsFree(ContextID, Curve -> Evals); ! _cmsFree(ContextID, Curve); } // Utility function, free 3 gamma tables void CMSEXPORT cmsFreeToneCurveTriple(cmsToneCurve* Curve[3]) {
*** 1285,1295 **** return SuccessStatus; } // Is a table linear? Do not use parametric since we cannot guarantee some weird parameters resulting ! // in a linear table. This way assures it is linear in 12 bits, which should be enought in most cases. cmsBool CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve) { int i; int diff; --- 1286,1296 ---- return SuccessStatus; } // Is a table linear? Do not use parametric since we cannot guarantee some weird parameters resulting ! // in a linear table. This way assures it is linear in 12 bits, which should be enough in most cases. cmsBool CMSEXPORT cmsIsToneCurveLinear(const cmsToneCurve* Curve) { int i; int diff;
*** 1458,1462 **** --- 1459,1474 ---- if (Std > Precision) return -1.0; return (sum / n); // The mean } + + + // Retrieve parameters on one-segment tone curves + + cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t) + { + _cmsAssert(t != NULL); + + if (t->nSegments != 1) return NULL; + return t->Segments[0].Params; + }
< prev index next >