| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkPDFCatalog_DEFINED | 10 #ifndef SkPDFCatalog_DEFINED |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 ~SkPDFCatalog(); | 30 ~SkPDFCatalog(); |
| 31 | 31 |
| 32 /** Add the passed object to the catalog. Refs obj. | 32 /** Add the passed object to the catalog. Refs obj. |
| 33 * @param obj The object to add. | 33 * @param obj The object to add. |
| 34 * @param onFirstPage Is the object on the first page. | 34 * @param onFirstPage Is the object on the first page. |
| 35 * @return The obj argument is returned. | 35 * @return The obj argument is returned. |
| 36 */ | 36 */ |
| 37 SkPDFObject* addObject(SkPDFObject* obj, bool onFirstPage); | 37 SkPDFObject* addObject(SkPDFObject* obj, bool onFirstPage); |
| 38 | 38 |
| 39 /** Inform the catalog of the object's position in the final stream. | 39 /** Inform the catalog of the object's position in the final stream. |
| 40 * The object should already have been added to the catalog. Returns | 40 * The object should already have been added to the catalog. |
| 41 * the object's size. | |
| 42 * @param obj The object to add. | 41 * @param obj The object to add. |
| 43 * @param offset The byte offset in the output stream of this object. | 42 * @param offset The byte offset in the output stream of this object. |
| 44 */ | 43 */ |
| 45 size_t setFileOffset(SkPDFObject* obj, off_t offset); | 44 void setFileOffset(SkPDFObject* obj, off_t offset); |
| 46 | 45 |
| 47 /** Output the object number for the passed object. | 46 /** Output the object number for the passed object. |
| 48 * @param obj The object of interest. | 47 * @param obj The object of interest. |
| 49 * @param stream The writable output stream to send the output to. | 48 * @param stream The writable output stream to send the output to. |
| 50 */ | 49 */ |
| 51 void emitObjectNumber(SkWStream* stream, SkPDFObject* obj); | 50 void emitObjectNumber(SkWStream* stream, SkPDFObject* obj); |
| 52 | 51 |
| 53 /** Return the number of bytes that would be emitted for the passed | 52 /** Return the number of bytes that would be emitted for the passed |
| 54 * object's object number. | 53 * object's object number. |
| 55 * @param obj The object of interest | 54 * @param obj The object of interest |
| (...skipping 14 matching lines...) Expand all Loading... |
| 70 | 69 |
| 71 /** Set substitute object for the passed object. | 70 /** Set substitute object for the passed object. |
| 72 */ | 71 */ |
| 73 void setSubstitute(SkPDFObject* original, SkPDFObject* substitute); | 72 void setSubstitute(SkPDFObject* original, SkPDFObject* substitute); |
| 74 | 73 |
| 75 /** Find and return any substitute object set for the passed object. If | 74 /** Find and return any substitute object set for the passed object. If |
| 76 * there is none, return the passed object. | 75 * there is none, return the passed object. |
| 77 */ | 76 */ |
| 78 SkPDFObject* getSubstituteObject(SkPDFObject* object); | 77 SkPDFObject* getSubstituteObject(SkPDFObject* object); |
| 79 | 78 |
| 80 /** Set file offsets for the resources of substitute objects. | 79 /** get the resources of substitute objects. |
| 81 * @param fileOffset Accumulated offset of current document. | |
| 82 * @param firstPage Indicate whether this is for the first page only. | |
| 83 * @return Total size of resources of substitute objects. | |
| 84 */ | 80 */ |
| 85 off_t setSubstituteResourcesOffsets(off_t fileOffset, bool firstPage); | 81 SkTSet<SkPDFObject*>* getSubstituteList(bool firstPage); |
| 86 | |
| 87 /** Emit the resources of substitute objects. | |
| 88 */ | |
| 89 void emitSubstituteResources(SkWStream* stream, bool firstPage); | |
| 90 | 82 |
| 91 private: | 83 private: |
| 92 struct Rec { | 84 struct Rec { |
| 93 Rec(SkPDFObject* object, bool onFirstPage) | 85 Rec(SkPDFObject* object, bool onFirstPage) |
| 94 : fObject(object), | 86 : fObject(object), |
| 95 fFileOffset(0), | 87 fFileOffset(0), |
| 96 fObjNumAssigned(false), | 88 fObjNumAssigned(false), |
| 97 fOnFirstPage(onFirstPage) { | 89 fOnFirstPage(onFirstPage) { |
| 98 } | 90 } |
| 99 SkPDFObject* fObject; | 91 SkPDFObject* fObject; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 123 // Next object number to assign (on page > 1). | 115 // Next object number to assign (on page > 1). |
| 124 uint32_t fNextObjNum; | 116 uint32_t fNextObjNum; |
| 125 // Next object number to assign on the first page. | 117 // Next object number to assign on the first page. |
| 126 uint32_t fNextFirstPageObjNum; | 118 uint32_t fNextFirstPageObjNum; |
| 127 | 119 |
| 128 SkPDFDocument::Flags fDocumentFlags; | 120 SkPDFDocument::Flags fDocumentFlags; |
| 129 | 121 |
| 130 int findObjectIndex(SkPDFObject* obj) const; | 122 int findObjectIndex(SkPDFObject* obj) const; |
| 131 | 123 |
| 132 int assignObjNum(SkPDFObject* obj); | 124 int assignObjNum(SkPDFObject* obj); |
| 133 | |
| 134 SkTSet<SkPDFObject*>* getSubstituteList(bool firstPage); | |
| 135 }; | 125 }; |
| 136 | 126 |
| 137 #endif | 127 #endif |
| OLD | NEW |