diff options
author | 2011-02-01 22:19:44 +0000 | |
---|---|---|
committer | 2011-02-01 22:19:44 +0000 | |
commit | f7c157610ff85f7323f5e213b62478dcc66edbec (patch) | |
tree | f49c4a700685466c0ad80b2f0f5c0b04b205f1b9 /include | |
parent | 6f7fbc9fbb584b9b9fa6ed3a677d71ecd49aafce (diff) |
[PDF] Clean up ref counting.
Return ref'd objs where possible enabling removal of many SkRefPtr<> variables.
Review URL: http://codereview.appspot.com/4029051
git-svn-id: http://skia.googlecode.com/svn/trunk@750 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/pdf/SkPDFCatalog.h | 5 | ||||
-rw-r--r-- | include/pdf/SkPDFFormXObject.h | 10 | ||||
-rw-r--r-- | include/pdf/SkPDFImage.h | 15 | ||||
-rw-r--r-- | include/pdf/SkPDFStream.h | 10 | ||||
-rw-r--r-- | include/pdf/SkPDFTypes.h | 22 |
5 files changed, 37 insertions, 25 deletions
diff --git a/include/pdf/SkPDFCatalog.h b/include/pdf/SkPDFCatalog.h index 60f9791f96..f004a1dc03 100644 --- a/include/pdf/SkPDFCatalog.h +++ b/include/pdf/SkPDFCatalog.h @@ -35,11 +35,12 @@ public: SkPDFCatalog(); ~SkPDFCatalog(); - /** Add the passed object to the catalog. + /** Add the passed object to the catalog. Refs obj. * @param obj The object to add. * @param onFirstPage Is the object on the first page. + * @return The obj argument is returned. */ - void addObject(SkPDFObject* obj, bool onFirstPage); + SkPDFObject* addObject(SkPDFObject* obj, bool onFirstPage); /** Inform the catalog of the object's position in the final stream. * The object should already have been added to the catalog. Returns diff --git a/include/pdf/SkPDFFormXObject.h b/include/pdf/SkPDFFormXObject.h index 288a4499e1..6a16709bdf 100644 --- a/include/pdf/SkPDFFormXObject.h +++ b/include/pdf/SkPDFFormXObject.h @@ -52,17 +52,19 @@ public: virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect); virtual void getResources(SkTDArray<SkPDFObject*>* resourceList); - /** Add the value to the stream dictionary with the given key. + /** Add the value to the stream dictionary with the given key. Refs value. * @param key The key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(SkPDFName* key, SkPDFObject* value); + SkPDFObject* insert(SkPDFName* key, SkPDFObject* value); - /** Add the value to the stream dictionary with the given key. + /** Add the value to the stream dictionary with the given key. Refs value. * @param key The text of the key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(const char key[], SkPDFObject* value); + SkPDFObject* insert(const char key[], SkPDFObject* value); private: SkString fContent; diff --git a/include/pdf/SkPDFImage.h b/include/pdf/SkPDFImage.h index 9b4e4f9558..7966e99e6f 100644 --- a/include/pdf/SkPDFImage.h +++ b/include/pdf/SkPDFImage.h @@ -49,10 +49,11 @@ public: virtual ~SkPDFImage(); - /** Add a Soft Mask (alpha or shape channel) to the image. + /** Add a Soft Mask (alpha or shape channel) to the image. Refs mask. * @param mask A gray scale image representing the mask. + * @return The mask argument is returned. */ - void addSMask(SkPDFImage* mask); + SkPDFImage* addSMask(SkPDFImage* mask); // The SkPDFObject interface. virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog, @@ -76,17 +77,19 @@ private: SkPDFImage(SkStream* imageData, const SkBitmap& bitmap, const SkIRect& srcRect, bool alpha, const SkPaint& paint); - /** Add the value to the stream dictionary with the given key. + /** Add the value to the stream dictionary with the given key. Refs value. * @param key The key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(SkPDFName* key, SkPDFObject* value); + SkPDFObject* insert(SkPDFName* key, SkPDFObject* value); - /** Add the value to the stream dictionary with the given key. + /** Add the value to the stream dictionary with the given key. Refs value. * @param key The text of the key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(const char key[], SkPDFObject* value); + SkPDFObject* insert(const char key[], SkPDFObject* value); }; #endif diff --git a/include/pdf/SkPDFStream.h b/include/pdf/SkPDFStream.h index 10a40b6f98..5310b4e896 100644 --- a/include/pdf/SkPDFStream.h +++ b/include/pdf/SkPDFStream.h @@ -43,17 +43,19 @@ public: bool indirect); virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect); - /** Add the value to the stream dictionary with the given key. + /** Add the value to the stream dictionary with the given key. Refs value. * @param key The key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(SkPDFName* key, SkPDFObject* value); + SkPDFObject* insert(SkPDFName* key, SkPDFObject* value); - /** Add the value to the stream dictionary with the given key. + /** Add the value to the stream dictionary with the given key. Refs value. * @param key The text of the key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(const char key[], SkPDFObject* value); + SkPDFObject* insert(const char key[], SkPDFObject* value); private: SkPDFDict fDict; diff --git a/include/pdf/SkPDFTypes.h b/include/pdf/SkPDFTypes.h index fc9b62c30a..7d596346e6 100644 --- a/include/pdf/SkPDFTypes.h +++ b/include/pdf/SkPDFTypes.h @@ -253,16 +253,18 @@ public: */ SkPDFObject* getAt(int index) { return fValue[index]; } - /** Set the object at the given offset in the array. + /** Set the object at the given offset in the array. Ref's value. * @param index The index into the array to set. * @param value The value to add to the array. + * @return The value argument is returned. */ - void setAt(int index, SkPDFObject* value); + SkPDFObject* setAt(int index, SkPDFObject* value); - /** Append the object to the end of the array. + /** Append the object to the end of the array and increments its ref count. * @param value The value to add to the array. + * @return The value argument is returned. */ - void append(SkPDFObject* value); + SkPDFObject* append(SkPDFObject* value); private: static const int kMaxLen = 8191; @@ -295,18 +297,20 @@ public: */ int size() { return fValue.count(); } - /** Add the value to the dictionary with the given key. + /** Add the value to the dictionary with the given key. Refs value. * @param key The key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(SkPDFName* key, SkPDFObject* value); + SkPDFObject* insert(SkPDFName* key, SkPDFObject* value); - /** Add the value to the dictionary with the given key. The method will - * create the SkPDFName object. + /** Add the value to the dictionary with the given key. Refs value. The + * method will create the SkPDFName object. * @param key The text of the key for this dictionary entry. * @param value The value for this dictionary entry. + * @return The value argument is returned. */ - void insert(const char key[], SkPDFObject* value); + SkPDFObject* insert(const char key[], SkPDFObject* value); /** Remove all entries from the dictionary. */ |