diff options
author | vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-10-12 23:08:13 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2010-10-12 23:08:13 +0000 |
commit | d877fdbb6e64692285c3e6532d88b9458f65b3cd (patch) | |
tree | c346892a4d2d014c95acc6729174c779d0bfcd02 /include/pdf/SkPDFCatalog.h | |
parent | f66025d59ab4c8c4439fabf6ad89ddf35a19d1fd (diff) |
High level pdf classes and pdf specific interface.
The guts of the implementation will be in SkPDFDevice and below. This is a first implementation of everything above that point.
Review URL: http://codereview.appspot.com/2342043
git-svn-id: http://skia.googlecode.com/svn/trunk@602 2bbb7eff-a529-9590-31e7-b0007b416f81
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; |