diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/page/cpdf_iccprofile.cpp | 5 | ||||
-rw-r--r-- | core/fxcodec/codec/ccodec_iccmodule.h | 3 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_icc.cpp | 14 |
3 files changed, 9 insertions, 13 deletions
diff --git a/core/fpdfapi/page/cpdf_iccprofile.cpp b/core/fpdfapi/page/cpdf_iccprofile.cpp index c0bf7cd2a2..ef1b9ef434 100644 --- a/core/fpdfapi/page/cpdf_iccprofile.cpp +++ b/core/fpdfapi/page/cpdf_iccprofile.cpp @@ -27,11 +27,10 @@ CPDF_IccProfile::CPDF_IccProfile(const CPDF_Stream* pStream, return; } - uint32_t nSrcComps = 0; auto* pIccModule = CPDF_ModuleMgr::Get()->GetIccModule(); - m_Transform = pIccModule->CreateTransform_sRGB(pData, dwSize, &nSrcComps); + m_Transform = pIccModule->CreateTransform_sRGB(pData, dwSize); if (m_Transform) - m_nSrcComponents = nSrcComps; + m_nSrcComponents = m_Transform->components(); } CPDF_IccProfile::~CPDF_IccProfile() {} diff --git a/core/fxcodec/codec/ccodec_iccmodule.h b/core/fxcodec/codec/ccodec_iccmodule.h index 38d9ec8686..419bf17777 100644 --- a/core/fxcodec/codec/ccodec_iccmodule.h +++ b/core/fxcodec/codec/ccodec_iccmodule.h @@ -46,8 +46,7 @@ class CCodec_IccModule { ~CCodec_IccModule(); std::unique_ptr<CLcmsCmm> CreateTransform_sRGB(const uint8_t* pProfileData, - uint32_t dwProfileSize, - uint32_t* nComponents); + uint32_t dwProfileSize); void Translate(CLcmsCmm* pTransform, const float* pSrcValues, float* pDestValues); diff --git a/core/fxcodec/codec/fx_codec_icc.cpp b/core/fxcodec/codec/fx_codec_icc.cpp index b2f2b4064d..fc82e043b4 100644 --- a/core/fxcodec/codec/fx_codec_icc.cpp +++ b/core/fxcodec/codec/fx_codec_icc.cpp @@ -51,9 +51,7 @@ CCodec_IccModule::~CCodec_IccModule() {} std::unique_ptr<CLcmsCmm> CCodec_IccModule::CreateTransform_sRGB( const unsigned char* pSrcProfileData, - uint32_t dwSrcProfileSize, - uint32_t* nSrcComponents) { - *nSrcComponents = 0; + uint32_t dwSrcProfileSize) { ScopedCmsProfile srcProfile( cmsOpenProfileFromMem(pSrcProfileData, dwSrcProfileSize)); if (!srcProfile) @@ -65,9 +63,9 @@ std::unique_ptr<CLcmsCmm> CCodec_IccModule::CreateTransform_sRGB( cmsColorSpaceSignature srcCS = cmsGetColorSpace(srcProfile.get()); - *nSrcComponents = cmsChannelsOf(srcCS); + uint32_t nSrcComponents = cmsChannelsOf(srcCS); // According to PDF spec, number of components must be 1, 3, or 4. - if (*nSrcComponents != 1 && *nSrcComponents != 3 && *nSrcComponents != 4) + if (nSrcComponents != 1 && nSrcComponents != 3 && nSrcComponents != 4) return nullptr; int srcFormat; @@ -75,11 +73,11 @@ std::unique_ptr<CLcmsCmm> CCodec_IccModule::CreateTransform_sRGB( bool bNormal = false; if (srcCS == cmsSigLabData) { srcFormat = - COLORSPACE_SH(PT_Lab) | CHANNELS_SH(*nSrcComponents) | BYTES_SH(0); + COLORSPACE_SH(PT_Lab) | CHANNELS_SH(nSrcComponents) | BYTES_SH(0); bLab = true; } else { srcFormat = - COLORSPACE_SH(PT_ANY) | CHANNELS_SH(*nSrcComponents) | BYTES_SH(1); + COLORSPACE_SH(PT_ANY) | CHANNELS_SH(nSrcComponents) | BYTES_SH(1); // TODO(thestig): Check to see if lcms2 supports more colorspaces that can // be considered normal. bNormal = srcCS == cmsSigGrayData || srcCS == cmsSigRgbData || @@ -107,7 +105,7 @@ std::unique_ptr<CLcmsCmm> CCodec_IccModule::CreateTransform_sRGB( if (!hTransform) return nullptr; - return pdfium::MakeUnique<CLcmsCmm>(hTransform, *nSrcComponents, bLab, + return pdfium::MakeUnique<CLcmsCmm>(hTransform, nSrcComponents, bLab, bNormal); } |