diff options
author | Lei Zhang <thestig@chromium.org> | 2018-06-29 20:44:19 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-29 20:44:19 +0000 |
commit | 238947ce91a07fc4fbb17de0a140349446ff4898 (patch) | |
tree | 1d0a39616c35d5179857bb4a6c5756db0e3519bc /core | |
parent | 013d065a0ad9cd4dd913997c0cc503234efe436e (diff) | |
download | pdfium-238947ce91a07fc4fbb17de0a140349446ff4898.tar.xz |
Remove out param from CCodec_IccModule::CreateTransform_sRGB().
Its return value contains the same data.
Change-Id: I2bf4e72faf978e5d491bec573babc8099cda4e5a
Reviewed-on: https://pdfium-review.googlesource.com/36633
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
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); } |