diff options
Diffstat (limited to 'include/pdf/SkPDFCatalog.h')
-rw-r--r-- | include/pdf/SkPDFCatalog.h | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/include/pdf/SkPDFCatalog.h b/include/pdf/SkPDFCatalog.h index 932f1c895b..6e530db33b 100644 --- a/include/pdf/SkPDFCatalog.h +++ b/include/pdf/SkPDFCatalog.h @@ -34,23 +34,39 @@ public: ~SkPDFCatalog(); /** Add the passed object to the catalog. - * @param obj The object to add. - * @param onFirstPage Is the object on the first page. + * @param obj The object to add. + * @param onFirstPage Is the object on the first page. */ void 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 + * the object's size. + * @param obj The object to add. + * @param offset The byte offset in the output stream of this object. + */ + size_t setFileOffset(SkPDFObject* obj, size_t offset); + /** Output the object number for the passed object. - * @param obj The object of interest. - * @param stream The writable output stream to send the output to. + * @param obj The object of interest. + * @param stream The writable output stream to send the output to. */ void emitObjectNumber(SkWStream* stream, SkPDFObject* obj); /** Return the number of bytes that would be emitted for the passed * object's object number. - * @param obj The object of interest + * @param obj The object of interest */ size_t getObjectNumberSize(SkPDFObject* obj); + /** Output the cross reference table for objects in the catalog. + * Returns the total number of objects. + * @param stream The writable output stream to send the output to. + * @param firstPage If true, include first page objects only, otherwise + * include all objects not on the first page. + */ + int32_t emitXrefTable(SkWStream* stream, bool firstPage); + private: struct Rec { Rec(SkPDFObject* object, bool onFirstPage) @@ -68,9 +84,12 @@ private: // TODO(vandebo) Make this a hash if it's a performance problem. SkTDArray<struct Rec> fCatalog; + // Number of objects on the first page. + uint32_t fFirstPageCount; + // Next object number to assign (on page > 1). uint32_t fNextObjNum; - bool fStartedAssigningObjNums; - bool fAssigningFirstPageObjNums; + // Next object number to assign on the first page. + uint32_t fNextFirstPageObjNum; int findObjectIndex(SkPDFObject* obj) const; |