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

Unified Diff: src/pdf/SkPDFTypes.h

Issue 18585002: Implemented transparent gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixes isValid() in SkPDFGradientShader, fixes tinybitmap regression Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: src/pdf/SkPDFTypes.h
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 5ed6386bddc1235d33a9dbcabe65c78a33a8bb6e..7f4d06e8106376a4fd7980c052ef3be2292a94af 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -441,4 +441,85 @@ private:
typedef SkPDFObject INHERITED;
};
+/** \class SkPDFResourceDict
+
+ A resource dictionary, which also allows generation of a list of referenced
+ SkPDFObjects. These must be added to the dict with insertResource.
+*/
+class SkPDFResourceDict : public SkPDFDict {
vandebo (ex-Chrome) 2013/07/08 19:02:25 Not sure I'm happy with how this turned out. It's
ducky 2013/07/09 02:56:23 Looks like it can be used in SkPDFDevice, the only
+ public:
+ SK_DECLARE_INST_COUNT(SkPDFResourceDict)
+
+ /** Create a PDF dictionary. Maximum number of entries is 4095.
vandebo (ex-Chrome) 2013/07/08 19:02:25 comments are out of date....
ducky 2013/07/09 02:56:23 Done.
+ */
+ SkPDFResourceDict() : SkPDFDict() {};
+
+ /** Create a PDF dictionary with a Type entry.
+ * @param type The value of the Type entry.
+ */
+ explicit SkPDFResourceDict(const char type[]) : SkPDFDict(type) {};
+
+
+ /** 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,
+ 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[],
+ 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
« src/pdf/SkPDFShader.cpp ('K') | « src/pdf/SkPDFShader.cpp ('k') | src/pdf/SkPDFTypes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698