Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: src/pdf/SkPDFDevice.cpp

Issue 1809693002: Revert of Use std::unique_ptr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 std::unique_ptr<SkStreamAsset> SkPDFDevice::content() const { 1536 skstd::unique_ptr<SkStreamAsset> SkPDFDevice::content() const {
1537 SkDynamicMemoryWStream buffer; 1537 SkDynamicMemoryWStream buffer;
1538 this->writeContent(&buffer); 1538 this->writeContent(&buffer);
1539 return std::unique_ptr<SkStreamAsset>( 1539 return skstd::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
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 }
OLDNEW
« no previous file with comments | « src/pdf/SkPDFDevice.h ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698