//---------------------------------------------------------------------------------
//
// Little Color Management System
-// Copyright (c) 1998-2012 Marti Maria Saguer
+// Copyright (c) 1998-2016 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"),
goto Error;
} else {
NewElem ->Tab.T = (cmsUInt16Number*) _cmsDupMem(mpe ->ContextID, Data ->Tab.T, Data ->nEntries * sizeof (cmsUInt16Number));
- if (NewElem ->Tab.TFloat == NULL)
+ if (NewElem ->Tab.T == NULL)
goto Error;
}
}
return mpe;
}
+// Clips values smaller than zero
+static
+void Clipper(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage *mpe)
+{
+ cmsUInt32Number i;
+ for (i = 0; i < mpe->InputChannels; i++) {
+
+ cmsFloat32Number n = In[i];
+ Out[i] = n < 0 ? 0 : n;
+ }
+}
+cmsStage* _cmsStageClipNegatives(cmsContext ContextID, int nChannels)
+{
+ return _cmsStageAllocPlaceholder(ContextID, cmsSigClipNegativesElemType,
+ nChannels, nChannels, Clipper, NULL, NULL, NULL);
+}
// ********************************************************************************
// Type cmsSigXYZ2LabElemType
First = FALSE;
}
else {
- Anterior ->Next = NewMPE;
+ if (Anterior != NULL)
+ Anterior ->Next = NewMPE;
}
Anterior = NewMPE;
for (pt = lut ->Elements;
pt != NULL;
pt = pt -> Next) Anterior = pt;
-
+
Anterior ->Next = mpe;
mpe ->Next = NULL;
}