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 "SkPDFDevice.h" | 8 #include "SkPDFDevice.h" |
9 | 9 |
10 #include "SkAnnotationKeys.h" | 10 #include "SkAnnotationKeys.h" |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1526 sk_sp<SkPDFArray> SkPDFDevice::copyMediaBox() const { | 1526 sk_sp<SkPDFArray> SkPDFDevice::copyMediaBox() const { |
1527 auto mediaBox = sk_make_sp<SkPDFArray>(); | 1527 auto mediaBox = sk_make_sp<SkPDFArray>(); |
1528 mediaBox->reserve(4); | 1528 mediaBox->reserve(4); |
1529 mediaBox->appendInt(0); | 1529 mediaBox->appendInt(0); |
1530 mediaBox->appendInt(0); | 1530 mediaBox->appendInt(0); |
1531 mediaBox->appendInt(fPageSize.width()); | 1531 mediaBox->appendInt(fPageSize.width()); |
1532 mediaBox->appendInt(fPageSize.height()); | 1532 mediaBox->appendInt(fPageSize.height()); |
1533 return mediaBox; | 1533 return mediaBox; |
1534 } | 1534 } |
1535 | 1535 |
1536 skstd::unique_ptr<SkStreamAsset> SkPDFDevice::content() const { | 1536 std::unique_ptr<SkStreamAsset> SkPDFDevice::content() const { |
1537 SkDynamicMemoryWStream buffer; | 1537 SkDynamicMemoryWStream buffer; |
1538 this->writeContent(&buffer); | 1538 this->writeContent(&buffer); |
1539 return skstd::unique_ptr<SkStreamAsset>( | 1539 return std::unique_ptr<SkStreamAsset>( |
1540 buffer.bytesWritten() > 0 | 1540 buffer.bytesWritten() > 0 |
1541 ? buffer.detachAsStream() | 1541 ? buffer.detachAsStream() |
1542 : new SkMemoryStream); | 1542 : new SkMemoryStream); |
1543 } | 1543 } |
1544 | 1544 |
1545 void SkPDFDevice::copyContentEntriesToData(ContentEntry* entry, | 1545 void SkPDFDevice::copyContentEntriesToData(ContentEntry* entry, |
1546 SkWStream* data) const { | 1546 SkWStream* data) const { |
1547 // TODO(ctguil): For margins, I'm not sure fExistingClipStack/Region is the | 1547 // TODO(ctguil): For margins, I'm not sure fExistingClipStack/Region is the |
1548 // right thing to pass here. | 1548 // right thing to pass here. |
1549 GraphicStackState gsState(fExistingClipStack, fExistingClipRegion, data); | 1549 GraphicStackState gsState(fExistingClipStack, fExistingClipRegion, data); |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 pdfimage.reset(SkPDFCreateBitmapObject( | 2329 pdfimage.reset(SkPDFCreateBitmapObject( |
2330 image, fCanon->getPixelSerializer())); | 2330 image, fCanon->getPixelSerializer())); |
2331 if (!pdfimage) { | 2331 if (!pdfimage) { |
2332 return; | 2332 return; |
2333 } | 2333 } |
2334 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get()); | 2334 fCanon->addPDFBitmap(image->uniqueID(), pdfimage.get()); |
2335 } | 2335 } |
2336 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), | 2336 SkPDFUtils::DrawFormXObject(this->addXObjectResource(pdfimage.get()), |
2337 &content.entry()->fContent); | 2337 &content.entry()->fContent); |
2338 } | 2338 } |
OLD | NEW |