| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_CPDF_SHADINGPATTERN_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ |
| 9 | 9 |
| 10 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" | 10 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" |
| 11 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" | 11 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" |
| 12 #include "core/fpdfapi/fpdf_page/pageint.h" | 12 #include "core/fpdfapi/fpdf_page/pageint.h" |
| 13 #include "core/fxcrt/include/fx_system.h" | 13 #include "core/fxcrt/include/fx_system.h" |
| 14 | 14 |
| 15 typedef enum { | 15 enum ShadingType { |
| 16 kInvalidShading = 0, | 16 kInvalidShading = 0, |
| 17 kFunctionBasedShading = 1, | 17 kFunctionBasedShading = 1, |
| 18 kAxialShading = 2, | 18 kAxialShading = 2, |
| 19 kRadialShading = 3, | 19 kRadialShading = 3, |
| 20 kFreeFormGouraudTriangleMeshShading = 4, | 20 kFreeFormGouraudTriangleMeshShading = 4, |
| 21 kLatticeFormGouraudTriangleMeshShading = 5, | 21 kLatticeFormGouraudTriangleMeshShading = 5, |
| 22 kCoonsPatchMeshShading = 6, | 22 kCoonsPatchMeshShading = 6, |
| 23 kTensorProductPatchMeshShading = 7, | 23 kTensorProductPatchMeshShading = 7, |
| 24 kMaxShading = 8 | 24 kMaxShading = 8 |
| 25 } ShadingType; | 25 }; |
| 26 | 26 |
| 27 class CFX_Matrix; | 27 class CFX_Matrix; |
| 28 class CPDF_ColorSpace; | 28 class CPDF_ColorSpace; |
| 29 class CPDF_Document; | 29 class CPDF_Document; |
| 30 class CPDF_Object; | 30 class CPDF_Object; |
| 31 | 31 |
| 32 class CPDF_ShadingPattern : public CPDF_Pattern { | 32 class CPDF_ShadingPattern : public CPDF_Pattern { |
| 33 public: | 33 public: |
| 34 CPDF_ShadingPattern(CPDF_Document* pDoc, | 34 CPDF_ShadingPattern(CPDF_Document* pDoc, |
| 35 CPDF_Object* pPatternObj, | 35 CPDF_Object* pPatternObj, |
| 36 FX_BOOL bShading, | 36 FX_BOOL bShading, |
| 37 const CFX_Matrix* parentMatrix); | 37 const CFX_Matrix* parentMatrix); |
| 38 | 38 |
| 39 ~CPDF_ShadingPattern() override; | 39 ~CPDF_ShadingPattern() override; |
| 40 | 40 |
| 41 CPDF_TilingPattern* AsTilingPattern() override { return nullptr; } |
| 42 CPDF_ShadingPattern* AsShadingPattern() override { return this; } |
| 43 |
| 41 bool IsMeshShading() const { | 44 bool IsMeshShading() const { |
| 42 return m_ShadingType == kFreeFormGouraudTriangleMeshShading || | 45 return m_ShadingType == kFreeFormGouraudTriangleMeshShading || |
| 43 m_ShadingType == kLatticeFormGouraudTriangleMeshShading || | 46 m_ShadingType == kLatticeFormGouraudTriangleMeshShading || |
| 44 m_ShadingType == kCoonsPatchMeshShading || | 47 m_ShadingType == kCoonsPatchMeshShading || |
| 45 m_ShadingType == kTensorProductPatchMeshShading; | 48 m_ShadingType == kTensorProductPatchMeshShading; |
| 46 } | 49 } |
| 47 FX_BOOL Load(); | 50 FX_BOOL Load(); |
| 48 | 51 |
| 49 ShadingType m_ShadingType; | 52 ShadingType m_ShadingType; |
| 50 FX_BOOL m_bShadingObj; | 53 FX_BOOL m_bShadingObj; |
| 51 CPDF_Object* m_pShadingObj; | 54 CPDF_Object* m_pShadingObj; |
| 52 | 55 |
| 53 // Still keep |m_pCS| as some CPDF_ColorSpace (name object) are not managed | 56 // Still keep |m_pCS| as some CPDF_ColorSpace (name object) are not managed |
| 54 // as counted objects. Refer to CPDF_DocPageData::GetColorSpace. | 57 // as counted objects. Refer to CPDF_DocPageData::GetColorSpace. |
| 55 CPDF_ColorSpace* m_pCS; | 58 CPDF_ColorSpace* m_pCS; |
| 56 | 59 |
| 57 CPDF_CountedColorSpace* m_pCountedCS; | 60 CPDF_CountedColorSpace* m_pCountedCS; |
| 58 CPDF_Function* m_pFunctions[4]; | 61 CPDF_Function* m_pFunctions[4]; |
| 59 size_t m_nFuncs; | 62 size_t m_nFuncs; |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ | 65 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ |
| OLD | NEW |