OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFAPI_PAGE_PAGEINT_H_ | 7 #ifndef CORE_FPDFAPI_PAGE_PAGEINT_H_ |
8 #define CORE_FPDFAPI_PAGE_PAGEINT_H_ | 8 #define CORE_FPDFAPI_PAGE_PAGEINT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 kType0Sampled = 0, | 126 kType0Sampled = 0, |
127 kType2ExpotentialInterpolation = 2, | 127 kType2ExpotentialInterpolation = 2, |
128 kType3Stitching = 3, | 128 kType3Stitching = 3, |
129 kType4PostScript = 4, | 129 kType4PostScript = 4, |
130 }; | 130 }; |
131 | 131 |
132 static std::unique_ptr<CPDF_Function> Load(CPDF_Object* pFuncObj); | 132 static std::unique_ptr<CPDF_Function> Load(CPDF_Object* pFuncObj); |
133 static Type IntegerToFunctionType(int iType); | 133 static Type IntegerToFunctionType(int iType); |
134 | 134 |
135 virtual ~CPDF_Function(); | 135 virtual ~CPDF_Function(); |
136 FX_BOOL Call(FX_FLOAT* inputs, | 136 bool Call(FX_FLOAT* inputs, |
137 uint32_t ninputs, | 137 uint32_t ninputs, |
138 FX_FLOAT* results, | 138 FX_FLOAT* results, |
139 int& nresults) const; | 139 int& nresults) const; |
140 uint32_t CountInputs() const { return m_nInputs; } | 140 uint32_t CountInputs() const { return m_nInputs; } |
141 uint32_t CountOutputs() const { return m_nOutputs; } | 141 uint32_t CountOutputs() const { return m_nOutputs; } |
142 FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; } | 142 FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; } |
143 FX_FLOAT GetRange(int i) const { return m_pRanges[i]; } | 143 FX_FLOAT GetRange(int i) const { return m_pRanges[i]; } |
144 | 144 |
145 const CPDF_SampledFunc* ToSampledFunc() const; | 145 const CPDF_SampledFunc* ToSampledFunc() const; |
146 const CPDF_ExpIntFunc* ToExpIntFunc() const; | 146 const CPDF_ExpIntFunc* ToExpIntFunc() const; |
147 const CPDF_StitchFunc* ToStitchFunc() const; | 147 const CPDF_StitchFunc* ToStitchFunc() const; |
148 | 148 |
149 protected: | 149 protected: |
150 explicit CPDF_Function(Type type); | 150 explicit CPDF_Function(Type type); |
151 | 151 |
152 FX_BOOL Init(CPDF_Object* pObj); | 152 bool Init(CPDF_Object* pObj); |
153 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; | 153 virtual bool v_Init(CPDF_Object* pObj) = 0; |
154 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; | 154 virtual bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; |
155 | 155 |
156 uint32_t m_nInputs; | 156 uint32_t m_nInputs; |
157 uint32_t m_nOutputs; | 157 uint32_t m_nOutputs; |
158 FX_FLOAT* m_pDomains; | 158 FX_FLOAT* m_pDomains; |
159 FX_FLOAT* m_pRanges; | 159 FX_FLOAT* m_pRanges; |
160 const Type m_Type; | 160 const Type m_Type; |
161 }; | 161 }; |
162 | 162 |
163 class CPDF_ExpIntFunc : public CPDF_Function { | 163 class CPDF_ExpIntFunc : public CPDF_Function { |
164 public: | 164 public: |
165 CPDF_ExpIntFunc(); | 165 CPDF_ExpIntFunc(); |
166 ~CPDF_ExpIntFunc() override; | 166 ~CPDF_ExpIntFunc() override; |
167 | 167 |
168 // CPDF_Function | 168 // CPDF_Function |
169 FX_BOOL v_Init(CPDF_Object* pObj) override; | 169 bool v_Init(CPDF_Object* pObj) override; |
170 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 170 bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
171 | 171 |
172 uint32_t m_nOrigOutputs; | 172 uint32_t m_nOrigOutputs; |
173 FX_FLOAT m_Exponent; | 173 FX_FLOAT m_Exponent; |
174 FX_FLOAT* m_pBeginValues; | 174 FX_FLOAT* m_pBeginValues; |
175 FX_FLOAT* m_pEndValues; | 175 FX_FLOAT* m_pEndValues; |
176 }; | 176 }; |
177 | 177 |
178 class CPDF_SampledFunc : public CPDF_Function { | 178 class CPDF_SampledFunc : public CPDF_Function { |
179 public: | 179 public: |
180 struct SampleEncodeInfo { | 180 struct SampleEncodeInfo { |
181 FX_FLOAT encode_max; | 181 FX_FLOAT encode_max; |
182 FX_FLOAT encode_min; | 182 FX_FLOAT encode_min; |
183 uint32_t sizes; | 183 uint32_t sizes; |
184 }; | 184 }; |
185 | 185 |
186 struct SampleDecodeInfo { | 186 struct SampleDecodeInfo { |
187 FX_FLOAT decode_max; | 187 FX_FLOAT decode_max; |
188 FX_FLOAT decode_min; | 188 FX_FLOAT decode_min; |
189 }; | 189 }; |
190 | 190 |
191 CPDF_SampledFunc(); | 191 CPDF_SampledFunc(); |
192 ~CPDF_SampledFunc() override; | 192 ~CPDF_SampledFunc() override; |
193 | 193 |
194 // CPDF_Function | 194 // CPDF_Function |
195 FX_BOOL v_Init(CPDF_Object* pObj) override; | 195 bool v_Init(CPDF_Object* pObj) override; |
196 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 196 bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
197 | 197 |
198 const std::vector<SampleEncodeInfo>& GetEncodeInfo() const { | 198 const std::vector<SampleEncodeInfo>& GetEncodeInfo() const { |
199 return m_EncodeInfo; | 199 return m_EncodeInfo; |
200 } | 200 } |
201 uint32_t GetBitsPerSample() const { return m_nBitsPerSample; } | 201 uint32_t GetBitsPerSample() const { return m_nBitsPerSample; } |
202 const CPDF_StreamAcc* GetSampleStream() const { | 202 const CPDF_StreamAcc* GetSampleStream() const { |
203 return m_pSampleStream.get(); | 203 return m_pSampleStream.get(); |
204 } | 204 } |
205 | 205 |
206 private: | 206 private: |
207 std::vector<SampleEncodeInfo> m_EncodeInfo; | 207 std::vector<SampleEncodeInfo> m_EncodeInfo; |
208 std::vector<SampleDecodeInfo> m_DecodeInfo; | 208 std::vector<SampleDecodeInfo> m_DecodeInfo; |
209 uint32_t m_nBitsPerSample; | 209 uint32_t m_nBitsPerSample; |
210 uint32_t m_SampleMax; | 210 uint32_t m_SampleMax; |
211 std::unique_ptr<CPDF_StreamAcc> m_pSampleStream; | 211 std::unique_ptr<CPDF_StreamAcc> m_pSampleStream; |
212 }; | 212 }; |
213 | 213 |
214 class CPDF_StitchFunc : public CPDF_Function { | 214 class CPDF_StitchFunc : public CPDF_Function { |
215 public: | 215 public: |
216 CPDF_StitchFunc(); | 216 CPDF_StitchFunc(); |
217 ~CPDF_StitchFunc() override; | 217 ~CPDF_StitchFunc() override; |
218 | 218 |
219 // CPDF_Function | 219 // CPDF_Function |
220 FX_BOOL v_Init(CPDF_Object* pObj) override; | 220 bool v_Init(CPDF_Object* pObj) override; |
221 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 221 bool v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
222 | 222 |
223 const std::vector<std::unique_ptr<CPDF_Function>>& GetSubFunctions() const { | 223 const std::vector<std::unique_ptr<CPDF_Function>>& GetSubFunctions() const { |
224 return m_pSubFunctions; | 224 return m_pSubFunctions; |
225 } | 225 } |
226 FX_FLOAT GetBound(size_t i) const { return m_pBounds[i]; } | 226 FX_FLOAT GetBound(size_t i) const { return m_pBounds[i]; } |
227 | 227 |
228 private: | 228 private: |
229 std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions; | 229 std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions; |
230 FX_FLOAT* m_pBounds; | 230 FX_FLOAT* m_pBounds; |
231 FX_FLOAT* m_pEncode; | 231 FX_FLOAT* m_pEncode; |
(...skipping 10 matching lines...) Expand all Loading... |
242 void* m_pTransform; | 242 void* m_pTransform; |
243 | 243 |
244 private: | 244 private: |
245 uint32_t m_nSrcComponents; | 245 uint32_t m_nSrcComponents; |
246 }; | 246 }; |
247 | 247 |
248 class CPDF_DeviceCS : public CPDF_ColorSpace { | 248 class CPDF_DeviceCS : public CPDF_ColorSpace { |
249 public: | 249 public: |
250 CPDF_DeviceCS(CPDF_Document* pDoc, int family); | 250 CPDF_DeviceCS(CPDF_Document* pDoc, int family); |
251 | 251 |
252 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 252 bool GetRGB(FX_FLOAT* pBuf, |
253 FX_FLOAT& R, | 253 FX_FLOAT& R, |
254 FX_FLOAT& G, | 254 FX_FLOAT& G, |
255 FX_FLOAT& B) const override; | 255 FX_FLOAT& B) const override; |
256 FX_BOOL SetRGB(FX_FLOAT* pBuf, | 256 bool SetRGB(FX_FLOAT* pBuf, |
257 FX_FLOAT R, | 257 FX_FLOAT R, |
258 FX_FLOAT G, | 258 FX_FLOAT G, |
259 FX_FLOAT B) const override; | 259 FX_FLOAT B) const override; |
260 FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, | 260 bool v_GetCMYK(FX_FLOAT* pBuf, |
261 FX_FLOAT& c, | 261 FX_FLOAT& c, |
262 FX_FLOAT& m, | 262 FX_FLOAT& m, |
263 FX_FLOAT& y, | 263 FX_FLOAT& y, |
264 FX_FLOAT& k) const override; | 264 FX_FLOAT& k) const override; |
265 FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, | 265 bool v_SetCMYK(FX_FLOAT* pBuf, |
266 FX_FLOAT c, | 266 FX_FLOAT c, |
267 FX_FLOAT m, | 267 FX_FLOAT m, |
268 FX_FLOAT y, | 268 FX_FLOAT y, |
269 FX_FLOAT k) const override; | 269 FX_FLOAT k) const override; |
270 void TranslateImageLine(uint8_t* pDestBuf, | 270 void TranslateImageLine(uint8_t* pDestBuf, |
271 const uint8_t* pSrcBuf, | 271 const uint8_t* pSrcBuf, |
272 int pixels, | 272 int pixels, |
273 int image_width, | 273 int image_width, |
274 int image_height, | 274 int image_height, |
275 FX_BOOL bTransMask = FALSE) const override; | 275 bool bTransMask = false) const override; |
276 }; | 276 }; |
277 | 277 |
278 class CPDF_PatternCS : public CPDF_ColorSpace { | 278 class CPDF_PatternCS : public CPDF_ColorSpace { |
279 public: | 279 public: |
280 explicit CPDF_PatternCS(CPDF_Document* pDoc); | 280 explicit CPDF_PatternCS(CPDF_Document* pDoc); |
281 ~CPDF_PatternCS() override; | 281 ~CPDF_PatternCS() override; |
282 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; | 282 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; |
283 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 283 bool GetRGB(FX_FLOAT* pBuf, |
284 FX_FLOAT& R, | 284 FX_FLOAT& R, |
285 FX_FLOAT& G, | 285 FX_FLOAT& G, |
286 FX_FLOAT& B) const override; | 286 FX_FLOAT& B) const override; |
287 CPDF_ColorSpace* GetBaseCS() const override; | 287 CPDF_ColorSpace* GetBaseCS() const override; |
288 | 288 |
289 private: | 289 private: |
290 CPDF_ColorSpace* m_pBaseCS; | 290 CPDF_ColorSpace* m_pBaseCS; |
291 CPDF_CountedColorSpace* m_pCountedBaseCS; | 291 CPDF_CountedColorSpace* m_pCountedBaseCS; |
292 }; | 292 }; |
293 | 293 |
294 #define MAX_PATTERN_COLORCOMPS 16 | 294 #define MAX_PATTERN_COLORCOMPS 16 |
295 struct PatternValue { | 295 struct PatternValue { |
296 CPDF_Pattern* m_pPattern; | 296 CPDF_Pattern* m_pPattern; |
297 CPDF_CountedPattern* m_pCountedPattern; | 297 CPDF_CountedPattern* m_pCountedPattern; |
298 int m_nComps; | 298 int m_nComps; |
299 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; | 299 FX_FLOAT m_Comps[MAX_PATTERN_COLORCOMPS]; |
300 }; | 300 }; |
301 | 301 |
302 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); | 302 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); |
303 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( | 303 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( |
304 const CFX_ByteStringC& abbr); | 304 const CFX_ByteStringC& abbr); |
305 | 305 |
306 void PDF_ReplaceAbbr(CPDF_Object* pObj); | 306 void PDF_ReplaceAbbr(CPDF_Object* pObj); |
307 | 307 |
308 #endif // CORE_FPDFAPI_PAGE_PAGEINT_H_ | 308 #endif // CORE_FPDFAPI_PAGE_PAGEINT_H_ |
OLD | NEW |