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 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 HEXIFY(data, ptr, gHex, 2); | 176 HEXIFY(data, ptr, gHex, 2); |
177 *ptr++ = '-'; | 177 *ptr++ = '-'; |
178 HEXIFY(data, ptr, gHex, 6); | 178 HEXIFY(data, ptr, gHex, 6); |
179 SkASSERT(ptr == buffer + 36); | 179 SkASSERT(ptr == buffer + 36); |
180 SkASSERT(data == uuid.fData + 16); | 180 SkASSERT(data == uuid.fData + 16); |
181 return SkString(buffer, 36); | 181 return SkString(buffer, 36); |
182 } | 182 } |
183 #undef HEXIFY | 183 #undef HEXIFY |
184 | 184 |
185 namespace { | 185 namespace { |
186 class PDFXMLObject : public SkPDFObject { | 186 class PDFXMLObject final : public SkPDFObject { |
187 public: | 187 public: |
188 PDFXMLObject(SkString xml) : fXML(skstd::move(xml)) {} | 188 PDFXMLObject(SkString xml) : fXML(skstd::move(xml)) {} |
189 void emitObject(SkWStream* stream, | 189 void emitObject(SkWStream* stream, |
190 const SkPDFObjNumMap& omap, | 190 const SkPDFObjNumMap& omap, |
191 const SkPDFSubstituteMap& smap) const override { | 191 const SkPDFSubstituteMap& smap) const override { |
192 SkPDFDict dict("Metadata"); | 192 SkPDFDict dict("Metadata"); |
193 dict.insertName("Subtype", "XML"); | 193 dict.insertName("Subtype", "XML"); |
194 dict.insertInt("Length", fXML.size()); | 194 dict.insertInt("Length", fXML.size()); |
195 dict.emitObject(stream, omap, smap); | 195 dict.emitObject(stream, omap, smap); |
196 static const char streamBegin[] = " stream\n"; | 196 static const char streamBegin[] = " stream\n"; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 SkString instanceID = uuid_to_string(instance); | 341 SkString instanceID = uuid_to_string(instance); |
342 SkASSERT(0 == count_xml_escape_size(instanceID)); | 342 SkASSERT(0 == count_xml_escape_size(instanceID)); |
343 return new PDFXMLObject(sk_string_printf( | 343 return new PDFXMLObject(sk_string_printf( |
344 templateString, modificationDate.c_str(), creationDate.c_str(), | 344 templateString, modificationDate.c_str(), creationDate.c_str(), |
345 metadataDate.c_str(), creator.c_str(), title.c_str(), | 345 metadataDate.c_str(), creator.c_str(), title.c_str(), |
346 subject.c_str(), author.c_str(), keywords1.c_str(), | 346 subject.c_str(), author.c_str(), keywords1.c_str(), |
347 documentID.c_str(), instanceID.c_str(), keywords2.c_str())); | 347 documentID.c_str(), instanceID.c_str(), keywords2.c_str())); |
348 } | 348 } |
349 | 349 |
350 #endif // SK_PDF_GENERATE_PDFA | 350 #endif // SK_PDF_GENERATE_PDFA |
OLD | NEW |