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

Unified Diff: src/pdf/SkPDFTypes.h

Issue 870333002: Simplify reference management in SkPDF (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make Created 5 years, 10 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
« no previous file with comments | « src/pdf/SkPDFShader.cpp ('k') | src/pdf/SkPDFTypes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFTypes.h
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 367bb7fda64d38c96607c59da1c3e9b3af817fe2..54c59f28be9c375cacb7882be06323ec538391fc 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -21,6 +21,8 @@
class SkPDFCatalog;
class SkWStream;
+class SkPDFObject;
+
/** \class SkPDFObject
A PDF Object is the base class for primitive elements in a PDF file. A
@@ -36,41 +38,17 @@ public:
* @param catalog The object catalog to use.
* @param stream The writable output stream to send the output to.
*/
+ // TODO(halcanary): make this method const
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) = 0;
- /** For non-primitive objects (i.e. objects defined outside this file),
- * this method will add to newResourceObjects any objects that this method
- * depends on, but not already in knownResourceObjects. This operates
- * recursively so if this object depends on another object and that object
- * depends on two more, all three objects will be added.
+ /**
+ * Adds all transitive dependencies of this object to resourceSet.
*
- * @param knownResourceObjects The set of resources to be ignored.
- * @param newResourceObjects The set to append dependant resources to.
- */
- virtual void getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
- SkTSet<SkPDFObject*>* newResourceObjects);
-
- /** Static helper function to add a resource to a list. The list takes
- * a reference.
- * @param resource The resource to add.
- * @param list The list to add the resource to.
- */
- static void AddResourceHelper(SkPDFObject* resource,
- SkTDArray<SkPDFObject*>* list);
-
- /** Static helper function to copy and reference the resources (and all
- * their subresources) into a new list.
- * @param resources The resource list.
- * @param newResourceObjects All the resource objects (recursively) used on
- * the page are added to this array. This gives
- * the caller a chance to deduplicate resources
- * across pages.
- * @param knownResourceObjects The set of resources to be ignored.
+ * @param catalog Implementations should respect the catalog's
+ * object substitution map.
*/
- static void GetResourcesHelper(
- const SkTDArray<SkPDFObject*>* resources,
- const SkTSet<SkPDFObject*>& knownResourceObjects,
- SkTSet<SkPDFObject*>* newResourceObjects);
+ virtual void addResources(SkTSet<SkPDFObject*>* resourceSet,
+ SkPDFCatalog* catalog) const {}
private:
typedef SkRefCnt INHERITED;
@@ -92,6 +70,7 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
+ virtual void addResources(SkTSet<SkPDFObject*>*, SkPDFCatalog*) const SK_OVERRIDE;
private:
SkAutoTUnref<SkPDFObject> fObj;
@@ -255,6 +234,7 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
+ virtual void addResources(SkTSet<SkPDFObject*>*, SkPDFCatalog*) const SK_OVERRIDE;
/** The size of the array.
*/
@@ -326,6 +306,7 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
+ virtual void addResources(SkTSet<SkPDFObject*>*, SkPDFCatalog*) const SK_OVERRIDE;
/** The size of the dictionary.
*/
« no previous file with comments | « src/pdf/SkPDFShader.cpp ('k') | src/pdf/SkPDFTypes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698