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 "SkMakeUnique.h" | 8 #include "SkMakeUnique.h" |
9 #include "SkPDFCanon.h" | 9 #include "SkPDFCanon.h" |
10 #include "SkPDFCanvas.h" | 10 #include "SkPDFCanvas.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 249 } |
250 | 250 |
251 void SkPDFDocument::reset() { | 251 void SkPDFDocument::reset() { |
252 fCanvas.reset(nullptr); | 252 fCanvas.reset(nullptr); |
253 fPages.reset(); | 253 fPages.reset(); |
254 fCanon.reset(); | 254 fCanon.reset(); |
255 renew(&fObjectSerializer); | 255 renew(&fObjectSerializer); |
256 fFonts.reset(); | 256 fFonts.reset(); |
257 } | 257 } |
258 | 258 |
259 #ifdef SK_SUPPORT_LEGACY_DOCUMENT_API | |
260 void SkPDFDocument::setMetadata(const SkDocument::Attribute info[], | |
261 int infoCount, | |
262 const SkTime::DateTime* creationDate, | |
263 const SkTime::DateTime* modifiedDate) { | |
264 for (int i = 0; i < infoCount; ++i) { | |
265 const SkDocument::Attribute& kv = info[i]; | |
266 SkPDFMetadata::SetMetadataByKey(kv.fKey, kv.fValue, &fMetadata); | |
267 } | |
268 if (creationDate) { | |
269 fMetadata.fCreation.fEnabled = true; | |
270 fMetadata.fCreation.fDateTime = *creationDate; | |
271 } | |
272 if (modifiedDate) { | |
273 fMetadata.fModified.fEnabled = true; | |
274 fMetadata.fModified.fDateTime = *modifiedDate; | |
275 } | |
276 } | |
277 #endif // SK_SUPPORT_LEGACY_DOCUMENT_API | |
278 | |
279 static sk_sp<SkData> SkSrgbIcm() { | 259 static sk_sp<SkData> SkSrgbIcm() { |
280 // Source: http://www.argyllcms.com/icclibsrc.html | 260 // Source: http://www.argyllcms.com/icclibsrc.html |
281 static const char kProfile[] = | 261 static const char kProfile[] = |
282 "\0\0\14\214argl\2 \0\0mntrRGB XYZ \7\336\0\1\0\6\0\26\0\17\0:acspM" | 262 "\0\0\14\214argl\2 \0\0mntrRGB XYZ \7\336\0\1\0\6\0\26\0\17\0:acspM" |
283 "SFT\0\0\0\0IEC sRGB\0\0\0\0\0\0\0\0\0\0\0\0\0\0\366\326\0\1\0\0\0\0" | 263 "SFT\0\0\0\0IEC sRGB\0\0\0\0\0\0\0\0\0\0\0\0\0\0\366\326\0\1\0\0\0\0" |
284 "\323-argl\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" | 264 "\323-argl\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
285 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21desc\0\0\1P\0\0\0\231cprt\0" | 265 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21desc\0\0\1P\0\0\0\231cprt\0" |
286 "\0\1\354\0\0\0gdmnd\0\0\2T\0\0\0pdmdd\0\0\2\304\0\0\0\210tech\0\0\3" | 266 "\0\1\354\0\0\0gdmnd\0\0\2T\0\0\0pdmdd\0\0\2\304\0\0\0\210tech\0\0\3" |
287 "L\0\0\0\14vued\0\0\3X\0\0\0gview\0\0\3\300\0\0\0$lumi\0\0\3\344\0\0" | 267 "L\0\0\0\14vued\0\0\3X\0\0\0gview\0\0\3\300\0\0\0$lumi\0\0\3\344\0\0" |
288 "\0\24meas\0\0\3\370\0\0\0$wtpt\0\0\4\34\0\0\0\24bkpt\0\0\0040\0\0\0" | 268 "\0\24meas\0\0\3\370\0\0\0$wtpt\0\0\4\34\0\0\0\24bkpt\0\0\0040\0\0\0" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 455 } |
476 | 456 |
477 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, | 457 sk_sp<SkDocument> SkDocument::MakePDF(SkWStream* stream, |
478 SkScalar dpi, | 458 SkScalar dpi, |
479 const SkDocument::PDFMetadata& metadata, | 459 const SkDocument::PDFMetadata& metadata, |
480 sk_sp<SkPixelSerializer> jpegEncoder, | 460 sk_sp<SkPixelSerializer> jpegEncoder, |
481 bool pdfa) { | 461 bool pdfa) { |
482 return SkPDFMakeDocument(stream, nullptr, dpi, metadata, | 462 return SkPDFMakeDocument(stream, nullptr, dpi, metadata, |
483 std::move(jpegEncoder), pdfa); | 463 std::move(jpegEncoder), pdfa); |
484 } | 464 } |
OLD | NEW |