| 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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <unordered_map> | 12 #include <unordered_map> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "core/fpdfapi/fpdf_page/cpdf_contentmark.h" | 15 #include "core/fpdfapi/fpdf_page/cpdf_contentmark.h" |
| 16 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" | 16 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" |
| 17 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" | 17 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" |
| 18 #include "core/fxge/include/fx_ge.h" | 18 #include "core/fxge/include/fx_ge.h" |
| 19 | 19 |
| 20 class CPDF_AllStates; | 20 class CPDF_AllStates; |
| 21 class CPDF_ColorSpace; | 21 class CPDF_ColorSpace; |
| 22 class CPDF_ExpIntFunc; |
| 22 class CPDF_Font; | 23 class CPDF_Font; |
| 23 class CPDF_FontEncoding; | 24 class CPDF_FontEncoding; |
| 24 class CPDF_Form; | 25 class CPDF_Form; |
| 25 class CPDF_IccProfile; | 26 class CPDF_IccProfile; |
| 26 class CPDF_Image; | 27 class CPDF_Image; |
| 27 class CPDF_ImageObject; | 28 class CPDF_ImageObject; |
| 28 class CPDF_Page; | 29 class CPDF_Page; |
| 29 class CPDF_Pattern; | 30 class CPDF_Pattern; |
| 31 class CPDF_SampledFunc; |
| 32 class CPDF_StitchFunc; |
| 30 class CPDF_StreamAcc; | 33 class CPDF_StreamAcc; |
| 31 class CPDF_TextObject; | 34 class CPDF_TextObject; |
| 32 class CPDF_Type3Char; | 35 class CPDF_Type3Char; |
| 33 | 36 |
| 34 #define PARSE_STEP_LIMIT 100 | 37 #define PARSE_STEP_LIMIT 100 |
| 35 | 38 |
| 36 class CPDF_StreamParser { | 39 class CPDF_StreamParser { |
| 37 public: | 40 public: |
| 38 enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; | 41 enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; |
| 39 | 42 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 static CPDF_Function* Load(CPDF_Object* pFuncObj); | 380 static CPDF_Function* Load(CPDF_Object* pFuncObj); |
| 378 static Type IntegerToFunctionType(int iType); | 381 static Type IntegerToFunctionType(int iType); |
| 379 | 382 |
| 380 virtual ~CPDF_Function(); | 383 virtual ~CPDF_Function(); |
| 381 FX_BOOL Call(FX_FLOAT* inputs, | 384 FX_BOOL Call(FX_FLOAT* inputs, |
| 382 uint32_t ninputs, | 385 uint32_t ninputs, |
| 383 FX_FLOAT* results, | 386 FX_FLOAT* results, |
| 384 int& nresults) const; | 387 int& nresults) const; |
| 385 uint32_t CountInputs() const { return m_nInputs; } | 388 uint32_t CountInputs() const { return m_nInputs; } |
| 386 uint32_t CountOutputs() const { return m_nOutputs; } | 389 uint32_t CountOutputs() const { return m_nOutputs; } |
| 390 FX_FLOAT GetDomain(int i) const { return m_pDomains[i]; } |
| 391 FX_FLOAT GetRange(int i) const { return m_pRanges[i]; } |
| 392 |
| 393 const CPDF_SampledFunc* ToSampledFunc() const; |
| 394 const CPDF_ExpIntFunc* ToExpIntFunc() const; |
| 395 const CPDF_StitchFunc* ToStitchFunc() const; |
| 387 | 396 |
| 388 protected: | 397 protected: |
| 389 CPDF_Function(); | 398 explicit CPDF_Function(Type type); |
| 390 | 399 |
| 391 FX_BOOL Init(CPDF_Object* pObj); | 400 FX_BOOL Init(CPDF_Object* pObj); |
| 392 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; | 401 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; |
| 393 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; | 402 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; |
| 394 | 403 |
| 395 uint32_t m_nInputs; | 404 uint32_t m_nInputs; |
| 396 uint32_t m_nOutputs; | 405 uint32_t m_nOutputs; |
| 397 FX_FLOAT* m_pDomains; | 406 FX_FLOAT* m_pDomains; |
| 398 FX_FLOAT* m_pRanges; | 407 FX_FLOAT* m_pRanges; |
| 408 const Type m_Type; |
| 399 }; | 409 }; |
| 400 | 410 |
| 401 class CPDF_ExpIntFunc : public CPDF_Function { | 411 class CPDF_ExpIntFunc : public CPDF_Function { |
| 402 public: | 412 public: |
| 403 CPDF_ExpIntFunc(); | 413 CPDF_ExpIntFunc(); |
| 404 ~CPDF_ExpIntFunc() override; | 414 ~CPDF_ExpIntFunc() override; |
| 405 | 415 |
| 406 // CPDF_Function | 416 // CPDF_Function |
| 407 FX_BOOL v_Init(CPDF_Object* pObj) override; | 417 FX_BOOL v_Init(CPDF_Object* pObj) override; |
| 408 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 418 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 426 FX_FLOAT decode_min; | 436 FX_FLOAT decode_min; |
| 427 }; | 437 }; |
| 428 | 438 |
| 429 CPDF_SampledFunc(); | 439 CPDF_SampledFunc(); |
| 430 ~CPDF_SampledFunc() override; | 440 ~CPDF_SampledFunc() override; |
| 431 | 441 |
| 432 // CPDF_Function | 442 // CPDF_Function |
| 433 FX_BOOL v_Init(CPDF_Object* pObj) override; | 443 FX_BOOL v_Init(CPDF_Object* pObj) override; |
| 434 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 444 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
| 435 | 445 |
| 446 const std::vector<SampleEncodeInfo>& GetEncodeInfo() const { |
| 447 return m_EncodeInfo; |
| 448 } |
| 449 uint32_t GetBitsPerSample() const { return m_nBitsPerSample; } |
| 450 const CPDF_StreamAcc* GetSampleStream() const { |
| 451 return m_pSampleStream.get(); |
| 452 } |
| 453 |
| 436 private: | 454 private: |
| 437 std::vector<SampleEncodeInfo> m_pEncodeInfo; | 455 std::vector<SampleEncodeInfo> m_EncodeInfo; |
| 438 std::vector<SampleDecodeInfo> m_pDecodeInfo; | 456 std::vector<SampleDecodeInfo> m_DecodeInfo; |
| 439 uint32_t m_nBitsPerSample; | 457 uint32_t m_nBitsPerSample; |
| 440 uint32_t m_SampleMax; | 458 uint32_t m_SampleMax; |
| 441 std::unique_ptr<CPDF_StreamAcc> m_pSampleStream; | 459 std::unique_ptr<CPDF_StreamAcc> m_pSampleStream; |
| 442 }; | 460 }; |
| 443 | 461 |
| 444 class CPDF_StitchFunc : public CPDF_Function { | 462 class CPDF_StitchFunc : public CPDF_Function { |
| 445 public: | 463 public: |
| 446 CPDF_StitchFunc(); | 464 CPDF_StitchFunc(); |
| 447 ~CPDF_StitchFunc() override; | 465 ~CPDF_StitchFunc() override; |
| 448 | 466 |
| 449 // CPDF_Function | 467 // CPDF_Function |
| 450 FX_BOOL v_Init(CPDF_Object* pObj) override; | 468 FX_BOOL v_Init(CPDF_Object* pObj) override; |
| 451 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; | 469 FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const override; |
| 452 | 470 |
| 471 const std::vector<std::unique_ptr<CPDF_Function>>& GetSubFunctions() const { |
| 472 return m_pSubFunctions; |
| 473 } |
| 474 FX_FLOAT GetBound(size_t i) const { return m_pBounds[i]; } |
| 475 |
| 476 private: |
| 453 std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions; | 477 std::vector<std::unique_ptr<CPDF_Function>> m_pSubFunctions; |
| 454 FX_FLOAT* m_pBounds; | 478 FX_FLOAT* m_pBounds; |
| 455 FX_FLOAT* m_pEncode; | 479 FX_FLOAT* m_pEncode; |
| 456 | 480 |
| 457 static const uint32_t kRequiredNumInputs = 1; | 481 static const uint32_t kRequiredNumInputs = 1; |
| 458 }; | 482 }; |
| 459 | 483 |
| 460 class CPDF_IccProfile { | 484 class CPDF_IccProfile { |
| 461 public: | 485 public: |
| 462 CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize); | 486 CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 }; | 548 }; |
| 525 | 549 |
| 526 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); | 550 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); |
| 527 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( | 551 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( |
| 528 const CFX_ByteStringC& abbr); | 552 const CFX_ByteStringC& abbr); |
| 529 | 553 |
| 530 void PDF_ReplaceAbbr(CPDF_Object* pObj); | 554 void PDF_ReplaceAbbr(CPDF_Object* pObj); |
| 531 bool IsPathOperator(const uint8_t* buf, size_t len); | 555 bool IsPathOperator(const uint8_t* buf, size_t len); |
| 532 | 556 |
| 533 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 557 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| OLD | NEW |