| 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 876297fd40faf210504a27dda10b6123451fa0e8..4903c247159e628b7e057d91ffb37c6433a2d1fc 100644
|
| --- a/core/fxcodec/codec/fx_codec_icc.cpp
|
| +++ b/core/fxcodec/codec/fx_codec_icc.cpp
|
| @@ -98,15 +98,13 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
|
| int intent,
|
| uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT,
|
| uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) {
|
| - cmsHPROFILE srcProfile = NULL;
|
| - cmsHPROFILE dstProfile = NULL;
|
| - cmsHTRANSFORM hTransform = NULL;
|
| - CLcmsCmm* pCmm = NULL;
|
| nSrcComponents = 0;
|
| - srcProfile = cmsOpenProfileFromMem((void*)pSrcProfileData, dwSrcProfileSize);
|
| - if (!srcProfile) {
|
| - return NULL;
|
| - }
|
| + cmsHPROFILE srcProfile =
|
| + cmsOpenProfileFromMem((void*)pSrcProfileData, dwSrcProfileSize);
|
| + if (!srcProfile)
|
| + return nullptr;
|
| +
|
| + cmsHPROFILE dstProfile;
|
| if (!pDstProfileData && dwDstProfileSize == 0 && nDstComponents == 3) {
|
| dstProfile = cmsCreate_sRGBProfile();
|
| } else {
|
| @@ -115,7 +113,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
|
| }
|
| if (!dstProfile) {
|
| cmsCloseProfile(srcProfile);
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| int srcFormat;
|
| FX_BOOL bLab = FALSE;
|
| @@ -136,8 +134,10 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
|
| if (!CheckComponents(dstCS, nDstComponents, TRUE)) {
|
| cmsCloseProfile(srcProfile);
|
| cmsCloseProfile(dstProfile);
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| +
|
| + cmsHTRANSFORM hTransform = nullptr;
|
| switch (dstCS) {
|
| case cmsSigGrayData:
|
| hTransform = cmsCreateTransform(srcProfile, srcFormat, dstProfile,
|
| @@ -158,9 +158,9 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData,
|
| if (!hTransform) {
|
| cmsCloseProfile(srcProfile);
|
| cmsCloseProfile(dstProfile);
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| - pCmm = new CLcmsCmm;
|
| + CLcmsCmm* pCmm = new CLcmsCmm;
|
| pCmm->m_nSrcComponents = nSrcComponents;
|
| pCmm->m_nDstComponents = nDstComponents;
|
| pCmm->m_hTransform = hTransform;
|
| @@ -174,8 +174,8 @@ void* IccLib_CreateTransform_sRGB(const unsigned char* pProfileData,
|
| uint32_t& nComponents,
|
| int32_t intent,
|
| uint32_t dwSrcFormat) {
|
| - return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents, NULL,
|
| - 0, 3, intent, dwSrcFormat);
|
| + return IccLib_CreateTransform(pProfileData, dwProfileSize, nComponents,
|
| + nullptr, 0, 3, intent, dwSrcFormat);
|
| }
|
| void IccLib_DestroyTransform(void* pTransform) {
|
| if (!pTransform) {
|
| @@ -241,11 +241,11 @@ void IccLib_TranslateImage(void* pTransform,
|
| void* CreateProfile_Gray(double gamma) {
|
| cmsCIExyY* D50 = (cmsCIExyY*)cmsD50_xyY();
|
| if (!cmsWhitePointFromTemp(D50, 6504)) {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| - cmsToneCurve* curve = cmsBuildGamma(NULL, gamma);
|
| + cmsToneCurve* curve = cmsBuildGamma(nullptr, gamma);
|
| if (!curve) {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| void* profile = cmsCreateGrayProfile(D50, curve);
|
| cmsFreeToneCurve(curve);
|
| @@ -365,7 +365,7 @@ class CFX_IccProfileCache {
|
| void Purge();
|
| };
|
| CFX_IccProfileCache::CFX_IccProfileCache() {
|
| - m_pProfile = NULL;
|
| + m_pProfile = nullptr;
|
| m_dwRate = 1;
|
| }
|
| CFX_IccProfileCache::~CFX_IccProfileCache() {
|
| @@ -376,7 +376,7 @@ CFX_IccProfileCache::~CFX_IccProfileCache() {
|
| void CFX_IccProfileCache::Purge() {}
|
| class CFX_IccTransformCache {
|
| public:
|
| - CFX_IccTransformCache(CLcmsCmm* pCmm = NULL);
|
| + CFX_IccTransformCache(CLcmsCmm* pCmm = nullptr);
|
| ~CFX_IccTransformCache();
|
| void* m_pIccTransform;
|
| uint32_t m_dwRate;
|
| @@ -386,7 +386,7 @@ class CFX_IccTransformCache {
|
| void Purge();
|
| };
|
| CFX_IccTransformCache::CFX_IccTransformCache(CLcmsCmm* pCmm) {
|
| - m_pIccTransform = NULL;
|
| + m_pIccTransform = nullptr;
|
| m_dwRate = 1;
|
| m_pCmm = pCmm;
|
| }
|
| @@ -409,14 +409,14 @@ CFX_ByteStringKey& CFX_ByteStringKey::operator<<(uint32_t i) {
|
| void* CCodec_IccModule::CreateProfile(CCodec_IccModule::IccParam* pIccParam,
|
| Icc_CLASS ic,
|
| CFX_BinaryBuf* pTransformKey) {
|
| - CFX_IccProfileCache* pCache = NULL;
|
| + CFX_IccProfileCache* pCache = nullptr;
|
| CFX_ByteStringKey key;
|
| CFX_ByteString text;
|
| key << pIccParam->ColorSpace << (pIccParam->dwProfileType | ic << 8);
|
| uint8_t ID[16];
|
| switch (pIccParam->dwProfileType) {
|
| case Icc_PARAMTYPE_NONE:
|
| - return NULL;
|
| + return nullptr;
|
| case Icc_PARAMTYPE_BUFFER:
|
| MD5ComputeID(pIccParam->pProfileData, pIccParam->dwProfileSize, ID);
|
| break;
|
| @@ -476,30 +476,30 @@ void* CCodec_IccModule::CreateTransform(
|
| uint32_t dwFlag,
|
| uint32_t dwPrfIntent,
|
| uint32_t dwPrfFlag) {
|
| - CLcmsCmm* pCmm = NULL;
|
| + CLcmsCmm* pCmm = nullptr;
|
| ASSERT(pInputParam && pOutputParam);
|
| CFX_ByteStringKey key;
|
| void* pInputProfile = CreateProfile(pInputParam, Icc_CLASS_INPUT, &key);
|
| if (!pInputProfile) {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| void* pOutputProfile = CreateProfile(pOutputParam, Icc_CLASS_OUTPUT, &key);
|
| if (!pOutputProfile) {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| uint32_t dwInputProfileType =
|
| TransferProfileType(pInputProfile, pInputParam->dwFormat);
|
| uint32_t dwOutputProfileType =
|
| TransferProfileType(pOutputProfile, pOutputParam->dwFormat);
|
| if (dwInputProfileType == 0 || dwOutputProfileType == 0) {
|
| - return NULL;
|
| + return nullptr;
|
| }
|
| - void* pProofProfile = NULL;
|
| + void* pProofProfile = nullptr;
|
| if (pProofParam) {
|
| pProofProfile = CreateProfile(pProofParam, Icc_CLASS_PROOF, &key);
|
| }
|
| key << dwInputProfileType << dwOutputProfileType << dwIntent << dwFlag
|
| - << (pProofProfile != NULL) << dwPrfIntent << dwPrfFlag;
|
| + << !!pProofProfile << dwPrfIntent << dwPrfFlag;
|
| CFX_ByteString TransformKey(key.GetBuffer(), key.GetSize());
|
| CFX_IccTransformCache* pTransformCache;
|
| auto it = m_MapTranform.find(TransformKey);
|
|
|