OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 face->charsToGlyphs(text, encoding, glyphs, glyphCount); | 51 face->charsToGlyphs(text, encoding, glyphs, glyphCount); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 static void charsToGlyphsNull_proc(int loops, const SkPaint& paint, const void*
text, | 55 static void charsToGlyphsNull_proc(int loops, const SkPaint& paint, const void*
text, |
56 size_t len, int glyphCount) { | 56 size_t len, int glyphCount) { |
57 SkTypeface::Encoding encoding = paint2Encoding(paint); | 57 SkTypeface::Encoding encoding = paint2Encoding(paint); |
58 | 58 |
59 SkTypeface* face = paint.getTypeface(); | 59 SkTypeface* face = paint.getTypeface(); |
60 for (int i = 0; i < loops; ++i) { | 60 for (int i = 0; i < loops; ++i) { |
61 face->charsToGlyphs(text, encoding, NULL, glyphCount); | 61 face->charsToGlyphs(text, encoding, nullptr, glyphCount); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 class CMAPBench : public Benchmark { | 65 class CMAPBench : public Benchmark { |
66 TypefaceProc fProc; | 66 TypefaceProc fProc; |
67 SkString fName; | 67 SkString fName; |
68 char fText[NGLYPHS]; | 68 char fText[NGLYPHS]; |
69 SkPaint fPaint; | 69 SkPaint fPaint; |
70 | 70 |
71 public: | 71 public: |
(...skipping 21 matching lines...) Expand all Loading... |
93 | 93 |
94 typedef Benchmark INHERITED; | 94 typedef Benchmark INHERITED; |
95 }; | 95 }; |
96 | 96 |
97 ////////////////////////////////////////////////////////////////////////////// | 97 ////////////////////////////////////////////////////////////////////////////// |
98 | 98 |
99 DEF_BENCH( return new CMAPBench(containsText_proc, "paint_containsText"); ) | 99 DEF_BENCH( return new CMAPBench(containsText_proc, "paint_containsText"); ) |
100 DEF_BENCH( return new CMAPBench(textToGlyphs_proc, "paint_textToGlyphs"); ) | 100 DEF_BENCH( return new CMAPBench(textToGlyphs_proc, "paint_textToGlyphs"); ) |
101 DEF_BENCH( return new CMAPBench(charsToGlyphs_proc, "face_charsToGlyphs"); ) | 101 DEF_BENCH( return new CMAPBench(charsToGlyphs_proc, "face_charsToGlyphs"); ) |
102 DEF_BENCH( return new CMAPBench(charsToGlyphsNull_proc, "face_charsToGlyphs_null
"); ) | 102 DEF_BENCH( return new CMAPBench(charsToGlyphsNull_proc, "face_charsToGlyphs_null
"); ) |
OLD | NEW |