OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #ifndef SkPDFCanon_DEFINED | 7 #ifndef SkPDFCanon_DEFINED |
8 #define SkPDFCanon_DEFINED | 8 #define SkPDFCanon_DEFINED |
9 | 9 |
10 #include "SkPDFGraphicState.h" | 10 #include "SkPDFGraphicState.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 * The findFoo() methods do not change the ref count of the Foo | 33 * The findFoo() methods do not change the ref count of the Foo |
34 * objects. | 34 * objects. |
35 */ | 35 */ |
36 class SkPDFCanon : SkNoncopyable { | 36 class SkPDFCanon : SkNoncopyable { |
37 public: | 37 public: |
38 ~SkPDFCanon() { this->reset(); } | 38 ~SkPDFCanon() { this->reset(); } |
39 | 39 |
40 // reset to original setting, unrefs all objects. | 40 // reset to original setting, unrefs all objects. |
41 void reset(); | 41 void reset(); |
42 | 42 |
43 // Returns exact match if there is one. If not, it returns NULL. | 43 // Returns exact match if there is one. If not, it returns nullptr. |
44 // If there is no exact match, but there is a related font, we | 44 // If there is no exact match, but there is a related font, we |
45 // still return NULL, but also set *relatedFont. | 45 // still return nullptr, but also set *relatedFont. |
46 SkPDFFont* findFont(uint32_t fontID, | 46 SkPDFFont* findFont(uint32_t fontID, |
47 uint16_t glyphID, | 47 uint16_t glyphID, |
48 SkPDFFont** relatedFont) const; | 48 SkPDFFont** relatedFont) const; |
49 void addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID); | 49 void addFont(SkPDFFont* font, uint32_t fontID, uint16_t fGlyphID); |
50 | 50 |
51 SkPDFFunctionShader* findFunctionShader(const SkPDFShader::State&) const; | 51 SkPDFFunctionShader* findFunctionShader(const SkPDFShader::State&) const; |
52 void addFunctionShader(SkPDFFunctionShader*); | 52 void addFunctionShader(SkPDFFunctionShader*); |
53 | 53 |
54 SkPDFAlphaFunctionShader* findAlphaShader(const SkPDFShader::State&) const; | 54 SkPDFAlphaFunctionShader* findAlphaShader(const SkPDFShader::State&) const; |
55 void addAlphaShader(SkPDFAlphaFunctionShader*); | 55 void addAlphaShader(SkPDFAlphaFunctionShader*); |
(...skipping 15 matching lines...) Expand all Loading... |
71 }; | 71 }; |
72 SkTDArray<FontRec> fFontRecords; | 72 SkTDArray<FontRec> fFontRecords; |
73 | 73 |
74 SkTDArray<SkPDFFunctionShader*> fFunctionShaderRecords; | 74 SkTDArray<SkPDFFunctionShader*> fFunctionShaderRecords; |
75 | 75 |
76 SkTDArray<SkPDFAlphaFunctionShader*> fAlphaShaderRecords; | 76 SkTDArray<SkPDFAlphaFunctionShader*> fAlphaShaderRecords; |
77 | 77 |
78 SkTDArray<SkPDFImageShader*> fImageShaderRecords; | 78 SkTDArray<SkPDFImageShader*> fImageShaderRecords; |
79 | 79 |
80 struct WrapGS { | 80 struct WrapGS { |
81 explicit WrapGS(const SkPDFGraphicState* ptr = NULL) : fPtr(ptr) {} | 81 explicit WrapGS(const SkPDFGraphicState* ptr = nullptr) : fPtr(ptr) {} |
82 const SkPDFGraphicState* fPtr; | 82 const SkPDFGraphicState* fPtr; |
83 bool operator==(const WrapGS& rhs) const { | 83 bool operator==(const WrapGS& rhs) const { |
84 SkASSERT(fPtr); | 84 SkASSERT(fPtr); |
85 SkASSERT(rhs.fPtr); | 85 SkASSERT(rhs.fPtr); |
86 return *fPtr == *rhs.fPtr; | 86 return *fPtr == *rhs.fPtr; |
87 } | 87 } |
88 static uint32_t Hash(const WrapGS& w) { | 88 static uint32_t Hash(const WrapGS& w) { |
89 SkASSERT(w.fPtr); | 89 SkASSERT(w.fPtr); |
90 return w.fPtr->hash(); | 90 return w.fPtr->hash(); |
91 } | 91 } |
92 }; | 92 }; |
93 SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords; | 93 SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords; |
94 | 94 |
95 SkTDArray<SkPDFBitmap*> fBitmapRecords; | 95 SkTDArray<SkPDFBitmap*> fBitmapRecords; |
96 }; | 96 }; |
97 #endif // SkPDFCanon_DEFINED | 97 #endif // SkPDFCanon_DEFINED |
OLD | NEW |