From 5acacd361b15b82a8b30cdd5cb92abb8a2104ecf Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 25 May 2017 14:04:59 -0400 Subject: Break apart the pageint.h file. This CL separates pageint.h and the supporting cpp files into indivudal class files. Change-Id: Idcadce41976a8cd5f0d916e6a5ebbc283fd36527 Reviewed-on: https://pdfium-review.googlesource.com/5930 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- core/fpdfapi/page/cpdf_function.h | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 core/fpdfapi/page/cpdf_function.h (limited to 'core/fpdfapi/page/cpdf_function.h') diff --git a/core/fpdfapi/page/cpdf_function.h b/core/fpdfapi/page/cpdf_function.h new file mode 100644 index 0000000000..ff7cf847d2 --- /dev/null +++ b/core/fpdfapi/page/cpdf_function.h @@ -0,0 +1,64 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_PAGE_CPDF_FUNCTION_H_ +#define CORE_FPDFAPI_PAGE_CPDF_FUNCTION_H_ + +#include + +class CPDF_ExpIntFunc; +class CPDF_Object; +class CPDF_SampledFunc; +class CPDF_StitchFunc; + +class CPDF_Function { + public: + enum class Type { + kTypeInvalid = -1, + kType0Sampled = 0, + kType2ExpotentialInterpolation = 2, + kType3Stitching = 3, + kType4PostScript = 4, + }; + + static std::unique_ptr Load(CPDF_Object* pFuncObj); + static Type IntegerToFunctionType(int iType); + + virtual ~CPDF_Function(); + + bool Call(float* inputs, + uint32_t ninputs, + float* results, + int* nresults) const; + uint32_t CountInputs() const { return m_nInputs; } + uint32_t CountOutputs() const { return m_nOutputs; } + float GetDomain(int i) const { return m_pDomains[i]; } + float GetRange(int i) const { return m_pRanges[i]; } + float Interpolate(float x, + float xmin, + float xmax, + float ymin, + float ymax) const; + + const CPDF_SampledFunc* ToSampledFunc() const; + const CPDF_ExpIntFunc* ToExpIntFunc() const; + const CPDF_StitchFunc* ToStitchFunc() const; + + protected: + explicit CPDF_Function(Type type); + + bool Init(CPDF_Object* pObj); + virtual bool v_Init(CPDF_Object* pObj) = 0; + virtual bool v_Call(float* inputs, float* results) const = 0; + + uint32_t m_nInputs; + uint32_t m_nOutputs; + float* m_pDomains; + float* m_pRanges; + const Type m_Type; +}; + +#endif // CORE_FPDFAPI_PAGE_CPDF_FUNCTION_H_ -- cgit v1.2.3