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 #include "SkDocument.h" | 8 #include "SkDocument.h" |
9 #include "SkPDFCanon.h" | 9 #include "SkPDFCanon.h" |
10 #include "SkPDFDevice.h" | 10 #include "SkPDFDevice.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 fPageDevices.unrefAll(); | 363 fPageDevices.unrefAll(); |
364 fCanon.reset(); | 364 fCanon.reset(); |
365 return success; | 365 return success; |
366 } | 366 } |
367 | 367 |
368 void onAbort() override { | 368 void onAbort() override { |
369 fPageDevices.unrefAll(); | 369 fPageDevices.unrefAll(); |
370 fCanon.reset(); | 370 fCanon.reset(); |
371 } | 371 } |
372 | 372 |
373 void setMetadata(const SkTArray<SkDocument::Attribute>& info, | 373 void setMetadata(const SkDocument::Attribute info[], |
| 374 int infoCount, |
374 const SkTime::DateTime* creationDate, | 375 const SkTime::DateTime* creationDate, |
375 const SkTime::DateTime* modifiedDate) override { | 376 const SkTime::DateTime* modifiedDate) override { |
376 fMetadata.fInfo = info; | 377 fMetadata.fInfo.reset(info, infoCount); |
377 fMetadata.fCreation.reset(clone(creationDate)); | 378 fMetadata.fCreation.reset(clone(creationDate)); |
378 fMetadata.fModified.reset(clone(modifiedDate)); | 379 fMetadata.fModified.reset(clone(modifiedDate)); |
379 } | 380 } |
380 | 381 |
381 private: | 382 private: |
382 SkPDFCanon fCanon; | 383 SkPDFCanon fCanon; |
383 SkTDArray<const SkPDFDevice*> fPageDevices; | 384 SkTDArray<const SkPDFDevice*> fPageDevices; |
384 SkAutoTUnref<SkCanvas> fCanvas; | 385 SkAutoTUnref<SkCanvas> fCanvas; |
385 SkScalar fRasterDpi; | 386 SkScalar fRasterDpi; |
386 SkPDFMetadata fMetadata; | 387 SkPDFMetadata fMetadata; |
(...skipping 15 matching lines...) Expand all Loading... |
402 | 403 |
403 SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) { | 404 SkDocument* SkDocument::CreatePDF(const char path[], SkScalar dpi) { |
404 SkFILEWStream* stream = new SkFILEWStream(path); | 405 SkFILEWStream* stream = new SkFILEWStream(path); |
405 if (!stream->isValid()) { | 406 if (!stream->isValid()) { |
406 delete stream; | 407 delete stream; |
407 return nullptr; | 408 return nullptr; |
408 } | 409 } |
409 auto delete_wstream = [](SkWStream* stream, bool) { delete stream; }; | 410 auto delete_wstream = [](SkWStream* stream, bool) { delete stream; }; |
410 return new SkDocument_PDF(stream, delete_wstream, dpi, nullptr); | 411 return new SkDocument_PDF(stream, delete_wstream, dpi, nullptr); |
411 } | 412 } |
OLD | NEW |