| 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 */ | 148 sk_sp<SkPDFDict> makeResourceDict() const; |
| 149 SkPDFDict* createResourceDict() const; | |
| 150 | 149 |
| 151 /** Get the fonts used on this device. | 150 /** Get the fonts used on this device. |
| 152 */ | 151 */ |
| 153 const SkTDArray<SkPDFFont*>& getFontResources() const; | 152 const SkTDArray<SkPDFFont*>& getFontResources() const; |
| 154 | 153 |
| 155 /** Add our annotations (link to urls and destinations) to the supplied | 154 /** Add our annotations (link to urls and destinations) to the supplied |
| 156 * array. | 155 * array. |
| 157 * @param array Array to add annotations to. | 156 * @param array Array to add annotations to. |
| 158 */ | 157 */ |
| 159 void appendAnnotations(SkPDFArray* array) const; | 158 void appendAnnotations(SkPDFArray* array) const; |
| 160 | 159 |
| 161 /** Add our named destinations to the supplied dictionary. | 160 /** Add our named destinations to the supplied dictionary. |
| 162 * @param dict Dictionary to add destinations to. | 161 * @param dict Dictionary to add destinations to. |
| 163 * @param page The PDF object representing the page for this device. | 162 * @param page The PDF object representing the page for this device. |
| 164 */ | 163 */ |
| 165 void appendDestinations(SkPDFDict* dict, SkPDFObject* page) const; | 164 void appendDestinations(SkPDFDict* dict, SkPDFObject* page) const; |
| 166 | 165 |
| 167 /** Returns a copy of the media box for this device. The caller is required | 166 /** Returns a copy of the media box for this device. */ |
| 168 * to unref() this when it is finished. | 167 sk_sp<SkPDFArray> copyMediaBox() const; |
| 168 |
| 169 /** Returns a SkStream with the page contents. |
| 169 */ | 170 */ |
| 170 SkPDFArray* copyMediaBox() const; | 171 skstd::unique_ptr<SkStreamAsset> content() const; |
| 171 | |
| 172 /** Returns a SkStream with the page contents. The caller is responsible | |
| 173 * for a deleting the returned value. | |
| 174 */ | |
| 175 SkStreamAsset* content() const; | |
| 176 | 172 |
| 177 /** Writes the page contents to the stream. */ | 173 /** Writes the page contents to the stream. */ |
| 178 void writeContent(SkWStream*) const; | 174 void writeContent(SkWStream*) const; |
| 179 | 175 |
| 180 const SkMatrix& initialTransform() const { | 176 const SkMatrix& initialTransform() const { |
| 181 return fInitialTransform; | 177 return fInitialTransform; |
| 182 } | 178 } |
| 183 | 179 |
| 184 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font | 180 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font |
| 185 * that shows on this device. | 181 * that shows on this device. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 333 |
| 338 typedef SkBaseDevice INHERITED; | 334 typedef SkBaseDevice INHERITED; |
| 339 | 335 |
| 340 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create | 336 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
| 341 // an SkPDFDevice | 337 // an SkPDFDevice |
| 342 //friend class SkDocument_PDF; | 338 //friend class SkDocument_PDF; |
| 343 //friend class SkPDFImageShader; | 339 //friend class SkPDFImageShader; |
| 344 }; | 340 }; |
| 345 | 341 |
| 346 #endif | 342 #endif |
| OLD | NEW |