 Chromium Code Reviews
 Chromium Code Reviews Issue 1570873005:
  Tidy up shading patterns  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master
    
  
    Issue 1570873005:
  Tidy up shading patterns  (Closed) 
  Base URL: https://pdfium.googlesource.com/pdfium.git@master| 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_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 
| 8 #define CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 
| 9 | 9 | 
| 10 #include <map> | 10 #include <map> | 
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 | 629 | 
| 630 FX_FLOAT* GetPatternColor() const; | 630 FX_FLOAT* GetPatternColor() const; | 
| 631 | 631 | 
| 632 CPDF_ColorSpace* m_pCS; | 632 CPDF_ColorSpace* m_pCS; | 
| 633 | 633 | 
| 634 protected: | 634 protected: | 
| 635 void ReleaseBuffer(); | 635 void ReleaseBuffer(); | 
| 636 void ReleaseColorSpace(); | 636 void ReleaseColorSpace(); | 
| 637 FX_FLOAT* m_pBuffer; | 637 FX_FLOAT* m_pBuffer; | 
| 638 }; | 638 }; | 
| 639 #define PATTERN_TILING 1 | 639 | 
| 640 #define PATTERN_SHADING 2 | |
| 641 class CPDF_Pattern { | 640 class CPDF_Pattern { | 
| 642 public: | 641 public: | 
| 642 enum PatternType { TILING = 1, SHADING }; | |
| 643 | |
| 643 virtual ~CPDF_Pattern(); | 644 virtual ~CPDF_Pattern(); | 
| 645 | |
| 644 void SetForceClear(FX_BOOL bForceClear) { m_bForceClear = bForceClear; } | 646 void SetForceClear(FX_BOOL bForceClear) { m_bForceClear = bForceClear; } | 
| 645 | 647 | 
| 646 CPDF_Object* m_pPatternObj; | 648 const PatternType m_PatternType; | 
| 647 | 649 CPDF_Document* const m_pDocument; | 
| 648 int m_PatternType; | 650 CPDF_Object* const m_pPatternObj; | 
| 649 | |
| 650 CFX_Matrix m_Pattern2Form; | 651 CFX_Matrix m_Pattern2Form; | 
| 651 CFX_Matrix m_ParentMatrix; | 652 CFX_Matrix m_ParentMatrix; | 
| 652 | 653 | 
| 653 CPDF_Document* m_pDocument; | 654 protected: | 
| 655 CPDF_Pattern(PatternType type, | |
| 656 CPDF_Document* pDoc, | |
| 657 CPDF_Object* pObj, | |
| 658 const CFX_Matrix* pParentMatrix); | |
| 654 | 659 | 
| 655 protected: | |
| 656 CPDF_Pattern(const CFX_Matrix* pParentMatrix); | |
| 657 FX_BOOL m_bForceClear; | 660 FX_BOOL m_bForceClear; | 
| 658 }; | 661 }; | 
| 659 | 662 | 
| 660 class CPDF_TilingPattern : public CPDF_Pattern { | 663 class CPDF_TilingPattern : public CPDF_Pattern { | 
| 661 public: | 664 public: | 
| 662 CPDF_TilingPattern(CPDF_Document* pDoc, | 665 CPDF_TilingPattern(CPDF_Document* pDoc, | 
| 663 CPDF_Object* pPatternObj, | 666 CPDF_Object* pPatternObj, | 
| 664 const CFX_Matrix* parentMatrix); | 667 const CFX_Matrix* parentMatrix); | 
| 665 | 668 | 
| 666 ~CPDF_TilingPattern() override; | 669 ~CPDF_TilingPattern() override; | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 698 const CFX_Matrix* parentMatrix); | 701 const CFX_Matrix* parentMatrix); | 
| 699 | 702 | 
| 700 ~CPDF_ShadingPattern() override; | 703 ~CPDF_ShadingPattern() override; | 
| 701 | 704 | 
| 702 bool IsMeshShading() const { | 705 bool IsMeshShading() const { | 
| 703 return m_ShadingType == kFreeFormGouraudTriangleMeshShading || | 706 return m_ShadingType == kFreeFormGouraudTriangleMeshShading || | 
| 704 m_ShadingType == kLatticeFormGouraudTriangleMeshShading || | 707 m_ShadingType == kLatticeFormGouraudTriangleMeshShading || | 
| 705 m_ShadingType == kCoonsPatchMeshShading || | 708 m_ShadingType == kCoonsPatchMeshShading || | 
| 706 m_ShadingType == kTensorProductPatchMeshShading; | 709 m_ShadingType == kTensorProductPatchMeshShading; | 
| 707 } | 710 } | 
| 711 FX_BOOL Load(); | |
| 708 | 712 | 
| 713 ShadingType m_ShadingType; | |
| 714 FX_BOOL m_bShadingObj; | |
| 709 CPDF_Object* m_pShadingObj; | 715 CPDF_Object* m_pShadingObj; | 
| 710 | 716 | 
| 711 FX_BOOL m_bShadingObj; | 717 // Still keep m_pCS as some CPDF_ColorSpace (name object) are not managed as | 
| 
Lei Zhang
2016/01/09 01:03:56
|m_pCS|
 | |
