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

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

Issue 1802033003: SkPDF: SkPDFDocument reorganized so that some objects can be serialized early. (Closed) Base URL: https://skia.googlesource.com/skia.git@SkPdfDumpMethod
Patch Set: Created 4 years, 9 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 | « no previous file | src/pdf/SkPDFDocument.cpp » ('j') | src/pdf/SkPDFDocument.cpp » ('J')
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 "SkPDFMetadata.h"
11 12
tomhudson 2016/03/21 15:55:12 You also need to #include SkPDFTypes.h here to get
hal.canary 2016/03/21 18:49:18 Done.
12 sk_sp<SkDocument> SkPDFMakeDocument( 13 sk_sp<SkDocument> SkPDFMakeDocument(
13 SkWStream* stream, 14 SkWStream* stream,
14 void (*doneProc)(SkWStream*, bool), 15 void (*doneProc)(SkWStream*, bool),
15 SkScalar rasterDpi, 16 SkScalar rasterDpi,
16 SkPixelSerializer* jpegEncoder); 17 SkPixelSerializer* jpegEncoder);
17 18
19 // Logically part of SkPDFDocument (like SkPDFCanon), but
djsollen 2016/03/16 12:41:49 but what?
hal.canary 2016/03/21 18:49:18 Done.
20 struct SkPDFObjectSerializer : SkNoncopyable {
21 SkPDFObjNumMap fObjNumMap;
22 SkPDFSubstituteMap fSubstituteMap;
23 SkTDArray<int32_t> fOffsets;
24 sk_sp<SkPDFObject> fInfoDict;
25 size_t fBaseOffset;
26 int32_t fNextToBeSerialized; // index in fObjNumMap
27
28 SkPDFObjectSerializer();
29 void addObjectRecursively(const sk_sp<SkPDFObject>&);
30 void serializeHeader(SkWStream*, const SkPDFMetadata&);
31 void serializeObjects(SkWStream*);
32 void serializeFooter(SkWStream*, const sk_sp<SkPDFObject>, sk_sp<SkPDFObject >);
33 int32_t offset(SkWStream*);
34 };
35
36 class SkPDFDocument : public SkDocument {
tomhudson 2016/03/21 15:55:12 This is an implementation detail of SkDocument, bu
hal.canary 2016/03/21 19:40:08 /** Concrete implementation of SkDocument that cre
37 public:
38 SkPDFDocument(SkWStream*,
39 void (*)(SkWStream*, bool),
40 SkScalar,
41 SkPixelSerializer*);
42 virtual ~SkPDFDocument();
43 SkCanvas* onBeginPage(SkScalar, SkScalar, const SkRect&) override;
44 void onEndPage() override;
45 bool onClose(SkWStream*) override;
46 void onAbort() override;
47 void setMetadata(const SkDocument::Attribute[],
48 int,
49 const SkTime::DateTime*,
50 const SkTime::DateTime*) override;
51 void serialize(const sk_sp<SkPDFObject>&);
52 SkPDFCanon* canon() { return &fCanon; }
53
54 private:
55 SkPDFObjectSerializer fObjectSerializer;
56 SkPDFCanon fCanon;
57 SkTArray<sk_sp<const SkPDFDevice>> fPageDevices;
58 sk_sp<SkCanvas> fCanvas;
59 SkScalar fRasterDpi;
60 SkPDFMetadata fMetadata;
61 };
62
18 #endif // SkPDFDocument_DEFINED 63 #endif // SkPDFDocument_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFDocument.cpp » ('j') | src/pdf/SkPDFDocument.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698