blob: 7731d3f4ae3fe296ab7200592d6d81986ab764de [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 Google Inc.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000010#ifndef SkPDFDevice_DEFINED
11#define SkPDFDevice_DEFINED
12
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +000013#include "SkCanvas.h"
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000014#include "SkDevice.h"
vandebo@chromium.orga5180862010-10-26 19:48:49 +000015#include "SkPaint.h"
16#include "SkPath.h"
vandebo@chromium.org238be8c2012-07-13 20:06:02 +000017#include "SkRect.h"
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000018#include "SkRefCnt.h"
19#include "SkStream.h"
epoger@google.comb58772f2013-03-08 09:09:10 +000020#include "SkTDArray.h"
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000021#include "SkTScopedPtr.h"
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000022
23class SkPDFArray;
24class SkPDFDevice;
25class SkPDFDict;
vandebo@chromium.org28be72b2010-11-11 21:37:00 +000026class SkPDFFont;
vandebo@chromium.org6112c212011-05-13 03:50:38 +000027class SkPDFFormXObject;
vandebo@chromium.org98594282011-07-25 22:34:12 +000028class SkPDFGlyphSetMap;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000029class SkPDFGraphicState;
30class SkPDFObject;
vandebo@chromium.orgda912d62011-03-08 18:31:02 +000031class SkPDFShader;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000032class SkPDFStream;
edisonn@google.com6addb192013-04-02 15:33:08 +000033template <typename T> class SK_API SkTSet;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000034
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000035// Private classes.
36struct ContentEntry;
37struct GraphicStateEntry;
epoger@google.comb58772f2013-03-08 09:09:10 +000038struct NamedDestination;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +000039
edisonn@google.comd9dfa182013-04-24 13:01:01 +000040typedef bool (*EncodeToDCTStream)(SkWStream* stream, const SkBitmap& bitmap, const SkIRect& rect);
41
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000042/** \class SkPDFDevice
43
44 The drawing context for the PDF backend.
45*/
46class SkPDFDevice : public SkDevice {
47public:
48 /** Create a PDF drawing context with the given width and height.
49 * 72 points/in means letter paper is 612x792.
ctguil@chromium.org15261292011-04-29 17:54:16 +000050 * @param pageSize Page size in points.
51 * @param contentSize The content size of the page in points. This will be
52 * combined with the initial transform to determine the drawing area
53 * (as reported by the width and height methods). Anything outside
54 * of the drawing area will be clipped.
vandebo@chromium.org75f97e42011-04-11 23:24:18 +000055 * @param initialTransform The initial transform to apply to the page.
56 * This may be useful to, for example, move the origin in and
57 * over a bit to account for a margin, scale the canvas,
58 * or apply a rotation. Note1: the SkPDFDevice also applies
59 * a scale+translate transform to move the origin from the
60 * bottom left (PDF default) to the top left. Note2: drawDevice
61 * (used by layer restore) draws the device after this initial
reed@google.comcde92112011-07-06 20:00:52 +000062 * transform is applied, so the PDF device does an
vandebo@chromium.org75f97e42011-04-11 23:24:18 +000063 * inverse scale+translate to accommodate the one that SkPDFDevice
64 * always does.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000065 */
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +000066 // TODO(vandebo): The sizes should be SkSize and not SkISize.
ctguil@chromium.org15261292011-04-29 17:54:16 +000067 SK_API SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
68 const SkMatrix& initialTransform);
69 SK_API virtual ~SkPDFDevice();
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000070
reed@google.com982cb872011-12-07 18:34:08 +000071 virtual uint32_t getDeviceCapabilities() SK_OVERRIDE;
vandebo@chromium.org35fc62b2010-10-26 19:47:30 +000072
reed@google.com982cb872011-12-07 18:34:08 +000073 virtual void clear(SkColor color) SK_OVERRIDE;
vandebo@chromium.org77bcaa32011-04-15 20:57:37 +000074
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000075 /** These are called inside the per-device-layer loop for each draw call.
76 When these are called, we have already applied any saveLayer operations,
77 and are handling any looping from the paint, and any effects from the
78 DrawFilter.
79 */
reed@google.com982cb872011-12-07 18:34:08 +000080 virtual void drawPaint(const SkDraw&, const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000081 virtual void drawPoints(const SkDraw&, SkCanvas::PointMode mode,
82 size_t count, const SkPoint[],
reed@google.com982cb872011-12-07 18:34:08 +000083 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000084 virtual void drawRect(const SkDraw&, const SkRect& r, const SkPaint& paint);
vandebo@chromium.orgff390322011-05-17 18:58:44 +000085 virtual void drawPath(const SkDraw&, const SkPath& origpath,
vandebo@chromium.org02cc5aa2011-01-25 22:06:29 +000086 const SkPaint& paint, const SkMatrix* prePathMatrix,
reed@google.com982cb872011-12-07 18:34:08 +000087 bool pathIsMutable) SK_OVERRIDE;
edisonn@google.com2ae67e72013-02-12 01:06:38 +000088 virtual void drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap,
89 const SkRect* src, const SkRect& dst,
90 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000091 virtual void drawBitmap(const SkDraw&, const SkBitmap& bitmap,
reed@android.comf2b98d62010-12-20 18:26:13 +000092 const SkIRect* srcRectOrNull,
reed@google.com982cb872011-12-07 18:34:08 +000093 const SkMatrix& matrix, const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000094 virtual void drawSprite(const SkDraw&, const SkBitmap& bitmap, int x, int y,
reed@google.com982cb872011-12-07 18:34:08 +000095 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000096 virtual void drawText(const SkDraw&, const void* text, size_t len,
reed@google.com982cb872011-12-07 18:34:08 +000097 SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +000098 virtual void drawPosText(const SkDraw&, const void* text, size_t len,
99 const SkScalar pos[], SkScalar constY,
reed@google.com982cb872011-12-07 18:34:08 +0000100 int scalarsPerPos, const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000101 virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len,
102 const SkPath& path, const SkMatrix* matrix,
reed@google.com982cb872011-12-07 18:34:08 +0000103 const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000104 virtual void drawVertices(const SkDraw&, SkCanvas::VertexMode,
105 int vertexCount, const SkPoint verts[],
106 const SkPoint texs[], const SkColor colors[],
107 SkXfermode* xmode, const uint16_t indices[],
reed@google.com982cb872011-12-07 18:34:08 +0000108 int indexCount, const SkPaint& paint) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000109 virtual void drawDevice(const SkDraw&, SkDevice*, int x, int y,
reed@google.com982cb872011-12-07 18:34:08 +0000110 const SkPaint&) SK_OVERRIDE;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000111
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000112 virtual void onAttachToCanvas(SkCanvas* canvas) SK_OVERRIDE;
113 virtual void onDetachFromCanvas() SK_OVERRIDE;
114
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000115 enum DrawingArea {
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000116 kContent_DrawingArea, // Drawing area for the page content.
117 kMargin_DrawingArea, // Drawing area for the margin content.
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000118 };
119
120 /** Sets the drawing area for the device. Subsequent draw calls are directed
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +0000121 * to the specific drawing area (margin or content). The default drawing
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000122 * area is the content drawing area.
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000123 *
124 * Currently if margin content is drawn and then a complex (for PDF) xfer
125 * mode is used, like SrcIn, Clear, etc, the margin content will get
126 * clipped. A simple way to avoid the bug is to always draw the margin
127 * content last.
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000128 */
epoger@google.com17b78942011-08-26 14:40:38 +0000129 SK_API void setDrawingArea(DrawingArea drawingArea);
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000130
edisonn@google.comd9dfa182013-04-24 13:01:01 +0000131 /** Sets the DCTEncoder for images.
132 * @param encoder The encoder to encode a bitmap as JPEG (DCT).
133 * Result of encodings are cached, if the encoder changes the
134 * behaivor dynamically and an image is added to a second catalog,
135 * we will likely use the result of the first encoding call.
136 * By returning false from the encoder function, the encoder result
137 * is not used.
138 * Callers might not want to encode small images, as the time spent
139 * encoding and decoding might not be worth the space savings,
140 * if any at all.
141 */
142 void setDCTEncoder(EncodeToDCTStream encoder) {
143 fEncoder = encoder;
144 }
145
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000146 // PDF specific methods.
147
reed@google.com1feb3302011-07-20 18:43:19 +0000148 /** Returns the resource dictionary for this device.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000149 */
reed@google.com1feb3302011-07-20 18:43:19 +0000150 SK_API SkPDFDict* getResourceDict();
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000151
vandebo@chromium.orga5180862010-10-26 19:48:49 +0000152 /** Get the list of resources (PDF objects) used on this page.
edisonn@google.com6addb192013-04-02 15:33:08 +0000153 * This method will add to newResourceObjects any objects that this method
154 * depends on, but not already in knownResourceObjects. This might operate
155 * recursively so if this object depends on another object and that object
156 * depends on two more, all three objects will be added.
157 *
158 * @param knownResourceObjects The set of resources to be ignored.
159 * @param newResourceObjects The set to append dependant resources to.
vandebo@chromium.org188838c2012-03-09 22:16:58 +0000160 * @param recursive If recursive is true, get the resources of the
161 * device's resources recursively. (Useful for adding
162 * objects to the catalog.)
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000163 */
edisonn@google.com6addb192013-04-02 15:33:08 +0000164 SK_API void getResources(const SkTSet<SkPDFObject*>& knownResourceObjects,
165 SkTSet<SkPDFObject*>* newResourceObjects,
vandebo@chromium.org188838c2012-03-09 22:16:58 +0000166 bool recursive) const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000167
vandebo@chromium.orgf0ec2662011-05-29 05:55:42 +0000168 /** Get the fonts used on this device.
169 */
vandebo@chromium.org3509f052011-05-30 20:52:33 +0000170 SK_API const SkTDArray<SkPDFFont*>& getFontResources() const;
vandebo@chromium.orgf0ec2662011-05-29 05:55:42 +0000171
epoger@google.comb58772f2013-03-08 09:09:10 +0000172 /** Add our named destinations to the supplied dictionary.
173 * @param dict Dictionary to add destinations to.
174 * @param page The PDF object representing the page for this device.
175 */
176 void appendDestinations(SkPDFDict* dict, SkPDFObject* page);
177
reed@google.com2a006c12012-09-19 17:05:55 +0000178 /** Returns a copy of the media box for this device. The caller is required
179 * to unref() this when it is finished.
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000180 */
reed@google.com2a006c12012-09-19 17:05:55 +0000181 SK_API SkPDFArray* copyMediaBox() const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000182
reed@google.com2a006c12012-09-19 17:05:55 +0000183 /** Get the annotations from this page, or NULL if there are none.
vandebo@chromium.org238be8c2012-07-13 20:06:02 +0000184 */
reed@google.com2a006c12012-09-19 17:05:55 +0000185 SK_API SkPDFArray* getAnnotations() const { return fAnnotations; }
vandebo@chromium.org238be8c2012-07-13 20:06:02 +0000186
vandebo@chromium.orgc2a9b7f2011-02-24 23:22:30 +0000187 /** Returns a SkStream with the page contents. The caller is responsible
188 for a reference to the returned value.
reed@google.com5667afc2011-06-27 14:42:15 +0000189 DEPRECATED: use copyContentToData()
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000190 */
vandebo@chromium.org3509f052011-05-30 20:52:33 +0000191 SK_API SkStream* content() const;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000192
reed@google.com5667afc2011-06-27 14:42:15 +0000193 /** Returns a SkStream with the page contents. The caller is responsible
194 * for calling data->unref() when it is finished.
195 */
196 SK_API SkData* copyContentToData() const;
vandebo@chromium.org98594282011-07-25 22:34:12 +0000197
vandebo@chromium.org3509f052011-05-30 20:52:33 +0000198 SK_API const SkMatrix& initialTransform() const {
199 return fInitialTransform;
200 }
vandebo@chromium.org61d26782011-05-24 23:02:07 +0000201
vandebo@chromium.org98594282011-07-25 22:34:12 +0000202 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font
203 * that shows on this device.
204 */
205 const SkPDFGlyphSetMap& getFontGlyphUsage() const {
206 return *(fFontGlyphUsage.get());
207 }
vandebo@chromium.org74b46192012-01-28 01:45:11 +0000208
bsalomon@google.comc6980972011-11-02 19:57:21 +0000209protected:
reed@google.com982cb872011-12-07 18:34:08 +0000210 virtual bool onReadPixels(const SkBitmap& bitmap, int x, int y,
211 SkCanvas::Config8888) SK_OVERRIDE;
vandebo@chromium.org98594282011-07-25 22:34:12 +0000212
reed@google.comb55deeb2012-01-06 14:43:09 +0000213 virtual bool allowImageFilter(SkImageFilter*) SK_OVERRIDE;
214
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000215private:
ctguil@chromium.org769fa6a2011-08-20 00:36:18 +0000216 // TODO(vandebo): push most of SkPDFDevice's state into a core object in
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000217 // order to get the right access levels without using friend.
vandebo@chromium.org13d14a92011-05-24 23:12:41 +0000218 friend class ScopedContentEntry;
vandebo@chromium.orga0c7edb2011-05-09 07:58:08 +0000219
ctguil@chromium.org15261292011-04-29 17:54:16 +0000220 SkISize fPageSize;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000221 SkISize fContentSize;
vandebo@chromium.org75f97e42011-04-11 23:24:18 +0000222 SkMatrix fInitialTransform;
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000223 SkClipStack fExistingClipStack;
224 SkRegion fExistingClipRegion;
reed@google.com2a006c12012-09-19 17:05:55 +0000225 SkPDFArray* fAnnotations;
reed@google.comfc641d02012-09-20 17:52:20 +0000226 SkPDFDict* fResourceDict;
epoger@google.comb58772f2013-03-08 09:09:10 +0000227 SkTDArray<NamedDestination*> fNamedDestinations;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000228
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000229 SkTDArray<SkPDFGraphicState*> fGraphicStateResources;
230 SkTDArray<SkPDFObject*> fXObjectResources;
vandebo@chromium.org28be72b2010-11-11 21:37:00 +0000231 SkTDArray<SkPDFFont*> fFontResources;
vandebo@chromium.org421d6442011-07-20 17:39:01 +0000232 SkTDArray<SkPDFObject*> fShaderResources;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000233
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000234 SkTScopedPtr<ContentEntry> fContentEntries;
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000235 ContentEntry* fLastContentEntry;
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000236 SkTScopedPtr<ContentEntry> fMarginContentEntries;
237 ContentEntry* fLastMarginContentEntry;
238 DrawingArea fDrawingArea;
239
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000240 const SkClipStack* fClipStack;
241
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000242 // Accessor and setter functions based on the current DrawingArea.
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000243 SkTScopedPtr<ContentEntry>* getContentEntries();
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000244 ContentEntry* getLastContentEntry();
245 void setLastContentEntry(ContentEntry* contentEntry);
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000246
vandebo@chromium.org98594282011-07-25 22:34:12 +0000247 // Glyph ids used for each font on this device.
248 SkTScopedPtr<SkPDFGlyphSetMap> fFontGlyphUsage;
249
edisonn@google.comd9dfa182013-04-24 13:01:01 +0000250 EncodeToDCTStream fEncoder;
251
vandebo@chromium.orga0c7edb2011-05-09 07:58:08 +0000252 SkPDFDevice(const SkISize& layerSize, const SkClipStack& existingClipStack,
253 const SkRegion& existingClipRegion);
254
bsalomon@google.come97f0852011-06-17 13:10:25 +0000255 // override from SkDevice
vandebo@chromium.org98594282011-07-25 22:34:12 +0000256 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config config,
257 int width, int height,
bsalomon@google.come97f0852011-06-17 13:10:25 +0000258 bool isOpaque,
reed@google.com982cb872011-12-07 18:34:08 +0000259 Usage usage) SK_OVERRIDE;
bsalomon@google.come97f0852011-06-17 13:10:25 +0000260
vandebo@chromium.org77bcaa32011-04-15 20:57:37 +0000261 void init();
vandebo@chromium.org98594282011-07-25 22:34:12 +0000262 void cleanUp(bool clearFontUsage);
reed@google.comfc641d02012-09-20 17:52:20 +0000263 SkPDFFormXObject* createFormXObjectFromDevice();
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000264
vandebo@chromium.org466f3d62011-05-18 23:06:29 +0000265 // Clear the passed clip from all existing content entries.
266 void clearClipFromContent(const SkClipStack* clipStack,
267 const SkRegion& clipRegion);
vandebo@chromium.org481aef62011-05-24 16:39:05 +0000268 void drawFormXObjectWithClip(SkPDFFormXObject* form,
269 const SkClipStack* clipStack,
270 const SkRegion& clipRegion,
271 bool invertClip);
vandebo@chromium.org466f3d62011-05-18 23:06:29 +0000272
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000273 // If the paint or clip is such that we shouldn't draw anything, this
274 // returns NULL and does not create a content entry.
275 // setUpContentEntry and finishContentEntry can be used directly, but
vandebo@chromium.org13d14a92011-05-24 23:12:41 +0000276 // the preferred method is to use the ScopedContentEntry helper class.
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000277 ContentEntry* setUpContentEntry(const SkClipStack* clipStack,
278 const SkRegion& clipRegion,
279 const SkMatrix& matrix,
280 const SkPaint& paint,
281 bool hasText,
reed@google.comfc641d02012-09-20 17:52:20 +0000282 SkPDFFormXObject** dst);
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000283 void finishContentEntry(SkXfermode::Mode xfermode,
284 SkPDFFormXObject* dst);
vandebo@chromium.org481aef62011-05-24 16:39:05 +0000285 bool isContentEmpty();
286
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000287 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix,
288 const SkClipStack& clipStack,
289 const SkRegion& clipRegion,
290 const SkPaint& paint,
291 bool hasText,
292 GraphicStateEntry* entry);
vandebo@chromium.org6112c212011-05-13 03:50:38 +0000293 int addGraphicStateResource(SkPDFGraphicState* gs);
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000294
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000295 void updateFont(const SkPaint& paint, uint16_t glyphID,
296 ContentEntry* contentEntry);
ctguil@chromium.org9db86bb2011-03-04 21:43:27 +0000297 int getFontResourceIndex(SkTypeface* typeface, uint16_t glyphID);
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000298
vandebo@chromium.orgb069c8c2011-05-24 17:19:38 +0000299 void internalDrawPaint(const SkPaint& paint, ContentEntry* contentEntry);
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000300 void internalDrawBitmap(const SkMatrix& matrix,
vandebo@chromium.org78dad542011-05-11 18:46:03 +0000301 const SkClipStack* clipStack,
vandebo@chromium.org9fbdf872011-05-09 07:55:58 +0000302 const SkRegion& clipRegion,
303 const SkBitmap& bitmap,
304 const SkIRect* srcRect,
305 const SkPaint& paint);
306
ctguil@chromium.org8dcf74f2011-07-12 21:56:27 +0000307 /** Helper method for copyContentToData. It is responsible for copying the
308 * list of content entries |entry| to |data|.
309 */
310 void copyContentEntriesToData(ContentEntry* entry, SkWStream* data) const;
ctguil@chromium.org9510ccc2011-07-27 00:10:51 +0000311
epoger@google.comb58772f2013-03-08 09:09:10 +0000312 bool handleRectAnnotation(const SkRect& r, const SkMatrix& matrix,
313 const SkPaint& paint);
314 bool handlePointAnnotation(const SkPoint* points, size_t count,
315 const SkMatrix& matrix, const SkPaint& paint);
316 SkPDFDict* createLinkAnnotation(const SkRect& r, const SkMatrix& matrix);
317 void handleLinkToURL(SkData* urlData, const SkRect& r,
318 const SkMatrix& matrix);
319 void handleLinkToNamedDest(SkData* nameData, const SkRect& r,
320 const SkMatrix& matrix);
321 void defineNamedDestination(SkData* nameData, const SkPoint& point,
322 const SkMatrix& matrix);
vandebo@chromium.org238be8c2012-07-13 20:06:02 +0000323
robertphillips@google.com40a1ae42012-07-13 15:36:15 +0000324 typedef SkDevice INHERITED;
vandebo@chromium.org9b49dc02010-10-20 22:23:29 +0000325};
326
327#endif