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

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

Issue 2188623004: SkPDF: SkPDFStream takes a unique_ptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | src/pdf/SkPDFFont.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 "SkColorSpace_Base.h" 8 #include "SkColorSpace_Base.h"
9 #include "SkPDFCanvas.h" 9 #include "SkPDFCanvas.h"
10 #include "SkPDFDevice.h" 10 #include "SkPDFDevice.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 fCanvas.reset(nullptr); 271 fCanvas.reset(nullptr);
272 SkASSERT(fPageDevice); 272 SkASSERT(fPageDevice);
273 auto page = sk_make_sp<SkPDFDict>("Page"); 273 auto page = sk_make_sp<SkPDFDict>("Page");
274 page->insertObject("Resources", fPageDevice->makeResourceDict()); 274 page->insertObject("Resources", fPageDevice->makeResourceDict());
275 page->insertObject("MediaBox", fPageDevice->copyMediaBox()); 275 page->insertObject("MediaBox", fPageDevice->copyMediaBox());
276 auto annotations = sk_make_sp<SkPDFArray>(); 276 auto annotations = sk_make_sp<SkPDFArray>();
277 fPageDevice->appendAnnotations(annotations.get()); 277 fPageDevice->appendAnnotations(annotations.get());
278 if (annotations->size() > 0) { 278 if (annotations->size() > 0) {
279 page->insertObject("Annots", std::move(annotations)); 279 page->insertObject("Annots", std::move(annotations));
280 } 280 }
281 auto contentData = fPageDevice->content(); 281 auto contentObject = sk_make_sp<SkPDFStream>(fPageDevice->content());
282 auto contentObject = sk_make_sp<SkPDFStream>(contentData.get());
283 this->serialize(contentObject); 282 this->serialize(contentObject);
284 page->insertObjRef("Contents", std::move(contentObject)); 283 page->insertObjRef("Contents", std::move(contentObject));
285 fPageDevice->appendDestinations(fDests.get(), page.get()); 284 fPageDevice->appendDestinations(fDests.get(), page.get());
286 fPages.emplace_back(std::move(page)); 285 fPages.emplace_back(std::move(page));
287 fPageDevice.reset(nullptr); 286 fPageDevice.reset(nullptr);
288 } 287 }
289 288
290 void SkPDFDocument::onAbort() { 289 void SkPDFDocument::onAbort() {
291 fCanvas.reset(nullptr); 290 fCanvas.reset(nullptr);
292 fPages.reset(); 291 fPages.reset();
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } 417 }
419 418
420 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, 419 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream,
421 SkScalar dpi, 420 SkScalar dpi,
422 const SkDocument::PDFMetadata& metadata, 421 const SkDocument::PDFMetadata& metadata,
423 sk_sp<SkPixelSerializer> jpegEncoder, 422 sk_sp<SkPixelSerializer> jpegEncoder,
424 bool pdfa) { 423 bool pdfa) {
425 return SkPDFMakeDocument(stream, nullptr, dpi, metadata, 424 return SkPDFMakeDocument(stream, nullptr, dpi, metadata,
426 std::move(jpegEncoder), pdfa); 425 std::move(jpegEncoder), pdfa);
427 } 426 }
OLDNEW
« no previous file with comments | « no previous file | src/pdf/SkPDFFont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698