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

Side by Side Diff: src/doc/SkDocument_PDF.cpp

Issue 1689683002: SkDocument: remove use of SkTArray (part 1/3). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: size_t -> int Created 4 years, 10 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 | « include/core/SkDocument.h ('k') | tests/PDFMetadataAttributeTest.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 "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
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
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 }
OLDNEW
« no previous file with comments | « include/core/SkDocument.h ('k') | tests/PDFMetadataAttributeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698