| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "Benchmark.h" | 8 #include "Benchmark.h" |
| 9 #include "Resources.h" | 9 #include "Resources.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 size_t fN; | 22 size_t fN; |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 static void test_pdf_object_serialization(SkPDFObject* object) { | 25 static void test_pdf_object_serialization(SkPDFObject* object) { |
| 26 // SkDebugWStream wStream; | 26 // SkDebugWStream wStream; |
| 27 NullWStream wStream; | 27 NullWStream wStream; |
| 28 SkPDFSubstituteMap substitutes; | 28 SkPDFSubstituteMap substitutes; |
| 29 SkPDFObjNumMap objNumMap; | 29 SkPDFObjNumMap objNumMap; |
| 30 objNumMap.addObjectRecursively(object, substitutes); | 30 objNumMap.addObjectRecursively(object, substitutes); |
| 31 for (int i = 0; i < objNumMap.objects().count(); ++i) { | 31 for (int i = 0; i < objNumMap.objects().count(); ++i) { |
| 32 SkPDFObject* object = objNumMap.objects()[i]; | 32 SkPDFObject* object = objNumMap.objects()[i].get(); |
| 33 wStream.writeDecAsText(i + 1); | 33 wStream.writeDecAsText(i + 1); |
| 34 wStream.writeText(" 0 obj\n"); | 34 wStream.writeText(" 0 obj\n"); |
| 35 object->emitObject(&wStream, objNumMap, substitutes); | 35 object->emitObject(&wStream, objNumMap, substitutes); |
| 36 wStream.writeText("\nendobj\n"); | 36 wStream.writeText("\nendobj\n"); |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 class PDFImageBench : public Benchmark { | 40 class PDFImageBench : public Benchmark { |
| 41 public: | 41 public: |
| 42 PDFImageBench() {} | 42 PDFImageBench() {} |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 (void)SkPDFUtils::FloatToDecimal(f, dst); | 162 (void)SkPDFUtils::FloatToDecimal(f, dst); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 } // namespace | 167 } // namespace |
| 168 DEF_BENCH(return new PDFImageBench;) | 168 DEF_BENCH(return new PDFImageBench;) |
| 169 DEF_BENCH(return new PDFJpegImageBench;) | 169 DEF_BENCH(return new PDFJpegImageBench;) |
| 170 DEF_BENCH(return new PDFCompressionBench;) | 170 DEF_BENCH(return new PDFCompressionBench;) |
| 171 DEF_BENCH(return new PDFScalarBench;) | 171 DEF_BENCH(return new PDFScalarBench;) |
| OLD | NEW |