• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_SAMPLEDFUNC_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_SAMPLEDFUNC_H_
9 
10 #include <set>
11 #include <vector>
12 
13 #include "core/fpdfapi/page/cpdf_function.h"
14 #include "core/fxcrt/retain_ptr.h"
15 
16 class CPDF_StreamAcc;
17 
18 class CPDF_SampledFunc final : public CPDF_Function {
19  public:
20   struct SampleEncodeInfo {
21     float encode_max;
22     float encode_min;
23     uint32_t sizes;
24   };
25 
26   struct SampleDecodeInfo {
27     float decode_max;
28     float decode_min;
29   };
30 
31   CPDF_SampledFunc();
32   ~CPDF_SampledFunc() override;
33 
34   // CPDF_Function
35   bool v_Init(const CPDF_Object* pObj,
36               std::set<const CPDF_Object*>* pVisited) override;
37   bool v_Call(const float* inputs, float* results) const override;
38 
GetEncodeInfo()39   const std::vector<SampleEncodeInfo>& GetEncodeInfo() const {
40     return m_EncodeInfo;
41   }
GetBitsPerSample()42   uint32_t GetBitsPerSample() const { return m_nBitsPerSample; }
43 
44 #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
45   RetainPtr<CPDF_StreamAcc> GetSampleStream() const;
46 #endif
47 
48  private:
49   std::vector<SampleEncodeInfo> m_EncodeInfo;
50   std::vector<SampleDecodeInfo> m_DecodeInfo;
51   uint32_t m_nBitsPerSample;
52   uint32_t m_SampleMax;
53   RetainPtr<CPDF_StreamAcc> m_pSampleStream;
54 };
55 
56 #endif  // CORE_FPDFAPI_PAGE_CPDF_SAMPLEDFUNC_H_
57