| 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 11 matching lines...) Expand all Loading... |
| 22 #include "SkSinglyLinkedList.h" | 22 #include "SkSinglyLinkedList.h" |
| 23 | 23 |
| 24 class SkImageBitmap; | 24 class SkImageBitmap; |
| 25 class SkPath; | 25 class SkPath; |
| 26 class SkPDFArray; | 26 class SkPDFArray; |
| 27 class SkPDFCanon; | 27 class SkPDFCanon; |
| 28 class SkPDFDevice; | 28 class SkPDFDevice; |
| 29 class SkPDFDocument; | 29 class SkPDFDocument; |
| 30 class SkPDFDict; | 30 class SkPDFDict; |
| 31 class SkPDFFont; | 31 class SkPDFFont; |
| 32 class SkPDFFormXObject; | |
| 33 class SkPDFObject; | 32 class SkPDFObject; |
| 33 class SkPDFStream; |
| 34 class SkRRect; | 34 class SkRRect; |
| 35 | 35 |
| 36 /** \class SkPDFDevice | 36 /** \class SkPDFDevice |
| 37 | 37 |
| 38 The drawing context for the PDF backend. | 38 The drawing context for the PDF backend. |
| 39 */ | 39 */ |
| 40 class SkPDFDevice final : public SkBaseDevice { | 40 class SkPDFDevice final : public SkBaseDevice { |
| 41 public: | 41 public: |
| 42 /** Create a PDF drawing context. SkPDFDevice applies a | 42 /** Create a PDF drawing context. SkPDFDevice applies a |
| 43 * scale-and-translate transform to move the origin from the | 43 * scale-and-translate transform to move the origin from the |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 261 |
| 262 SkPDFDevice(SkISize pageSize, | 262 SkPDFDevice(SkISize pageSize, |
| 263 SkScalar rasterDpi, | 263 SkScalar rasterDpi, |
| 264 SkPDFDocument* doc, | 264 SkPDFDocument* doc, |
| 265 bool flip); | 265 bool flip); |
| 266 | 266 |
| 267 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; | 267 SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override; |
| 268 | 268 |
| 269 void init(); | 269 void init(); |
| 270 void cleanUp(); | 270 void cleanUp(); |
| 271 SkPDFFormXObject* createFormXObjectFromDevice(); | 271 sk_sp<SkPDFObject> makeFormXObjectFromDevice(); |
| 272 | 272 |
| 273 void drawFormXObjectWithMask(int xObjectIndex, | 273 void drawFormXObjectWithMask(int xObjectIndex, |
| 274 SkPDFFormXObject* mask, | 274 SkPDFObject* mask, |
| 275 const SkClipStack* clipStack, | 275 const SkClipStack* clipStack, |
| 276 const SkRegion& clipRegion, | 276 const SkRegion& clipRegion, |
| 277 SkXfermode::Mode mode, | 277 SkXfermode::Mode mode, |
| 278 bool invertClip); | 278 bool invertClip); |
| 279 | 279 |
| 280 // If the paint or clip is such that we shouldn't draw anything, this | 280 // If the paint or clip is such that we shouldn't draw anything, this |
| 281 // returns nullptr and does not create a content entry. | 281 // returns nullptr and does not create a content entry. |
| 282 // setUpContentEntry and finishContentEntry can be used directly, but | 282 // setUpContentEntry and finishContentEntry can be used directly, but |
| 283 // the preferred method is to use the ScopedContentEntry helper class. | 283 // the preferred method is to use the ScopedContentEntry helper class. |
| 284 ContentEntry* setUpContentEntry(const SkClipStack* clipStack, | 284 ContentEntry* setUpContentEntry(const SkClipStack* clipStack, |
| 285 const SkRegion& clipRegion, | 285 const SkRegion& clipRegion, |
| 286 const SkMatrix& matrix, | 286 const SkMatrix& matrix, |
| 287 const SkPaint& paint, | 287 const SkPaint& paint, |
| 288 bool hasText, | 288 bool hasText, |
| 289 SkPDFFormXObject** dst); | 289 SkPDFObject** dst); |
| 290 void finishContentEntry(SkXfermode::Mode xfermode, | 290 void finishContentEntry(SkXfermode::Mode xfermode, |
| 291 SkPDFFormXObject* dst, | 291 SkPDFObject* dst, |
| 292 SkPath* shape); | 292 SkPath* shape); |
| 293 bool isContentEmpty(); | 293 bool isContentEmpty(); |
| 294 | 294 |
| 295 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix, | 295 void populateGraphicStateEntryFromPaint(const SkMatrix& matrix, |
| 296 const SkClipStack& clipStack, | 296 const SkClipStack& clipStack, |
| 297 const SkRegion& clipRegion, | 297 const SkRegion& clipRegion, |
| 298 const SkPaint& paint, | 298 const SkPaint& paint, |
| 299 bool hasText, | 299 bool hasText, |
| 300 GraphicStateEntry* entry); | 300 GraphicStateEntry* entry); |
| 301 int addGraphicStateResource(SkPDFObject* gs); | 301 int addGraphicStateResource(SkPDFObject* gs); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 320 | 320 |
| 321 typedef SkBaseDevice INHERITED; | 321 typedef SkBaseDevice INHERITED; |
| 322 | 322 |
| 323 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create | 323 // TODO(edisonn): Only SkDocument_PDF and SkPDFImageShader should be able to
create |
| 324 // an SkPDFDevice | 324 // an SkPDFDevice |
| 325 //friend class SkDocument_PDF; | 325 //friend class SkDocument_PDF; |
| 326 //friend class SkPDFImageShader; | 326 //friend class SkPDFImageShader; |
| 327 }; | 327 }; |
| 328 | 328 |
| 329 #endif | 329 #endif |
| OLD | NEW |