Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: bench/CmapBench.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | bench/SkGlyphCacheBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 public: 71 public:
72 CMAPBench(TypefaceProc proc, const char name[]) { 72 CMAPBench(TypefaceProc proc, const char name[]) {
73 fProc = proc; 73 fProc = proc;
74 fName.printf("cmap_%s", name); 74 fName.printf("cmap_%s", name);
75 75
76 for (int i = 0; i < NGLYPHS; ++i) { 76 for (int i = 0; i < NGLYPHS; ++i) {
77 // we're jamming values into utf8, so we must keep it legal utf8 77 // we're jamming values into utf8, so we must keep it legal utf8
78 fText[i] = 'A' + (i & 31); 78 fText[i] = 'A' + (i & 31);
79 } 79 }
80 fPaint.setTypeface(SkTypeface::RefDefault())->unref(); 80 fPaint.setTypeface(SkTypeface::MakeDefault());
81 } 81 }
82 82
83 protected: 83 protected:
84 const char* onGetName() override { 84 const char* onGetName() override {
85 return fName.c_str(); 85 return fName.c_str();
86 } 86 }
87 87
88 void onDraw(int loops, SkCanvas* canvas) override { 88 void onDraw(int loops, SkCanvas* canvas) override {
89 fProc(loops, fPaint, fText, sizeof(fText), NGLYPHS); 89 fProc(loops, fPaint, fText, sizeof(fText), NGLYPHS);
90 } 90 }
91 91
92 private: 92 private:
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 "); )
OLDNEW
« no previous file with comments | « no previous file | bench/SkGlyphCacheBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698