From c7535ca8ef92af5adcb58d1b33e15933c27951c5 Mon Sep 17 00:00:00 2001
From: Tor Andersson <tor.andersson@artifex.com>
Date: Wed, 10 Oct 2018 12:53:32 +0200
Subject: Rename NO_ICC to FZ_ENABLE_ICC=0|1 to match other config.h options.

---
 source/fitz/color-lcms.c |  2 +-
 source/fitz/colorspace.c | 40 +++++++++++++++++++++-------------------
 2 files changed, 22 insertions(+), 20 deletions(-)

(limited to 'source/fitz')

diff --git a/source/fitz/color-lcms.c b/source/fitz/color-lcms.c
index f4fc1ac8..1f94c428 100644
--- a/source/fitz/color-lcms.c
+++ b/source/fitz/color-lcms.c
@@ -1,6 +1,6 @@
 #include "mupdf/fitz.h"
 
-#ifndef NO_ICC
+#if FZ_ENABLE_ICC
 #include "lcms2mt.h"
 #include "lcms2mt_plugin.h"
 #include "colorspace-imp.h"
diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c
index de3b3578..4a957d20 100644
--- a/source/fitz/colorspace.c
+++ b/source/fitz/colorspace.c
@@ -147,15 +147,7 @@ void fz_cmm_fin_profile(fz_context *ctx, fz_iccprofile *profile)
 
 #define SLOWCMYK
 
-#ifdef NO_ICC
-
-const unsigned char *
-fz_lookup_icc(fz_context *ctx, enum fz_colorspace_type type, size_t *size)
-{
-	return *size = 0, NULL;
-}
-
-#else
+#if FZ_ENABLE_ICC
 
 #include "icc/gray.icc.h"
 #include "icc/rgb.icc.h"
@@ -186,6 +178,14 @@ fz_lookup_icc(fz_context *ctx, enum fz_colorspace_type type, size_t *size)
 	return *size = 0, NULL;
 }
 
+#else
+
+const unsigned char *
+fz_lookup_icc(fz_context *ctx, enum fz_colorspace_type type, size_t *size)
+{
+	return *size = 0, NULL;
+}
+
 #endif
 
 /* Same order as needed by lcms */
@@ -835,10 +835,7 @@ void fz_set_cmm_engine(fz_context *ctx, const fz_cmm_engine *engine)
 	if (!cct)
 		return;
 
-#ifdef NO_ICC
-	if (engine)
-		fz_throw(ctx, FZ_ERROR_GENERIC, "ICC workflow not supported in NO_ICC build");
-#else
+#if FZ_ENABLE_ICC
 	if (cct->cmm == engine)
 		return;
 
@@ -885,6 +882,9 @@ void fz_set_cmm_engine(fz_context *ctx, const fz_cmm_engine *engine)
 	}
 	else
 		set_no_icc(cct);
+#else
+	if (engine)
+		fz_throw(ctx, FZ_ERROR_GENERIC, "ICC workflow not supported in FZ_ENABLE_ICC=0 build");
 #endif
 }
 
@@ -893,10 +893,10 @@ void fz_new_colorspace_context(fz_context *ctx)
 	ctx->colorspace = fz_malloc_struct(ctx, fz_colorspace_context);
 	ctx->colorspace->ctx_refs = 1;
 	set_no_icc(ctx->colorspace);
-#ifdef NO_ICC
-	fz_set_cmm_engine(ctx, NULL);
-#else
+#if FZ_ENABLE_ICC
 	fz_set_cmm_engine(ctx, &fz_cmm_engine_lcms);
+#else
+	fz_set_cmm_engine(ctx, NULL);
 #endif
 }
 
@@ -3735,6 +3735,7 @@ const char *fz_colorspace_name(fz_context *ctx, const fz_colorspace *cs)
 	return cs ? cs->name : "";
 }
 
+#if FZ_ENABLE_ICC
 static void
 free_icc(fz_context *ctx, fz_colorspace *cs)
 {
@@ -3775,13 +3776,12 @@ static const char *colorspace_name_from_type(int type)
 	case FZ_COLORSPACE_LAB: return "Lab";
 	}
 }
+#endif
 
 fz_colorspace *
 fz_new_icc_colorspace(fz_context *ctx, enum fz_colorspace_type type, fz_buffer *buf)
 {
-#ifdef NO_ICC
-	fz_throw(ctx, FZ_ERROR_GENERIC, "ICC Profiles not supported in NO_ICC build");
-#else
+#if FZ_ENABLE_ICC
 	fz_colorspace *cs = NULL;
 	fz_iccprofile *profile;
 	int flags = FZ_COLORSPACE_IS_ICC;
@@ -3886,6 +3886,8 @@ fz_new_icc_colorspace(fz_context *ctx, enum fz_colorspace_type type, fz_buffer *
 		fz_rethrow(ctx);
 	}
 	return cs;
+#else
+	fz_throw(ctx, FZ_ERROR_GENERIC, "ICC Profiles not supported in FZ_ENABLE_ICC=0 build");
 #endif
 }
 
-- 
cgit v1.2.3