Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: src/pdf/SkPDFDocument.h

Issue 1891873002: SkPDF: PDF/A runtime switch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-21 (Thursday) 16:21:36 EDT Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFDocument.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #ifndef SkPDFDocument_DEFINED 7 #ifndef SkPDFDocument_DEFINED
8 #define SkPDFDocument_DEFINED 8 #define SkPDFDocument_DEFINED
9 9
10 #include "SkDocument.h" 10 #include "SkDocument.h"
11 #include "SkPDFCanon.h" 11 #include "SkPDFCanon.h"
12 #include "SkPDFMetadata.h" 12 #include "SkPDFMetadata.h"
13 #include "SkPDFFont.h" 13 #include "SkPDFFont.h"
14 14
15 class SkPDFDevice; 15 class SkPDFDevice;
16 16
17 sk_sp<SkDocument> SkPDFMakeDocument( 17 sk_sp<SkDocument> SkPDFMakeDocument(
18 SkWStream* stream, 18 SkWStream* stream,
19 void (*doneProc)(SkWStream*, bool), 19 void (*doneProc)(SkWStream*, bool),
20 SkScalar rasterDpi, 20 SkScalar rasterDpi,
21 SkPixelSerializer* jpegEncoder); 21 SkPixelSerializer* jpegEncoder,
22 bool pdfa);
22 23
23 // Logically part of SkPDFDocument (like SkPDFCanon), but separate to 24 // Logically part of SkPDFDocument (like SkPDFCanon), but separate to
24 // keep similar functionality together. 25 // keep similar functionality together.
25 struct SkPDFObjectSerializer : SkNoncopyable { 26 struct SkPDFObjectSerializer : SkNoncopyable {
26 SkPDFObjNumMap fObjNumMap; 27 SkPDFObjNumMap fObjNumMap;
27 SkPDFSubstituteMap fSubstituteMap; 28 SkPDFSubstituteMap fSubstituteMap;
28 SkTDArray<int32_t> fOffsets; 29 SkTDArray<int32_t> fOffsets;
29 sk_sp<SkPDFObject> fInfoDict; 30 sk_sp<SkPDFObject> fInfoDict;
30 size_t fBaseOffset; 31 size_t fBaseOffset;
31 int32_t fNextToBeSerialized; // index in fObjNumMap 32 int32_t fNextToBeSerialized; // index in fObjNumMap
32 33
33 SkPDFObjectSerializer(); 34 SkPDFObjectSerializer();
34 ~SkPDFObjectSerializer(); 35 ~SkPDFObjectSerializer();
35 void addObjectRecursively(const sk_sp<SkPDFObject>&); 36 void addObjectRecursively(const sk_sp<SkPDFObject>&);
36 void serializeHeader(SkWStream*, const SkPDFMetadata&); 37 void serializeHeader(SkWStream*, const SkPDFMetadata&);
37 void serializeObjects(SkWStream*); 38 void serializeObjects(SkWStream*);
38 void serializeFooter(SkWStream*, const sk_sp<SkPDFObject>, sk_sp<SkPDFObject >); 39 void serializeFooter(SkWStream*, const sk_sp<SkPDFObject>, sk_sp<SkPDFObject >);
39 int32_t offset(SkWStream*); 40 int32_t offset(SkWStream*);
40 }; 41 };
41 42
42 /** Concrete implementation of SkDocument that creates PDF files. This 43 /** Concrete implementation of SkDocument that creates PDF files. This
43 class does not produced linearized or optimized PDFs; instead it 44 class does not produced linearized or optimized PDFs; instead it
44 it attempts to use a minimum amount of RAM. */ 45 it attempts to use a minimum amount of RAM. */
45 class SkPDFDocument : public SkDocument { 46 class SkPDFDocument : public SkDocument {
46 public: 47 public:
47 SkPDFDocument(SkWStream*, 48 SkPDFDocument(SkWStream*,
48 void (*)(SkWStream*, bool), 49 void (*)(SkWStream*, bool),
49 SkScalar, 50 SkScalar,
50 SkPixelSerializer*); 51 SkPixelSerializer*,
52 bool);
51 virtual ~SkPDFDocument(); 53 virtual ~SkPDFDocument();
52 SkCanvas* onBeginPage(SkScalar, SkScalar, const SkRect&) override; 54 SkCanvas* onBeginPage(SkScalar, SkScalar, const SkRect&) override;
53 void onEndPage() override; 55 void onEndPage() override;
54 bool onClose(SkWStream*) override; 56 bool onClose(SkWStream*) override;
55 void onAbort() override; 57 void onAbort() override;
56 void setMetadata(const SkDocument::Attribute[], 58 void setMetadata(const SkDocument::Attribute[],
57 int, 59 int,
58 const SkTime::DateTime*, 60 const SkTime::DateTime*,
59 const SkTime::DateTime*) override; 61 const SkTime::DateTime*) override;
60 /** 62 /**
(...skipping 11 matching lines...) Expand all
72 SkPDFCanon* canon() { return &fCanon; } 74 SkPDFCanon* canon() { return &fCanon; }
73 75
74 private: 76 private:
75 SkPDFObjectSerializer fObjectSerializer; 77 SkPDFObjectSerializer fObjectSerializer;
76 SkPDFCanon fCanon; 78 SkPDFCanon fCanon;
77 SkPDFGlyphSetMap fGlyphUsage; 79 SkPDFGlyphSetMap fGlyphUsage;
78 SkTArray<sk_sp<SkPDFDict>> fPages; 80 SkTArray<sk_sp<SkPDFDict>> fPages;
79 sk_sp<SkPDFDict> fDests; 81 sk_sp<SkPDFDict> fDests;
80 sk_sp<SkPDFDevice> fPageDevice; 82 sk_sp<SkPDFDevice> fPageDevice;
81 sk_sp<SkCanvas> fCanvas; 83 sk_sp<SkCanvas> fCanvas;
82 #ifdef SK_PDF_GENERATE_PDFA
83 sk_sp<SkPDFObject> fID; 84 sk_sp<SkPDFObject> fID;
84 sk_sp<SkPDFObject> fXMP; 85 sk_sp<SkPDFObject> fXMP;
85 #endif
86 SkScalar fRasterDpi; 86 SkScalar fRasterDpi;
87 SkPDFMetadata fMetadata; 87 SkPDFMetadata fMetadata;
88 bool fPDFA;
88 }; 89 };
89 90
90 #endif // SkPDFDocument_DEFINED 91 #endif // SkPDFDocument_DEFINED
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | src/pdf/SkPDFDocument.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698