diff options
author | halcanary <halcanary@google.com> | 2015-03-25 07:52:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-25 07:52:56 -0700 |
commit | 7a0118465a2dd1783d7b19b026bedd7e13afadf2 (patch) | |
tree | 852e597ea34512751375d86ff67b90f5f1afcd27 /src/pdf/SkPDFDocument.h | |
parent | 18e55800c629fe321dbf803f0c80fb67f23caf97 (diff) |
SkPDF: unclass skpdfdocument
BUG=skia:3585
Review URL: https://codereview.chromium.org/1030193002
Diffstat (limited to 'src/pdf/SkPDFDocument.h')
-rw-r--r-- | src/pdf/SkPDFDocument.h | 87 |
1 files changed, 21 insertions, 66 deletions
diff --git a/src/pdf/SkPDFDocument.h b/src/pdf/SkPDFDocument.h index fce9f9df83..f39b59ef47 100644 --- a/src/pdf/SkPDFDocument.h +++ b/src/pdf/SkPDFDocument.h @@ -11,77 +11,32 @@ #define SkPDFDocument_DEFINED #include "SkAdvancedTypefaceMetrics.h" -#include "SkRefCnt.h" #include "SkTDArray.h" -#include "SkTemplates.h" -class SkPDFCatalog; class SkPDFDevice; -class SkPDFDict; -class SkPDFPage; -class SkPDFObject; class SkWStream; -template <typename T> class SkTSet; -/** \class SkPDFDocument - - A SkPDFDocument assembles pages together and generates the final PDF file. -*/ -class SkPDFDocument { -public: - SkPDFDocument() {} - ~SkPDFDocument() { fPageDevices.unrefAll(); } - - /** Output the PDF to the passed stream. It is an error to call this (it - * will return false and not modify stream) if pageDevices is empty. - * No device pointer can be NULL. - * - * @param pageDevices An array of pages, in order. All pages - * should be created using the same SkPDFCanon. - * TODO(halcanary): ASSERT this condition. - * @param SkWStream The writable output stream to send the PDF to. - */ - static bool EmitPDF(const SkTDArray<SkPDFDevice*>& pageDevices, SkWStream*); - - /** Output the PDF to the passed stream. It is an error to call this (it - * will return false and not modify stream) if no pages have been added. - * - * @param stream The writable output stream to send the PDF to. - */ - bool emitPDF(SkWStream* stream) const { - return SkPDFDocument::EmitPDF(fPageDevices, stream); - } - - /** Append the passed pdf device to the document as a new page. - * - * @param pdfDevice The page to add to this document. All pages - * added to this document should be created - * using the same SkPDFCanon. - */ - void appendPage(SkPDFDevice* pdfDevice) { - fPageDevices.push(SkRef(pdfDevice)); - } - - /** Get the count of unique font types used in the given pages. - */ - static void GetCountOfFontTypes( - const SkTDArray<SkPDFDevice*>& pageDevices, - int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], - int* notSubsettableCount, - int* notEmbedddableCount); - - /** Get the count of unique font types used in the document. - */ - void getCountOfFontTypes( - int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], - int* notSubsettableCount, - int* notEmbedddableCount) const { - return SkPDFDocument::GetCountOfFontTypes( - fPageDevices, counts, notSubsettableCount, notEmbedddableCount); - } +namespace SkPDFDocument { +/** + * Assemble pages together and generate a PDF document file. + * + * Output the PDF to the passed stream. It is an error to call this (it + * will return false and not modify stream) if pageDevices is empty. + * No device pointer can be NULL. + * + * @param pageDevices An array of pages, in order. All pages + * should be created using the same SkPDFCanon. + * TODO(halcanary): ASSERT this condition. + * @param SkWStream The writable output stream to send the PDF to. + */ +bool EmitPDF(const SkTDArray<SkPDFDevice*>& pageDevices, SkWStream*); -private: - SkTDArray<SkPDFDevice*> fPageDevices; -}; +/** Get the count of unique font types used in the given pages. + */ +void GetCountOfFontTypes(const SkTDArray<SkPDFDevice*>& pageDevices, + int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], + int* notSubsettableCount, + int* notEmbedddableCount); +} #endif |