aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFCanon.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf/SkPDFCanon.h')
-rw-r--r--src/pdf/SkPDFCanon.h36
1 files changed, 3 insertions, 33 deletions
diff --git a/src/pdf/SkPDFCanon.h b/src/pdf/SkPDFCanon.h
index 0aac2b5789..d876443c17 100644
--- a/src/pdf/SkPDFCanon.h
+++ b/src/pdf/SkPDFCanon.h
@@ -20,19 +20,6 @@ struct SkAdvancedTypefaceMetrics;
/**
* The SkPDFCanon canonicalizes objects across PDF pages
* (SkPDFDevices) and across draw calls.
- *
- * The PDF backend works correctly if:
- * - There is no more than one SkPDFCanon for each thread.
- * - Every SkPDFDevice is given a pointer to a SkPDFCanon on creation.
- * - All SkPDFDevices in a document share the same SkPDFCanon.
- * The SkPDFDocument class makes this happen by owning a single
- * SkPDFCanon.
- *
- * The addFoo() methods will ref the Foo; the canon's destructor will
- * call foo->unref() on all of these objects.
- *
- * The findFoo() methods do not change the ref count of the Foo
- * objects.
*/
class SkPDFCanon : SkNoncopyable {
public:
@@ -47,15 +34,15 @@ public:
sk_sp<SkPDFObject> findImageShader(const SkPDFShader::State&) const;
void addImageShader(sk_sp<SkPDFObject>, SkPDFShader::State);
- const SkPDFGraphicState* findGraphicState(const SkPDFGraphicState&) const;
- void addGraphicState(const SkPDFGraphicState*);
-
SkTHashMap<SkBitmapKey, sk_sp<SkPDFObject>> fPDFBitmapMap;
SkTHashMap<uint32_t, std::unique_ptr<SkAdvancedTypefaceMetrics>> fTypefaceMetrics;
SkTHashMap<uint32_t, sk_sp<SkPDFDict>> fFontDescriptors;
SkTHashMap<uint64_t, sk_sp<SkPDFFont>> fFontMap;
+ SkTHashMap<SkPDFStrokeGraphicState, sk_sp<SkPDFDict>> fStrokeGSMap;
+ SkTHashMap<SkPDFFillGraphicState, sk_sp<SkPDFDict>> fFillGSMap;
+
sk_sp<SkPixelSerializer> fPixelSerializer;
sk_sp<SkPDFStream> fInvertFunction;
sk_sp<SkPDFDict> fNoSmaskGraphicState;
@@ -69,22 +56,5 @@ private:
SkTArray<ShaderRec> fFunctionShaderRecords;
SkTArray<ShaderRec> fAlphaShaderRecords;
SkTArray<ShaderRec> fImageShaderRecords;
-
- struct WrapGS {
- explicit WrapGS(const SkPDFGraphicState* ptr = nullptr) : fPtr(ptr) {}
- const SkPDFGraphicState* fPtr;
- bool operator==(const WrapGS& rhs) const {
- SkASSERT(fPtr);
- SkASSERT(rhs.fPtr);
- return *fPtr == *rhs.fPtr;
- }
- struct Hash {
- uint32_t operator()(const WrapGS& w) const {
- SkASSERT(w.fPtr);
- return w.fPtr->hash();
- }
- };
- };
- SkTHashSet<WrapGS, WrapGS::Hash> fGraphicStateRecords;
};
#endif // SkPDFCanon_DEFINED