OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 7 |
8 #ifndef SkPDFDevice_DEFINED | 8 #ifndef SkPDFDevice_DEFINED |
9 #define SkPDFDevice_DEFINED | 9 #define SkPDFDevice_DEFINED |
10 | 10 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 * | 137 * |
138 * Currently if margin content is drawn and then a complex (for PDF) xfer | 138 * Currently if margin content is drawn and then a complex (for PDF) xfer |
139 * mode is used, like SrcIn, Clear, etc, the margin content will get | 139 * mode is used, like SrcIn, Clear, etc, the margin content will get |
140 * clipped. A simple way to avoid the bug is to always draw the margin | 140 * clipped. A simple way to avoid the bug is to always draw the margin |
141 * content last. | 141 * content last. |
142 */ | 142 */ |
143 void setDrawingArea(DrawingArea drawingArea); | 143 void setDrawingArea(DrawingArea drawingArea); |
144 | 144 |
145 // PDF specific methods. | 145 // PDF specific methods. |
146 | 146 |
147 /** Create the resource dictionary for this device. */ | 147 /** Create the resource dictionary for this device. |
148 sk_sp<SkPDFDict> makeResourceDict() const; | 148 */ |
| 149 SkPDFDict* createResourceDict() const; |
149 | 150 |
150 /** Get the fonts used on this device. | 151 /** Get the fonts used on this device. |
151 */ | 152 */ |
152 const SkTDArray<SkPDFFont*>& getFontResources() const; | 153 const SkTDArray<SkPDFFont*>& getFontResources() const; |
153 | 154 |
154 /** Add our annotations (link to urls and destinations) to the supplied | 155 /** Add our annotations (link to urls and destinations) to the supplied |
155 * array. | 156 * array. |
156 * @param array Array to add annotations to. | 157 * @param array Array to add annotations to. |
157 */ | 158 */ |
158 void appendAnnotations(SkPDFArray* array) const; | 159 void appendAnnotations(SkPDFArray* array) const; |
159 | 160 |
160 /** Add our named destinations to the supplied dictionary. | 161 /** Add our named destinations to the supplied dictionary. |
161 * @param dict Dictionary to add destinations to. | 162 * @param dict Dictionary to add destinations to. |
162 * @param page The PDF object representing the page for this device. | 163 * @param page The PDF object representing the page for this device. |
163 */ | 164 */ |
164 void appendDestinations(SkPDFDict* dict, SkPDFObject* page) const; | 165 void appendDestinations(SkPDFDict* dict, SkPDFObject* page) const; |
165 | 166 |
166 /** Returns a copy of the media box for this device. */ | 167 /** Returns a copy of the media box for this device. The caller is required |
167 sk_sp<SkPDFArray> copyMediaBox() const; | 168 * to unref() this when it is finished. |
| 169 */ |
| 170 SkPDFArray* copyMediaBox() const; |
168 | 171 |
169 /** Returns a SkStream with the page contents. | 172 /** Returns a SkStream with the page contents. The caller is responsible |
| 173 * for a deleting the returned value. |
170 */ | 174 */ |
171 skstd::unique_ptr<SkStreamAsset> content() const; | 175 SkStreamAsset* content() const; |
172 | 176 |
173 /** Writes the page contents to the stream. */ | 177 /** Writes the page contents to the stream. */ |
174 void writeContent(SkWStream*) const; | 178 void writeContent(SkWStream*) const; |
175 | 179 |
176 const SkMatrix& initialTransform() const { | 180 const SkMatrix& initialTransform() const { |
177 return fInitialTransform; | 181 return fInitialTransform; |
178 } | 182 } |
179 | 183 |
180 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font | 184 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font |
181 * that shows on this device. | 185 * that shows on this device. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 337 |
334 typedef SkBaseDevice INHERITED; | 338 typedef SkBaseDevice INHERITED; |
335 | 339 |
336 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create | 340 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
337 // an SkPDFDevice | 341 // an SkPDFDevice |
338 //friend class SkDocument_PDF; | 342 //friend class SkDocument_PDF; |
339 //friend class SkPDFImageShader; | 343 //friend class SkPDFImageShader; |
340 }; | 344 }; |
341 | 345 |
342 #endif | 346 #endif |
OLD | NEW |