Home | History | Annotate | Download | only in page
      1 // Copyright 2017 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_FPDFAPI_PAGE_CPDF_ICCPROFILE_H_
      8 #define CORE_FPDFAPI_PAGE_CPDF_ICCPROFILE_H_
      9 
     10 #include <memory>
     11 
     12 #include "core/fxcrt/retain_ptr.h"
     13 #include "core/fxcrt/unowned_ptr.h"
     14 
     15 class CLcmsCmm;
     16 class CPDF_Stream;
     17 
     18 class CPDF_IccProfile : public Retainable {
     19  public:
     20   template <typename T, typename... Args>
     21   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
     22 
     23   CPDF_Stream* GetStream() const { return m_pStream.Get(); }
     24   bool IsValid() const { return IsSRGB() || IsSupported(); }
     25   bool IsSRGB() const { return m_bsRGB; }
     26   bool IsSupported() const { return !!m_Transform; }
     27   CLcmsCmm* transform() { return m_Transform.get(); }
     28   uint32_t GetComponents() const { return m_nSrcComponents; }
     29 
     30  private:
     31   CPDF_IccProfile(CPDF_Stream* pStream, const uint8_t* pData, uint32_t dwSize);
     32   ~CPDF_IccProfile() override;
     33 
     34   const bool m_bsRGB;
     35   UnownedPtr<CPDF_Stream> const m_pStream;
     36   std::unique_ptr<CLcmsCmm> m_Transform;
     37   uint32_t m_nSrcComponents = 0;
     38 };
     39 
     40 #endif  // CORE_FPDFAPI_PAGE_CPDF_ICCPROFILE_H_
     41