Index: core/fxcodec/codec/fx_codec_icc.cpp |
diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp |
index 1be4d48518890bf682657e0458ba8908309a0aae..085452223d2f505276cde3e4ac28b29fdf70afcd 100644 |
--- a/core/fxcodec/codec/fx_codec_icc.cpp |
+++ b/core/fxcodec/codec/fx_codec_icc.cpp |
@@ -7,6 +7,12 @@ |
#include "core/fxcodec/codec/codec_int.h" |
#include "core/fxcodec/fx_codec.h" |
#include "third_party/lcms2-2.6/include/lcms2.h" |
+ |
+const uint32_t N_COMPONENT_LAB = 3; |
+const uint32_t N_COMPONENT_GRAY = 1; |
+const uint32_t N_COMPONENT_RGB = 3; |
+const uint32_t N_COMPONENT_CMYK = 4; |
+const uint32_t N_COMPONENT_DEFAULT = 3; |
struct CLcmsCmm { |
cmsHTRANSFORM m_hTransform; |
@@ -51,6 +57,28 @@ |
return true; |
} |
+uint32_t GetCSComponents(cmsColorSpaceSignature cs) { |
+ uint32_t components; |
+ switch (cs) { |
+ case cmsSigLabData: |
+ components = N_COMPONENT_LAB; |
+ break; |
+ case cmsSigGrayData: |
+ components = N_COMPONENT_GRAY; |
+ break; |
+ case cmsSigRgbData: |
+ components = N_COMPONENT_RGB; |
+ break; |
+ case cmsSigCmykData: |
+ components = N_COMPONENT_CMYK; |
+ break; |
+ default: |
+ components = N_COMPONENT_DEFAULT; |
+ break; |
+ } |
+ return components; |
+} |
+ |
void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, |
uint32_t dwSrcProfileSize, |
uint32_t& nSrcComponents, |
@@ -80,7 +108,7 @@ |
int srcFormat; |
bool bLab = false; |
cmsColorSpaceSignature srcCS = cmsGetColorSpace(srcProfile); |
- nSrcComponents = cmsChannelsOf(srcCS); |
+ nSrcComponents = GetCSComponents(srcCS); |
if (srcCS == cmsSigLabData) { |
srcFormat = |
COLORSPACE_SH(PT_Lab) | CHANNELS_SH(nSrcComponents) | BYTES_SH(0); |