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 "SkPDFCanon.h" | 8 #include "SkPDFCanon.h" |
9 #include "SkPDFCanvas.h" | 9 #include "SkPDFCanvas.h" |
10 #include "SkPDFDevice.h" | 10 #include "SkPDFDevice.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 SkASSERT(!fPages.empty()); | 476 SkASSERT(!fPages.empty()); |
477 docCatalog->insertObjRef("Pages", generate_page_tree(&fPages)); | 477 docCatalog->insertObjRef("Pages", generate_page_tree(&fPages)); |
478 SkASSERT(fPages.empty()); | 478 SkASSERT(fPages.empty()); |
479 | 479 |
480 if (fDests->size() > 0) { | 480 if (fDests->size() > 0) { |
481 docCatalog->insertObjRef("Dests", std::move(fDests)); | 481 docCatalog->insertObjRef("Dests", std::move(fDests)); |
482 } | 482 } |
483 | 483 |
484 // Build font subsetting info before calling addObjectRecursively(). | 484 // Build font subsetting info before calling addObjectRecursively(). |
485 for (const auto& entry : fGlyphUsage) { | 485 for (const auto& entry : fGlyphUsage) { |
486 sk_sp<SkPDFObject> subsetFont = | 486 sk_sp<SkPDFFont> subsetFont( |
487 entry.fFont->getFontSubset(&entry.fGlyphSet); | 487 entry.fFont->getFontSubset(&entry.fGlyphSet)); |
488 if (subsetFont) { | 488 if (subsetFont) { |
489 fObjectSerializer.fSubstituteMap.setSubstitute( | 489 fObjectSerializer.fSubstituteMap.setSubstitute( |
490 entry.fFont, subsetFont.get()); | 490 entry.fFont, subsetFont.get()); |
491 } | 491 } |
492 } | 492 } |
493 | 493 |
494 fObjectSerializer.addObjectRecursively(docCatalog); | 494 fObjectSerializer.addObjectRecursively(docCatalog); |
495 fObjectSerializer.serializeObjects(this->getStream()); | 495 fObjectSerializer.serializeObjects(this->getStream()); |
496 fObjectSerializer.serializeFooter(this->getStream(), docCatalog, fID); | 496 fObjectSerializer.serializeFooter(this->getStream(), docCatalog, fID); |
497 fCanon.reset(); | 497 fCanon.reset(); |
(...skipping 26 matching lines...) Expand all Loading... |
524 } | 524 } |
525 | 525 |
526 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, | 526 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, |
527 SkScalar dpi, | 527 SkScalar dpi, |
528 const SkDocument::PDFMetadata& metadata, | 528 const SkDocument::PDFMetadata& metadata, |
529 sk_sp<SkPixelSerializer> jpegEncoder, | 529 sk_sp<SkPixelSerializer> jpegEncoder, |
530 bool pdfa) { | 530 bool pdfa) { |
531 return SkPDFMakeDocument(stream, nullptr, dpi, metadata, | 531 return SkPDFMakeDocument(stream, nullptr, dpi, metadata, |
532 std::move(jpegEncoder), pdfa); | 532 std::move(jpegEncoder), pdfa); |
533 } | 533 } |
OLD | NEW |