Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/colortools.c')
-rw-r--r--source/blender/blenkernel/intern/colortools.c63
1 files changed, 41 insertions, 22 deletions
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 11801557c99..90ffa39c88f 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -782,36 +782,55 @@ void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const
vecout[2]= curvemap_evaluateF(cumap->cm+2, fac);
}
+
+#ifdef WITH_LCMS
+/* basic error handler, if we dont do this blender will exit */
+static int ErrorReportingFunction(int ErrorCode, const char *ErrorText)
+{
+ fprintf(stderr, "%s:%d\n", ErrorText, ErrorCode);
+ return 1;
+}
+#endif
+
void colorcorrection_do_ibuf(ImBuf *ibuf, const char *profile)
{
+#ifdef WITH_LCMS
if (ibuf->crect == NULL)
{
-#ifdef WITH_LCMS
- cmsHPROFILE imageProfile, proofingProfile;
- cmsHTRANSFORM hTransform;
+ cmsHPROFILE proofingProfile;
- ibuf->crect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(int), "imbuf crect");
-
- imageProfile = cmsCreate_sRGBProfile();
- proofingProfile = cmsOpenProfileFromFile(profile, "r");
+ /* TODO, move to initialization area of code */
+ //cmsSetLogErrorHandler(ErrorReportingFunction);
+ cmsSetErrorHandler(ErrorReportingFunction);
+ /* will return NULL if the file isn't fount */
+ proofingProfile = cmsOpenProfileFromFile(profile, "r");
+
cmsErrorAction(LCMS_ERROR_SHOW);
-
- hTransform = cmsCreateProofingTransform(imageProfile, TYPE_RGBA_8, imageProfile, TYPE_RGBA_8,
- proofingProfile,
- INTENT_ABSOLUTE_COLORIMETRIC,
- INTENT_ABSOLUTE_COLORIMETRIC,
- cmsFLAGS_SOFTPROOFING);
-
- cmsDoTransform(hTransform, ibuf->rect, ibuf->crect, ibuf->x * ibuf->y);
-
- cmsDeleteTransform(hTransform);
- cmsCloseProfile(imageProfile);
- cmsCloseProfile(proofingProfile);
-#else
- ibuf->crect = ibuf->rect;
-#endif
+
+ if(proofingProfile) {
+ cmsHPROFILE imageProfile;
+ cmsHTRANSFORM hTransform;
+
+ ibuf->crect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(int), "imbuf crect");
+
+ imageProfile = cmsCreate_sRGBProfile();
+
+
+ hTransform = cmsCreateProofingTransform(imageProfile, TYPE_RGBA_8, imageProfile, TYPE_RGBA_8,
+ proofingProfile,
+ INTENT_ABSOLUTE_COLORIMETRIC,
+ INTENT_ABSOLUTE_COLORIMETRIC,
+ cmsFLAGS_SOFTPROOFING);
+
+ cmsDoTransform(hTransform, ibuf->rect, ibuf->crect, ibuf->x * ibuf->y);
+
+ cmsDeleteTransform(hTransform);
+ cmsCloseProfile(imageProfile);
+ cmsCloseProfile(proofingProfile);
+ }
}
+#endif
}
/* only used for image editor curves */