Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: core/fpdfapi/fpdf_page/cpdf_shadingpattern.h

Issue 2000973002: Make CPDF_Function::Load() return an unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix build, nits Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
11 #include <vector>
12
10 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" 13 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h"
11 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h" 14 #include "core/fpdfapi/fpdf_page/cpdf_pattern.h"
12 #include "core/fpdfapi/fpdf_page/pageint.h"
13 #include "core/fxcrt/include/fx_system.h" 15 #include "core/fxcrt/include/fx_system.h"
14 16
15 enum ShadingType { 17 enum ShadingType {
16 kInvalidShading = 0, 18 kInvalidShading = 0,
17 kFunctionBasedShading = 1, 19 kFunctionBasedShading = 1,
18 kAxialShading = 2, 20 kAxialShading = 2,
19 kRadialShading = 3, 21 kRadialShading = 3,
20 kFreeFormGouraudTriangleMeshShading = 4, 22 kFreeFormGouraudTriangleMeshShading = 4,
21 kLatticeFormGouraudTriangleMeshShading = 5, 23 kLatticeFormGouraudTriangleMeshShading = 5,
22 kCoonsPatchMeshShading = 6, 24 kCoonsPatchMeshShading = 6,
23 kTensorProductPatchMeshShading = 7, 25 kTensorProductPatchMeshShading = 7,
24 kMaxShading = 8 26 kMaxShading = 8
25 }; 27 };
26 28
27 class CFX_Matrix; 29 class CFX_Matrix;
28 class CPDF_ColorSpace; 30 class CPDF_ColorSpace;
29 class CPDF_Document; 31 class CPDF_Document;
32 class CPDF_Function;
30 class CPDF_Object; 33 class CPDF_Object;
31 34
32 class CPDF_ShadingPattern : public CPDF_Pattern { 35 class CPDF_ShadingPattern : public CPDF_Pattern {
33 public: 36 public:
34 CPDF_ShadingPattern(CPDF_Document* pDoc, 37 CPDF_ShadingPattern(CPDF_Document* pDoc,
35 CPDF_Object* pPatternObj, 38 CPDF_Object* pPatternObj,
36 FX_BOOL bShading, 39 FX_BOOL bShading,
37 const CFX_Matrix& parentMatrix); 40 const CFX_Matrix& parentMatrix);
38
39 ~CPDF_ShadingPattern() override; 41 ~CPDF_ShadingPattern() override;
40 42
41 CPDF_TilingPattern* AsTilingPattern() override { return nullptr; } 43 CPDF_TilingPattern* AsTilingPattern() override { return nullptr; }
42 CPDF_ShadingPattern* AsShadingPattern() override { return this; } 44 CPDF_ShadingPattern* AsShadingPattern() override { return this; }
43 45
44 bool IsMeshShading() const { 46 bool IsMeshShading() const {
45 return m_ShadingType == kFreeFormGouraudTriangleMeshShading || 47 return m_ShadingType == kFreeFormGouraudTriangleMeshShading ||
46 m_ShadingType == kLatticeFormGouraudTriangleMeshShading || 48 m_ShadingType == kLatticeFormGouraudTriangleMeshShading ||
47 m_ShadingType == kCoonsPatchMeshShading || 49 m_ShadingType == kCoonsPatchMeshShading ||
48 m_ShadingType == kTensorProductPatchMeshShading; 50 m_ShadingType == kTensorProductPatchMeshShading;
49 } 51 }
50 FX_BOOL Load(); 52 bool Load();
51 53
54 ShadingType GetShadingType() const { return m_ShadingType; }
55 FX_BOOL IsShadingObject() const { return m_bShadingObj; }
56 CPDF_Object* GetShadingObject() const { return m_pShadingObj; }
57 CPDF_ColorSpace* GetCS() const { return m_pCS; }
58 const std::vector<std::unique_ptr<CPDF_Function>>& GetFuncs() {
59 return m_pFunctions;
60 }
61
62 private:
52 ShadingType m_ShadingType; 63 ShadingType m_ShadingType;
53 FX_BOOL m_bShadingObj; 64 FX_BOOL m_bShadingObj;
54 CPDF_Object* m_pShadingObj; 65 CPDF_Object* m_pShadingObj;
55 66
56 // Still keep |m_pCS| as some CPDF_ColorSpace (name object) are not managed 67 // Still keep |m_pCS| as some CPDF_ColorSpace (name object) are not managed
57 // as counted objects. Refer to CPDF_DocPageData::GetColorSpace. 68 // as counted objects. Refer to CPDF_DocPageData::GetColorSpace.
58 CPDF_ColorSpace* m_pCS; 69 CPDF_ColorSpace* m_pCS;
59 70
60 CPDF_CountedColorSpace* m_pCountedCS; 71 CPDF_CountedColorSpace* m_pCountedCS;
61 CPDF_Function* m_pFunctions[4]; 72 std::vector<std::unique_ptr<CPDF_Function>> m_pFunctions;
62 size_t m_nFuncs;
63 }; 73 };
64 74
65 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_ 75 #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_SHADINGPATTERN_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_shadingobject.cpp ('k') | core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698