diff options
author | Nicolas Pena <npm@chromium.org> | 2017-07-12 11:04:12 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-12 18:26:43 +0000 |
commit | 58bf3de718e510648ee136c887be5b2d577644a7 (patch) | |
tree | fceba4f29df5fc6ecf4da1cf41d6bae0cdda05d2 /core/fxcodec/codec/ccodec_iccmodule.h | |
parent | 071f5eda0399d6f260cc1b67beffcdaa315a9af7 (diff) | |
download | pdfium-58bf3de718e510648ee136c887be5b2d577644a7.tar.xz |
Cleanup ICC code part 1
This CL switches void* to CLcmsCmm*, simplifies the ownership and
destruction of CLcmsCmm, and reduces unnecessary function calling in
fx_codec_icc.cpp.
Change-Id: Ifdbf59dcdaede497d1684b161dd066726cf08ee3
Reviewed-on: https://pdfium-review.googlesource.com/7590
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/ccodec_iccmodule.h')
-rw-r--r-- | core/fxcodec/codec/ccodec_iccmodule.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/core/fxcodec/codec/ccodec_iccmodule.h b/core/fxcodec/codec/ccodec_iccmodule.h index 08878acc98..e775475249 100644 --- a/core/fxcodec/codec/ccodec_iccmodule.h +++ b/core/fxcodec/codec/ccodec_iccmodule.h @@ -7,23 +7,41 @@ #ifndef CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ #define CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_ +#include <memory> + #include "core/fxcodec/fx_codec_def.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "third_party/base/ptr_util.h" + +#if defined(USE_SYSTEM_LCMS2) +#include <lcms2.h> +#else +#include "third_party/lcms2-2.6/include/lcms2.h" +#endif + +class CLcmsCmm { + public: + CLcmsCmm(int srcComponents, cmsHTRANSFORM transform, bool isLab); + ~CLcmsCmm(); + + cmsHTRANSFORM m_hTransform; + int m_nSrcComponents; + bool m_bLab; +}; class CCodec_IccModule { public: CCodec_IccModule(); ~CCodec_IccModule(); - void* CreateTransform_sRGB(const uint8_t* pProfileData, - uint32_t dwProfileSize, - uint32_t& nComponents, - int32_t intent = 0, - uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT); - void DestroyTransform(void* pTransform); - void Translate(void* pTransform, const float* pSrcValues, float* pDestValues); - void TranslateScanline(void* pTransform, + std::unique_ptr<CLcmsCmm> CreateTransform_sRGB(const uint8_t* pProfileData, + uint32_t dwProfileSize, + uint32_t* nComponents); + void Translate(CLcmsCmm* pTransform, + const float* pSrcValues, + float* pDestValues); + void TranslateScanline(CLcmsCmm* pTransform, uint8_t* pDest, const uint8_t* pSrc, int pixels); |