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