OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkPDFMetadata.h" | 8 #include "SkPDFMetadata.h" |
9 #include "SkPDFTypes.h" | 9 #include "SkPDFTypes.h" |
10 #include <utility> | 10 #include <utility> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 return dict.release(); | 48 return dict.release(); |
49 } | 49 } |
50 | 50 |
51 #ifdef SK_PDF_GENERATE_PDFA | 51 #ifdef SK_PDF_GENERATE_PDFA |
52 SkPDFMetadata::UUID SkPDFMetadata::uuid() const { | 52 SkPDFMetadata::UUID SkPDFMetadata::uuid() const { |
53 // The main requirement is for the UUID to be unique; the exact | 53 // The main requirement is for the UUID to be unique; the exact |
54 // format of the data that will be hashed is not important. | 54 // format of the data that will be hashed is not important. |
55 SkMD5 md5; | 55 SkMD5 md5; |
56 const char uuidNamespace[] = "org.skia.pdf\n"; | 56 const char uuidNamespace[] = "org.skia.pdf\n"; |
57 md5.write(uuidNamespace, strlen(uuidNamespace)); | 57 md5.write(uuidNamespace, strlen(uuidNamespace)); |
58 SkMSec msec = SkTime::GetMSecs(); | 58 double msec = SkTime::GetMSecs(); |
59 md5.write(&msec, sizeof(msec)); | 59 md5.write(&msec, sizeof(msec)); |
60 SkTime::DateTime dateTime; | 60 SkTime::DateTime dateTime; |
61 SkTime::GetDateTime(&dateTime); | 61 SkTime::GetDateTime(&dateTime); |
62 md5.write(&dateTime, sizeof(dateTime)); | 62 md5.write(&dateTime, sizeof(dateTime)); |
63 if (fCreation) { | 63 if (fCreation) { |
64 md5.write(fCreation.get(), sizeof(fCreation)); | 64 md5.write(fCreation.get(), sizeof(fCreation)); |
65 } | 65 } |
66 if (fModified) { | 66 if (fModified) { |
67 md5.write(fModified.get(), sizeof(fModified)); | 67 md5.write(fModified.get(), sizeof(fModified)); |
68 } | 68 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 SkString instanceID = uuid_to_string(instance); | 342 SkString instanceID = uuid_to_string(instance); |
343 SkASSERT(0 == count_xml_escape_size(instanceID)); | 343 SkASSERT(0 == count_xml_escape_size(instanceID)); |
344 return new PDFXMLObject(sk_string_printf( | 344 return new PDFXMLObject(sk_string_printf( |
345 templateString, modificationDate.c_str(), creationDate.c_str(), | 345 templateString, modificationDate.c_str(), creationDate.c_str(), |
346 metadataDate.c_str(), creator.c_str(), title.c_str(), | 346 metadataDate.c_str(), creator.c_str(), title.c_str(), |
347 subject.c_str(), author.c_str(), keywords1.c_str(), | 347 subject.c_str(), author.c_str(), keywords1.c_str(), |
348 documentID.c_str(), instanceID.c_str(), keywords2.c_str())); | 348 documentID.c_str(), instanceID.c_str(), keywords2.c_str())); |
349 } | 349 } |
350 | 350 |
351 #endif // SK_PDF_GENERATE_PDFA | 351 #endif // SK_PDF_GENERATE_PDFA |
OLD | NEW |