blob: 095bbe96379a1d21adf9b34859c85795174dcdb4 [file] [log] [blame]
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00001/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00002 * Copyright 2011 Google Inc.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00003 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00004 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00006 */
7
8#ifndef SkPDFDevice_DEFINED
9#define SkPDFDevice_DEFINED
10
commit-bot@chromium.org5e009892013-10-14 13:42:12 +000011#include "SkBitmap.h"
halcanarya50151d2016-03-25 11:57:49 -070012#include "SkBitmapKey.h"
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +000013#include "SkCanvas.h"
bungemand3ebb482015-08-05 13:57:49 -070014#include "SkClipStack.h"
halcanary91fcb3e2016-03-04 13:53:22 -080015#include "SkData.h"
bungemand3ebb482015-08-05 13:57:49 -070016#include "SkDevice.h"
vandebo@chromium.orga5180862010-10-26 19:48:49 +000017#include "SkPaint.h"
18#include "SkPath.h"
commit-bot@chromium.org608ea652013-10-03 19:29:21 +000019#include "SkPicture.h"
vandebo@chromium.org238be8c2012-07-13 20:06:02 +000020#include "SkRect.h"
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000021#include "SkRefCnt.h"
22#include "SkStream.h"
epoger@google.comb58772f2013-03-08 09:09:10 +000023#include "SkTDArray.h"
commit-bot@chromium.orge0294402013-08-29 22:14:04 +000024#include "SkTemplates.h"
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000025
26class SkPDFArray;
halcanarya1f1ee92015-02-20 06:17:26 -080027class SkPDFCanon;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000028class SkPDFDevice;
halcanary989da4a2016-03-21 14:33:17 -070029class SkPDFDocument;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000030class SkPDFDict;
vandebo@chromium.org28be72b2010-11-11 21:37:00 +000031class SkPDFFont;
vandebo@chromium.org6112c212011-05-13 03:50:38 +000032class SkPDFFormXObject;
vandebo@chromium.org98594282011-07-25 22:34:12 +000033class SkPDFGlyphSetMap;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000034class SkPDFGraphicState;
35class SkPDFObject;
vandebo@chromium.orgda912d62011-03-08 18:31:02 +000036class SkPDFShader;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000037class SkPDFStream;
scroggo@google.coma8e33a92013-11-08 18:02:53 +000038class SkRRect;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000039
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000040// Private classes.
41struct ContentEntry;
42struct GraphicStateEntry;
43
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000044/** \class SkPDFDevice
45
46 The drawing context for the PDF backend.
47*/
halcanary70d15542015-11-22 12:55:04 -080048class SkPDFDevice final : public SkBaseDevice {
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000049public:
halcanarya1f1ee92015-02-20 06:17:26 -080050 /** Create a PDF drawing context. SkPDFDevice applies a
51 * scale-and-translate transform to move the origin from the
52 * bottom left (PDF default) to the top left (Skia default).
53 * @param pageSize Page size in point units.
54 * 1 point == 127/360 mm == 1/72 inch
55 * @param rasterDpi the DPI at which features without native PDF
56 * support will be rasterized (e.g. draw image with
57 * perspective, draw text with perspective, ...). A
58 * larger DPI would create a PDF that reflects the
59 * original intent with better fidelity, but it can make
60 * for larger PDF files too, which would use more memory
61 * while rendering, and it would be slower to be processed
62 * or sent online or to printer. A good choice is
63 * SK_ScalarDefaultRasterDPI(72.0f).
halcanary989da4a2016-03-21 14:33:17 -070064 * @param SkPDFDocument. A non-null pointer back to the
65 * document. The document is repsonsible for
66 * de-duplicating across pages (via the SkPDFCanon) and
67 * for early serializing of large immutable objects, such
68 * as images (via SkPDFDocument::serialize()).
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000069 */
halcanarya1f1ee92015-02-20 06:17:26 -080070 static SkPDFDevice* Create(SkISize pageSize,
71 SkScalar rasterDpi,
halcanary989da4a2016-03-21 14:33:17 -070072 SkPDFDocument* doc) {
73 return new SkPDFDevice(pageSize, rasterDpi, doc, true);
halcanarya1f1ee92015-02-20 06:17:26 -080074 }
75
76 /** Create a PDF drawing context without fipping the y-axis. */
77 static SkPDFDevice* CreateUnflipped(SkISize pageSize,
78 SkScalar rasterDpi,
halcanary989da4a2016-03-21 14:33:17 -070079 SkPDFDocument* doc) {
80 return new SkPDFDevice(pageSize, rasterDpi, doc, false);
halcanarya1f1ee92015-02-20 06:17:26 -080081 }
82
83 virtual ~SkPDFDevice();
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000084
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000085 /** These are called inside the per-device-layer loop for each draw call.
86 When these are called, we have already applied any saveLayer operations,
87 and are handling any looping from the paint, and any effects from the
88 DrawFilter.
89 */
mtklein36352bf2015-03-25 18:17:31 -070090 void drawPaint(const SkDraw&, const SkPaint& paint) override;
tfarinafa4f6cb2014-12-21 10:27:07 -080091 void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
92 size_t count, const SkPoint[],
mtklein36352bf2015-03-25 18:17:31 -070093 const SkPaint& paint) override;
94 void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint) override;
95 void drawOval(const SkDraw&, const SkRect& oval, const SkPaint& paint) override;
96 void drawRRect(const SkDraw&, const SkRRect& rr, const SkPaint& paint) override;
tfarinafa4f6cb2014-12-21 10:27:07 -080097 void drawPath(const SkDraw&, const SkPath& origpath,
98 const SkPaint& paint, const SkMatrix* prePathMatrix,
mtklein36352bf2015-03-25 18:17:31 -070099 bool pathIsMutable) override;
reed562fe472015-07-28 07:35:14 -0700100 void drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, const SkRect* src,
101 const SkRect& dst, const SkPaint&, SkCanvas::SrcRectConstraint) override;
tfarinafa4f6cb2014-12-21 10:27:07 -0800102 void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
mtklein36352bf2015-03-25 18:17:31 -0700103 const SkMatrix& matrix, const SkPaint&) override;
tfarinafa4f6cb2014-12-21 10:27:07 -0800104 void drawSprite(const SkDraw&, const SkBitmap& bitmap, int x, int y,
mtklein36352bf2015-03-25 18:17:31 -0700105 const SkPaint& paint) override;
halcanary7a14b312015-10-01 07:28:13 -0700106 void drawImage(const SkDraw&,
107 const SkImage*,
108 SkScalar x,
109 SkScalar y,
110 const SkPaint&) override;
111 void drawImageRect(const SkDraw&,
112 const SkImage*,
113 const SkRect* src,
114 const SkRect& dst,
115 const SkPaint&,
116 SkCanvas::SrcRectConstraint) override;
tfarinafa4f6cb2014-12-21 10:27:07 -0800117 void drawText(const SkDraw&, const void* text, size_t len,
mtklein36352bf2015-03-25 18:17:31 -0700118 SkScalar x, SkScalar y, const SkPaint&) override;
tfarinafa4f6cb2014-12-21 10:27:07 -0800119 void drawPosText(const SkDraw&, const void* text, size_t len,
120 const SkScalar pos[], int scalarsPerPos,
mtklein36352bf2015-03-25 18:17:31 -0700121 const SkPoint& offset, const SkPaint&) override;
tfarinafa4f6cb2014-12-21 10:27:07 -0800122 void drawVertices(const SkDraw&, SkCanvas::VertexMode,
123 int vertexCount, const SkPoint verts[],
124 const SkPoint texs[], const SkColor colors[],
125 SkXfermode* xmode, const uint16_t indices[],
mtklein36352bf2015-03-25 18:17:31 -0700126 int indexCount, const SkPaint& paint) override;
tfarinafa4f6cb2014-12-21 10:27:07 -0800127 void drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
mtklein36352bf2015-03-25 18:17:31 -0700128 const SkPaint&) override;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000129
mtklein36352bf2015-03-25 18:17:31 -0700130 void onAttachToCanvas(SkCanvas* canvas) override;
131 void onDetachFromCanvas() override;
132 SkImageInfo imageInfo() const override;
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000133
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000134 enum DrawingArea {
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000135 kContent_DrawingArea, // Drawing area for the page content.
136 kMargin_DrawingArea, // Drawing area for the margin content.
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000137 };
138
139 /** Sets the drawing area for the device. Subsequent draw calls are directed
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +0000140 * to the specific drawing area (margin or content). The default drawing
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000141 * area is the content drawing area.
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000142 *
143 * Currently if margin content is drawn and then a complex (for PDF) xfer
144 * mode is used, like SrcIn, Clear, etc, the margin content will get
145 * clipped. A simple way to avoid the bug is to always draw the margin
146 * content last.
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000147 */
halcanary4e4e8162015-02-25 08:59:48 -0800148 void setDrawingArea(DrawingArea drawingArea);
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000149
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000150 // PDF specific methods.
151
halcanary8103a342016-03-08 15:10:16 -0800152 /** Create the resource dictionary for this device. */
153 sk_sp<SkPDFDict> makeResourceDict() const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000154
vandebo@chromium.orgf0ec2662011-05-29 05:55:42 +0000155 /** Get the fonts used on this device.
156 */
halcanary4e4e8162015-02-25 08:59:48 -0800157 const SkTDArray<SkPDFFont*>& getFontResources() const;
vandebo@chromium.orgf0ec2662011-05-29 05:55:42 +0000158
wangxianzhuef6c50a2015-09-17 20:38:02 -0700159 /** Add our annotations (link to urls and destinations) to the supplied
160 * array.
161 * @param array Array to add annotations to.
162 */
163 void appendAnnotations(SkPDFArray* array) const;
164
epoger@google.comb58772f2013-03-08 09:09:10 +0000165 /** Add our named destinations to the supplied dictionary.
166 * @param dict Dictionary to add destinations to.
167 * @param page The PDF object representing the page for this device.
168 */
halcanary6d622702015-03-25 08:45:42 -0700169 void appendDestinations(SkPDFDict* dict, SkPDFObject* page) const;
epoger@google.comb58772f2013-03-08 09:09:10 +0000170
halcanary8103a342016-03-08 15:10:16 -0800171 /** Returns a copy of the media box for this device. */
172 sk_sp<SkPDFArray> copyMediaBox() const;
halcanary51d04d32016-03-08 13:03:55 -0800173
halcanary8103a342016-03-08 15:10:16 -0800174 /** Returns a SkStream with the page contents.
halcanary51d04d32016-03-08 13:03:55 -0800175 */
mtklein5f939ab2016-03-16 10:28:35 -0700176 std::unique_ptr<SkStreamAsset> content() const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000177
halcanary334fcbc2015-02-24 12:56:16 -0800178 /** Writes the page contents to the stream. */
halcanary4e4e8162015-02-25 08:59:48 -0800179 void writeContent(SkWStream*) const;
vandebo@chromium.org98594282011-07-25 22:34:12 +0000180
halcanary4e4e8162015-02-25 08:59:48 -0800181 const SkMatrix& initialTransform() const {
vandebo@chromium.org3509f052011-05-30 20:52:33 +0000182 return fInitialTransform;
183 }
vandebo@chromium.org61d26782011-05-24 23:02:07 +0000184
vandebo@chromium.org98594282011-07-25 22:34:12 +0000185 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font
186 * that shows on this device.
187 */
188 const SkPDFGlyphSetMap& getFontGlyphUsage() const {
189 return *(fFontGlyphUsage.get());
190 }
vandebo@chromium.org74b46192012-01-28 01:45:11 +0000191
halcanary989da4a2016-03-21 14:33:17 -0700192 SkPDFCanon* getCanon() const;
halcanary26b5d152015-03-25 08:38:03 -0700193
edisonn@google.com73a7ea32013-11-11 20:55:15 +0000194protected:
mtklein36352bf2015-03-25 18:17:31 -0700195 const SkBitmap& onAccessBitmap() override {
reed89443ab2014-06-27 11:34:19 -0700196 return fLegacyBitmap;
197 }
198
reede8f30622016-03-23 18:59:25 -0700199 sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) override;
edisonn@google.com73a7ea32013-11-11 20:55:15 +0000200
reedf70b5312016-03-04 16:36:20 -0800201 void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData* value) override;
202
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000203private:
halcanary91fcb3e2016-03-04 13:53:22 -0800204 struct RectWithData {
205 SkRect rect;
halcanaryd7b28852016-03-07 12:39:14 -0800206 sk_sp<SkData> data;
halcanary91fcb3e2016-03-04 13:53:22 -0800207 RectWithData(const SkRect& rect, SkData* data)
208 : rect(rect), data(SkRef(data)) {}
halcanaryd7b28852016-03-07 12:39:14 -0800209 RectWithData(RectWithData&& other)
210 : rect(other.rect), data(std::move(other.data)) {}
211 RectWithData& operator=(RectWithData&& other) {
212 rect = other.rect;
213 data = std::move(other.data);
214 return *this;
215 }
halcanary91fcb3e2016-03-04 13:53:22 -0800216 };
217
218 struct NamedDestination {
halcanaryd7b28852016-03-07 12:39:14 -0800219 sk_sp<SkData> nameData;
halcanary91fcb3e2016-03-04 13:53:22 -0800220 SkPoint point;
221 NamedDestination(SkData* nameData, const SkPoint& point)
222 : nameData(SkRef(nameData)), point(point) {}
halcanaryd7b28852016-03-07 12:39:14 -0800223 NamedDestination(NamedDestination&& other)
224 : nameData(std::move(other.nameData)), point(other.point) {}
225 NamedDestination& operator=(NamedDestination&& other) {
226 nameData = std::move(other.nameData);
227 point = other.point;
228 return *this;
229 }
halcanary91fcb3e2016-03-04 13:53:22 -0800230 };
231
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +0000232 // TODO(vandebo): push most of SkPDFDevice's state into a core object in
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000233 // order to get the right access levels without using friend.
vandebo@chromium.org13d14a92011-05-24 23:12:41 +0000234 friend class ScopedContentEntry;
vandebo@chromium.orga0c7edb2011-05-09 07:58:08 +0000235
ctguil@chromium.org15261292011-04-29 17:54:16 +0000236 SkISize fPageSize;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000237 SkISize fContentSize;
vandebo@chromium.org75f97e42011-04-11 23:24:18 +0000238 SkMatrix fInitialTransform;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000239 SkClipStack fExistingClipStack;
240 SkRegion fExistingClipRegion;
wangxianzhuef6c50a2015-09-17 20:38:02 -0700241
halcanary91fcb3e2016-03-04 13:53:22 -0800242 SkTArray<RectWithData> fLinkToURLs;
243 SkTArray<RectWithData> fLinkToDestinations;
244 SkTArray<NamedDestination> fNamedDestinations;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000245
halcanarybe27a112015-04-01 13:31:19 -0700246 SkTDArray<SkPDFObject*> fGraphicStateResources;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000247 SkTDArray<SkPDFObject*> fXObjectResources;
vandebo@chromium.org28be72b2010-11-11 21:37:00 +0000248 SkTDArray<SkPDFFont*> fFontResources;
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000249 SkTDArray<SkPDFObject*> fShaderResources;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000250
commit-bot@chromium.orge0294402013-08-29 22:14:04 +0000251 SkAutoTDelete<ContentEntry> fContentEntries;
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000252 ContentEntry* fLastContentEntry;
commit-bot@chromium.orge0294402013-08-29 22:14:04 +0000253 SkAutoTDelete<ContentEntry> fMarginContentEntries;
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000254 ContentEntry* fLastMarginContentEntry;
255 DrawingArea fDrawingArea;
256
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000257 const SkClipStack* fClipStack;
258
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000259 // Accessor and setter functions based on the current DrawingArea.
commit-bot@chromium.orge0294402013-08-29 22:14:04 +0000260 SkAutoTDelete<ContentEntry>* getContentEntries();
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000261
vandebo@chromium.org98594282011-07-25 22:34:12 +0000262 // Glyph ids used for each font on this device.
commit-bot@chromium.orge0294402013-08-29 22:14:04 +0000263 SkAutoTDelete<SkPDFGlyphSetMap> fFontGlyphUsage;
vandebo@chromium.org98594282011-07-25 22:34:12 +0000264
commit-bot@chromium.org8c294902013-10-21 17:14:37 +0000265 SkScalar fRasterDpi;
edisonn@google.comd9dfa182013-04-24 13:01:01 +0000266
reed89443ab2014-06-27 11:34:19 -0700267 SkBitmap fLegacyBitmap;
268
halcanary989da4a2016-03-21 14:33:17 -0700269 SkPDFDocument* fDocument;
halcanarya1f1ee92015-02-20 06:17:26 -0800270 ////////////////////////////////////////////////////////////////////////////
271
272 SkPDFDevice(SkISize pageSize,
273 SkScalar rasterDpi,
halcanary989da4a2016-03-21 14:33:17 -0700274 SkPDFDocument* doc,
halcanarya1f1ee92015-02-20 06:17:26 -0800275 bool flip);
276
277 ContentEntry* getLastContentEntry();
278 void setLastContentEntry(ContentEntry* contentEntry);
vandebo@chromium.orga0c7edb2011-05-09 07:58:08 +0000279
mtklein36352bf2015-03-25 18:17:31 -0700280 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
bsalomon@google.come97f0852011-06-17 13:10:25 +0000281
vandebo@chromium.org77bcaa32011-04-15 20:57:37 +0000282 void init();
vandebo@chromium.org98594282011-07-25 22:34:12 +0000283 void cleanUp(bool clearFontUsage);
reed@google.comfc641d02012-09-20 17:52:20 +0000284 SkPDFFormXObject* createFormXObjectFromDevice();
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000285
vandebo@chromium.org3b416212013-10-30 20:48:05 +0000286 void drawFormXObjectWithMask(int xObjectIndex,
287 SkPDFFormXObject* mask,
vandebo@chromium.org481aef62011-05-24 16:39:05 +0000288 const SkClipStack* clipStack,
289 const SkRegion& clipRegion,
vandebo@chromium.org3b416212013-10-30 20:48:05 +0000290 SkXfermode::Mode mode,
vandebo@chromium.org481aef62011-05-24 16:39:05 +0000291 bool invertClip);
vandebo@chromium.org466f3d62011-05-18 23:06:29 +0000292
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000293 // If the paint or clip is such that we shouldn't draw anything, this
halcanary96fcdcc2015-08-27 07:41:13 -0700294 // returns nullptr and does not create a content entry.
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000295 // setUpContentEntry and finishContentEntry can be used directly, but
vandebo@chromium.org13d14a92011-05-24 23:12:41 +0000296 // the preferred method is to use the ScopedContentEntry helper class.
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000297 ContentEntry* setUpContentEntry(const SkClipStack* clipStack,
298 const SkRegion& clipRegion,
299 const SkMatrix& matrix,
300 const SkPaint& paint,
301 bool hasText,
reed@google.comfc641d02012-09-20 17:52:20 +0000302 SkPDFFormXObject** dst);
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000303 void finishContentEntry(SkXfermode::Mode xfermode,
vandebo@chromium.org3b416212013-10-30 20:48:05 +0000304 SkPDFFormXObject* dst,
305 SkPath* shape);
vandebo@chromium.org481aef62011-05-24 16:39:05 +0000306 bool isContentEmpty();
307
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000308 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix,
309 const SkClipStack& clipStack,
310 const SkRegion& clipRegion,
311 const SkPaint& paint,
312 bool hasText,
313 GraphicStateEntry* entry);
halcanarybe27a112015-04-01 13:31:19 -0700314 int addGraphicStateResource(SkPDFObject* gs);
vandebo@chromium.org3b416212013-10-30 20:48:05 +0000315 int addXObjectResource(SkPDFObject* xObject);
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000316
robertphillips8e0c1502015-07-07 10:28:43 -0700317 void updateFont(const SkPaint& paint, uint16_t glyphID, ContentEntry* contentEntry);
ctguil@chromium.org9db86bb2011-03-04 21:43:27 +0000318 int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID);
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000319
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000320 void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry);
halcanarya50151d2016-03-25 11:57:49 -0700321
322 void internalDrawImage(const SkMatrix& origMatrix,
halcanary7a14b312015-10-01 07:28:13 -0700323 const SkClipStack* clipStack,
halcanarya50151d2016-03-25 11:57:49 -0700324 const SkRegion& origClipRegion,
325 SkImageBitmap imageBitmap,
halcanary7a14b312015-10-01 07:28:13 -0700326 const SkPaint& paint);
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000327
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000328 /** Helper method for copyContentToData. It is responsible for copying the
329 * list of content entries |entry| to |data|.
330 */
331 void copyContentEntriesToData(ContentEntry* entry, SkWStream* data) const;
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000332
commit-bot@chromium.org92ffe7d2013-07-31 22:54:31 +0000333 bool handleInversePath(const SkDraw& d, const SkPath& origPath,
edisonn@google.coma9ebd162013-10-07 13:22:21 +0000334 const SkPaint& paint, bool pathIsMutable,
halcanary96fcdcc2015-08-27 07:41:13 -0700335 const SkMatrix* prePathMatrix = nullptr);
reedf70b5312016-03-04 16:36:20 -0800336 void handlePointAnnotation(const SkPoint&, const SkMatrix&, const char key[], SkData* value);
337 void handlePathAnnotation(const SkPath&, const SkDraw& d, const char key[], SkData* value);
vandebo@chromium.org238be8c2012-07-13 20:06:02 +0000338
reed89443ab2014-06-27 11:34:19 -0700339 typedef SkBaseDevice INHERITED;
commit-bot@chromium.org5e009892013-10-14 13:42:12 +0000340
341 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to create
342 // an SkPDFDevice
343 //friend class SkDocument_PDF;
344 //friend class SkPDFImageShader;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000345};
346
347#endif