Index: src/pdf/SkPDFTypes.h |
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h |
index 5ed6386bddc1235d33a9dbcabe65c78a33a8bb6e..a5904e7c75250be33fa41ad19c09933b546e723d 100644 |
--- a/src/pdf/SkPDFTypes.h |
+++ b/src/pdf/SkPDFTypes.h |
@@ -441,4 +441,86 @@ private: |
typedef SkPDFObject INHERITED; |
}; |
+/** \class SkPDFResourceDict |
+ |
+ A resource dictionary, which maintains the relevant sub-dicts and |
+ allows generation of a list of referenced SkPDFObjects inserted with |
+ insertResourceAsRef. |
+*/ |
+class SkPDFResourceDict : public SkPDFDict { |
vandebo (ex-Chrome)
2013/07/09 17:47:44
This should go in its own file.
ducky
2013/07/10 21:42:26
Done. Will also move to a separate CL.
|
+ public: |
+ SK_DECLARE_INST_COUNT(SkPDFResourceDict) |
+ |
+ /** Create a PDF resource dictionary. |
+ */ |
+ SkPDFResourceDict() : SkPDFDict() {}; |
vandebo (ex-Chrome)
2013/07/09 17:47:44
Should this take a parameter indicating whether it
ducky
2013/07/10 21:42:26
Done. Added a boolean parameter to automatically c
|
+ |
+ /** Create a PDF dictionary with a Type entry. |
+ * @param type The value of the Type entry. |
+ */ |
+ explicit SkPDFResourceDict(const char type[]) : SkPDFDict(type) {}; |
vandebo (ex-Chrome)
2013/07/09 17:47:44
Is this used/needed?
ducky
2013/07/10 21:42:26
Looks like no, as the spec makes no mention of a T
|
+ |
+ |
+ /** Add the value to the dictionary with the given key. Refs value. |
+ * The object will NOT be part of the resource list when requested later. |
+ * @param type The type of resource being entered, like Pattern or ExtGState. |
+ * @param key The resource key, unique within the type. |
+ * @param value The resource itself. |
+ * @return The value argument is returned. |
+ */ |
+ SkPDFObject* insertResource(SkPDFName* type, SkPDFName* key, |
vandebo (ex-Chrome)
2013/07/09 17:47:44
|type| should probably be an enum.
vandebo (ex-Chrome)
2013/07/09 17:47:44
|key| should probably be an int with class static
ducky
2013/07/10 21:42:26
Done.
ducky
2013/07/10 21:42:26
Done.
|
+ SkPDFObject* value); |
+ |
+ /** Add the value to the dictionary with the given key. Refs value. |
+ * The object will NOT be part of the resource list when requested later. |
+ * This method will create the SkPDFName object. |
+ * @param type The type of resource being entered, like Pattern or ExtGState. |
+ * @param key The resource key, unique within the type. |
+ * @param value The resource itself. |
+ * @return The value argument is returned. |
+ */ |
+ SkPDFObject* insertResource(const char type[], const char key[], |
+ SkPDFObject* value); |
+ |
+ /** Add the value SkPDFObject as a reference to the dictionary |
+ * with the given key. Refs value. |
+ * This object will be part of the resource list when requested later. |
+ * This method will create the SkPDFName object. |
+ * @param type The type of resource being entered, like Pattern or ExtGState. |
+ * @param key The resource key, unique within the type. |
+ * @param value The resource itself. |
+ * @return The value argument is returned. |
+ */ |
+ SkPDFObject* insertResourceAsRef(const char type[], const char key[], |
vandebo (ex-Chrome)
2013/07/09 17:47:44
Aside from proc set, shouldn't all resources in th
ducky
2013/07/10 21:42:26
It doesn't have to be - I've seen PDFs where resou
|
+ SkPDFObject* value); |
+ |
+ /** |
+ * Gets resources inserted into this dictionary. |
+ * |
+ * @param knownResourceObjects Set containing currently known resources. |
+ * Resources in the dict and in this set will not be added to the output. |
+ * @param newResourceObjects Output set to which non-preexisting resources |
+ * will be added. |
+ */ |
+ void getResources( |
+ const SkTSet<SkPDFObject*>& knownResourceObjects, |
+ SkTSet<SkPDFObject*>* newResourceObjects); |
+ |
+ private: |
+ /** |
+ * Returns the sub-dict associated with the resource type type. |
+ * If none currently exists, this will create a sub-dict and index it for |
+ * future use. |
+ */ |
+ SkPDFDict* getResourceTypeDict(SkPDFName* type); |
+ |
+ SkTSet<SkPDFObject*> fResources; |
+ |
+ struct DictRec { |
+ SkPDFName* key; |
+ SkPDFDict* value; |
+ }; |
+ SkTDArray<struct DictRec> fTypes; |
+}; |
+ |
#endif |