| 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_FPDF_PAGE_PAGEINT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 CPDF_FontFileMap m_FontFileMap; | 360 CPDF_FontFileMap m_FontFileMap; |
| 361 CPDF_FontMap m_FontMap; | 361 CPDF_FontMap m_FontMap; |
| 362 CPDF_IccProfileMap m_IccProfileMap; | 362 CPDF_IccProfileMap m_IccProfileMap; |
| 363 CPDF_ImageMap m_ImageMap; | 363 CPDF_ImageMap m_ImageMap; |
| 364 CPDF_PatternMap m_PatternMap; | 364 CPDF_PatternMap m_PatternMap; |
| 365 }; | 365 }; |
| 366 | 366 |
| 367 class CPDF_Function { | 367 class CPDF_Function { |
| 368 public: | 368 public: |
| 369 enum class Type { | 369 enum class Type { |
| 370 kType0Sampled, | 370 kTypeInvalid = -1, |
| 371 kType2ExpotentialInterpolation, | 371 kType0Sampled = 0, |
| 372 kType3Stitching, | 372 kType2ExpotentialInterpolation = 2, |
| 373 kType4PostScript, | 373 kType3Stitching = 3, |
| 374 kType4PostScript = 4, |
| 374 }; | 375 }; |
| 375 | 376 |
| 376 static CPDF_Function* Load(CPDF_Object* pFuncObj); | 377 static CPDF_Function* Load(CPDF_Object* pFuncObj); |
| 378 static Type IntegerToFunctionType(int iType); |
| 379 |
| 377 virtual ~CPDF_Function(); | 380 virtual ~CPDF_Function(); |
| 378 FX_BOOL Call(FX_FLOAT* inputs, | 381 FX_BOOL Call(FX_FLOAT* inputs, |
| 379 uint32_t ninputs, | 382 uint32_t ninputs, |
| 380 FX_FLOAT* results, | 383 FX_FLOAT* results, |
| 381 int& nresults) const; | 384 int& nresults) const; |
| 382 uint32_t CountInputs() const { return m_nInputs; } | 385 uint32_t CountInputs() const { return m_nInputs; } |
| 383 uint32_t CountOutputs() const { return m_nOutputs; } | 386 uint32_t CountOutputs() const { return m_nOutputs; } |
| 384 FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; } | |
| 385 FX_FLOAT GetRange(int i) const { return m_pRanges[i]; } | |
| 386 Type GetType() const { return m_Type; } | |
| 387 | 387 |
| 388 protected: | 388 protected: |
| 389 CPDF_Function(Type type); | 389 CPDF_Function(); |
| 390 |
| 390 FX_BOOL Init(CPDF_Object* pObj); | 391 FX_BOOL Init(CPDF_Object* pObj); |
| 391 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; | 392 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; |
| 392 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; | 393 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; |
| 393 | 394 |
| 394 uint32_t m_nInputs; | 395 uint32_t m_nInputs; |
| 395 uint32_t m_nOutputs; | 396 uint32_t m_nOutputs; |
| 396 FX_FLOAT* m_pDomains; | 397 FX_FLOAT* m_pDomains; |
| 397 FX_FLOAT* m_pRanges; | 398 FX_FLOAT* m_pRanges; |
| 398 Type m_Type; | |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 class CPDF_ExpIntFunc : public CPDF_Function { | 401 class CPDF_ExpIntFunc : public CPDF_Function { |
| 402 public: | 402 public: |
| 403 CPDF_ExpIntFunc(); | 403 CPDF_ExpIntFunc(); |
| 404 ~CPDF_ExpIntFunc() override; | 404 ~CPDF_ExpIntFunc() override; |
| 405 | 405 |
| 406 // CPDF_Function | 406 // CPDF_Function |
| 407 FX_BOOL v_Init(CPDF_Object* pObj) override; | 407 FX_BOOL v_Init(CPDF_Object* pObj) override; |
| 408 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 408 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 426 FX_FLOAT decode_min; | 426 FX_FLOAT decode_min; |
| 427 }; | 427 }; |
| 428 | 428 |
| 429 CPDF_SampledFunc(); | 429 CPDF_SampledFunc(); |
| 430 ~CPDF_SampledFunc() override; | 430 ~CPDF_SampledFunc() override; |
| 431 | 431 |
| 432 // CPDF_Function | 432 // CPDF_Function |
| 433 FX_BOOL v_Init(CPDF_Object* pObj) override; | 433 FX_BOOL v_Init(CPDF_Object* pObj) override; |
| 434 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 434 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
| 435 | 435 |
| 436 SampleEncodeInfo* m_pEncodeInfo; | 436 private: |
| 437 SampleDecodeInfo* m_pDecodeInfo; | 437 std::vector<SampleEncodeInfo> m_pEncodeInfo; |
| 438 std::vector<SampleDecodeInfo> m_pDecodeInfo; |
| 438 uint32_t m_nBitsPerSample; | 439 uint32_t m_nBitsPerSample; |
| 439 uint32_t m_SampleMax; | 440 uint32_t m_SampleMax; |
| 440 CPDF_StreamAcc* m_pSampleStream; | 441 std::unique_ptr<CPDF_StreamAcc> m_pSampleStream; |
| 441 }; | 442 }; |
| 442 | 443 |
| 443 class CPDF_StitchFunc : public CPDF_Function { | 444 class CPDF_StitchFunc : public CPDF_Function { |
| 444 public: | 445 public: |
| 445 CPDF_StitchFunc(); | 446 CPDF_StitchFunc(); |
| 446 ~CPDF_StitchFunc() override; | 447 ~CPDF_StitchFunc() override; |
| 447 | 448 |
| 448 // CPDF_Function | 449 // CPDF_Function |
| 449 FX_BOOL v_Init(CPDF_Object* pObj) override; | 450 FX_BOOL v_Init(CPDF_Object* pObj) override; |
| 450 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 451 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
| 451 | 452 |
| 452 std::vector<CPDF_Function*> m_pSubFunctions; | 453 std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions; |
| 453 FX_FLOAT* m_pBounds; | 454 FX_FLOAT* m_pBounds; |
| 454 FX_FLOAT* m_pEncode; | 455 FX_FLOAT* m_pEncode; |
| 455 | 456 |
| 456 static const uint32_t kRequiredNumInputs = 1; | 457 static const uint32_t kRequiredNumInputs = 1; |
| 457 }; | 458 }; |
| 458 | 459 |
| 459 class CPDF_IccProfile { | 460 class CPDF_IccProfile { |
| 460 public: | 461 public: |
| 461 CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize); | 462 CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize); |
| 462 ~CPDF_IccProfile(); | 463 ~CPDF_IccProfile(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 }; | 524 }; |
| 524 | 525 |
| 525 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); | 526 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); |
| 526 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( | 527 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( |
| 527 const CFX_ByteStringC& abbr); | 528 const CFX_ByteStringC& abbr); |
| 528 | 529 |
| 529 void PDF_ReplaceAbbr(CPDF_Object* pObj); | 530 void PDF_ReplaceAbbr(CPDF_Object* pObj); |
| 530 bool IsPathOperator(const uint8_t* buf, size_t len); | 531 bool IsPathOperator(const uint8_t* buf, size_t len); |
| 531 | 532 |
| 532 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 533 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| OLD | NEW |