• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_
8 #define CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_
9 
10 #include <memory>
11 
12 #include "core/fxcodec/fx_codec_def.h"
13 #include "core/fxcrt/fx_string.h"
14 #include "core/fxcrt/fx_system.h"
15 #include "third_party/base/ptr_util.h"
16 
17 #if defined(USE_SYSTEM_LCMS2)
18 #include <lcms2.h>
19 #else
20 #include "third_party/lcms/include/lcms2.h"
21 #endif
22 
23 class CLcmsCmm {
24  public:
25   CLcmsCmm(int srcComponents, cmsHTRANSFORM transform, bool isLab);
26   ~CLcmsCmm();
27 
28   cmsHTRANSFORM m_hTransform;
29   int m_nSrcComponents;
30   bool m_bLab;
31 };
32 
33 class CCodec_IccModule {
34  public:
35   CCodec_IccModule();
36   ~CCodec_IccModule();
37 
38   std::unique_ptr<CLcmsCmm> CreateTransform_sRGB(const uint8_t* pProfileData,
39                                                  uint32_t dwProfileSize,
40                                                  uint32_t* nComponents);
41   void Translate(CLcmsCmm* pTransform,
42                  const float* pSrcValues,
43                  float* pDestValues);
44   void TranslateScanline(CLcmsCmm* pTransform,
45                          uint8_t* pDest,
46                          const uint8_t* pSrc,
47                          int pixels);
SetComponents(uint32_t nComponents)48   void SetComponents(uint32_t nComponents) { m_nComponents = nComponents; }
49 
50  protected:
51   uint32_t m_nComponents;
52 };
53 
54 #endif  // CORE_FXCODEC_CODEC_CCODEC_ICCMODULE_H_
55