diff options
author | 2016-03-21 14:33:17 -0700 | |
---|---|---|
committer | 2016-03-21 14:33:17 -0700 | |
commit | 989da4a32cd6823359f31c971c3b3f31425e905e (patch) | |
tree | 0ff6449e003fdbd7413bc5604b16f2a2a4c878dc /src/pdf/SkPDFDevice.h | |
parent | 2cab66be9c47660da6a2cc94b469c14d5bed958e (diff) |
SkPDF: SkPDFDevice has ptr to SkPDFDocument
This is necessary for pre-serialization of images.
BUG=skia:5087
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1802963002
Review URL: https://codereview.chromium.org/1802963002
Diffstat (limited to 'src/pdf/SkPDFDevice.h')
-rw-r--r-- | src/pdf/SkPDFDevice.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h index b214839f5a..138ec19b59 100644 --- a/src/pdf/SkPDFDevice.h +++ b/src/pdf/SkPDFDevice.h @@ -25,6 +25,7 @@ class SkPDFArray; class SkPDFCanon; class SkPDFDevice; +class SkPDFDocument; class SkPDFDict; class SkPDFFont; class SkPDFFormXObject; @@ -59,20 +60,23 @@ public: * while rendering, and it would be slower to be processed * or sent online or to printer. A good choice is * SK_ScalarDefaultRasterDPI(72.0f). - * @param SkPDFCanon. Should be non-null, and shared by all - * devices in a document. + * @param SkPDFDocument. A non-null pointer back to the + * document. The document is repsonsible for + * de-duplicating across pages (via the SkPDFCanon) and + * for early serializing of large immutable objects, such + * as images (via SkPDFDocument::serialize()). */ static SkPDFDevice* Create(SkISize pageSize, SkScalar rasterDpi, - SkPDFCanon* canon) { - return new SkPDFDevice(pageSize, rasterDpi, canon, true); + SkPDFDocument* doc) { + return new SkPDFDevice(pageSize, rasterDpi, doc, true); } /** Create a PDF drawing context without fipping the y-axis. */ static SkPDFDevice* CreateUnflipped(SkISize pageSize, SkScalar rasterDpi, - SkPDFCanon* canon) { - return new SkPDFDevice(pageSize, rasterDpi, canon, false); + SkPDFDocument* doc) { + return new SkPDFDevice(pageSize, rasterDpi, doc, false); } virtual ~SkPDFDevice(); @@ -184,7 +188,7 @@ public: return *(fFontGlyphUsage.get()); } - SkPDFCanon* getCanon() const { return fCanon; } + SkPDFCanon* getCanon() const; protected: const SkBitmap& onAccessBitmap() override { @@ -261,12 +265,12 @@ private: SkBitmap fLegacyBitmap; - SkPDFCanon* fCanon; // Owned by SkDocument_PDF + SkPDFDocument* fDocument; //////////////////////////////////////////////////////////////////////////// SkPDFDevice(SkISize pageSize, SkScalar rasterDpi, - SkPDFCanon* canon, + SkPDFDocument* doc, bool flip); ContentEntry* getLastContentEntry(); |