| 712 | 718 // counted objects. Refer to CPDF_DocPageData::GetColorSpace. | 
| 713 FX_BOOL Load(); | 719 CPDF_ColorSpace* m_pCS; | 
| 714 | |
| 715 FX_BOOL Reload(); | |
| 716 | |
| 717 ShadingType m_ShadingType; | |
| 718 | |
| 719 CPDF_ColorSpace* m_pCS; // Still keep m_pCS as some CPDF_ColorSpace (name | |
| 720 // object) are not managed as counted objects. Refer | |
| 721 // to CPDF_DocPageData::GetColorSpace. | |
| 722 | 720 | 
| 723 CPDF_CountedColorSpace* m_pCountedCS; | 721 CPDF_CountedColorSpace* m_pCountedCS; | 
| 722 CPDF_Function* m_pFunctions[4]; | |
| 723 int m_nFuncs; | |
| 724 }; | |
| 724 | 725 | 
| 725 CPDF_Function* m_pFunctions[4]; | |
| 726 | |
| 727 int m_nFuncs; | |
| 728 | |
| 729 protected: | |
| 730 void Clear(); | |
| 731 }; | |
| 732 struct CPDF_MeshVertex { | 726 struct CPDF_MeshVertex { | 
| 733 FX_FLOAT x, y; | 727 FX_FLOAT x, y; | 
| 734 FX_FLOAT r, g, b; | 728 FX_FLOAT r, g, b; | 
| 735 }; | 729 }; | 
| 736 class CPDF_MeshStream { | 730 class CPDF_MeshStream { | 
| 737 public: | 731 public: | 
| 738 FX_BOOL Load(CPDF_Stream* pShadingStream, | 732 FX_BOOL Load(CPDF_Stream* pShadingStream, | 
| 739 CPDF_Function** pFuncs, | 733 CPDF_Function** pFuncs, | 
| 740 int nFuncs, | 734 int nFuncs, | 
| 741 CPDF_ColorSpace* pCS); | 735 CPDF_ColorSpace* pCS); | 
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 852 | 846 | 
| 853 FX_BOOL m_bInterpolate; | 847 FX_BOOL m_bInterpolate; | 
| 854 | 848 | 
| 855 CPDF_Document* m_pDocument; | 849 CPDF_Document* m_pDocument; | 
| 856 | 850 | 
| 857 CPDF_Dictionary* m_pOC; | 851 CPDF_Dictionary* m_pOC; | 
| 858 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); | 852 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); | 
| 859 }; | 853 }; | 
| 860 | 854 | 
| 861 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 855 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 
| OLD | NEW |