OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPDFGraphicState_DEFINED | 10 #ifndef SkPDFGraphicState_DEFINED |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 SkPDFSMaskMode sMaskMode); | 64 SkPDFSMaskMode sMaskMode); |
65 | 65 |
66 /** Get a graphic state that only unsets the soft mask. The reference | 66 /** Get a graphic state that only unsets the soft mask. The reference |
67 * count of the object is incremented and it is the caller's responsibility | 67 * count of the object is incremented and it is the caller's responsibility |
68 * to unreference it when done. This is needed to accommodate the weak | 68 * to unreference it when done. This is needed to accommodate the weak |
69 * reference pattern used when the returned object is new and has no | 69 * reference pattern used when the returned object is new and has no |
70 * other references. | 70 * other references. |
71 */ | 71 */ |
72 static SkPDFGraphicState* GetNoSMaskGraphicState(); | 72 static SkPDFGraphicState* GetNoSMaskGraphicState(); |
73 | 73 |
| 74 bool equals(const SkPaint&) const; |
| 75 |
74 private: | 76 private: |
75 const SkPaint fPaint; | 77 const SkPaint fPaint; |
76 SkTDArray<SkPDFObject*> fResources; | 78 SkTDArray<SkPDFObject*> fResources; |
77 bool fPopulated; | 79 bool fPopulated; |
78 bool fSMask; | 80 bool fSMask; |
79 | 81 |
80 class GSCanonicalEntry { | |
81 public: | |
82 SkPDFGraphicState* fGraphicState; | |
83 const SkPaint* fPaint; | |
84 | |
85 bool operator==(const GSCanonicalEntry& b) const; | |
86 explicit GSCanonicalEntry(SkPDFGraphicState* gs) | |
87 : fGraphicState(gs), | |
88 fPaint(&gs->fPaint) {} | |
89 explicit GSCanonicalEntry(const SkPaint* paint) | |
90 : fGraphicState(NULL), | |
91 fPaint(paint) {} | |
92 }; | |
93 | |
94 // This should be made a hash table if performance is a problem. | |
95 static SkTDArray<GSCanonicalEntry>& CanonicalPaints(); | |
96 static SkBaseMutex& CanonicalPaintsMutex(); | |
97 | |
98 SkPDFGraphicState(); | 82 SkPDFGraphicState(); |
99 explicit SkPDFGraphicState(const SkPaint& paint); | 83 explicit SkPDFGraphicState(const SkPaint& paint); |
100 | 84 |
101 void populateDict(); | 85 void populateDict(); |
102 | 86 |
103 static SkPDFObject* GetInvertFunction(); | 87 static SkPDFObject* GetInvertFunction(); |
104 | 88 |
105 static int Find(const SkPaint& paint); | |
106 typedef SkPDFDict INHERITED; | 89 typedef SkPDFDict INHERITED; |
107 }; | 90 }; |
108 | 91 |
109 #endif | 92 #endif |
OLD | NEW |