Chromium Code Reviews| 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..eb51475982582943859962752a7c6f9e59c88d2c 100644 |
| --- a/core/fxcodec/codec/fx_codec_icc.cpp |
| +++ b/core/fxcodec/codec/fx_codec_icc.cpp |
| @@ -98,14 +98,14 @@ 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; |
| + cmsHPROFILE srcProfile = nullptr; |
|
Tom Sepez
2016/06/02 20:09:49
nit:combine with 106.
Lei Zhang
2016/06/07 07:33:23
Done.
|
| + cmsHPROFILE dstProfile = nullptr; |
| + cmsHTRANSFORM hTransform = nullptr; |
| + CLcmsCmm* pCmm = nullptr; |
| nSrcComponents = 0; |
| srcProfile = cmsOpenProfileFromMem((void*)pSrcProfileData, dwSrcProfileSize); |
| if (!srcProfile) { |
| - return NULL; |
| + return nullptr; |
| } |
| if (!pDstProfileData && dwDstProfileSize == 0 && nDstComponents == 3) { |
| dstProfile = cmsCreate_sRGBProfile(); |
| @@ -115,7 +115,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, |
| } |
| if (!dstProfile) { |
| cmsCloseProfile(srcProfile); |
| - return NULL; |
| + return nullptr; |
| } |
| int srcFormat; |
| FX_BOOL bLab = FALSE; |
| @@ -136,7 +136,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, |
| if (!CheckComponents(dstCS, nDstComponents, TRUE)) { |
| cmsCloseProfile(srcProfile); |
| cmsCloseProfile(dstProfile); |
| - return NULL; |
| + return nullptr; |
| } |
| switch (dstCS) { |
| case cmsSigGrayData: |
| @@ -158,7 +158,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, |
| if (!hTransform) { |
| cmsCloseProfile(srcProfile); |
| cmsCloseProfile(dstProfile); |
| - return NULL; |
| + return nullptr; |
| } |
| pCmm = new CLcmsCmm; |
| pCmm->m_nSrcComponents = nSrcComponents; |
| @@ -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); |