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

Side by Side Diff: bench/SkGlyphCacheBench.cpp

Issue 1353203002: Delete the typefaces. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | no next file » | 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 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 8
9 #include "SkGlyphCache.h" 9 #include "SkGlyphCache.h"
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void onDraw(const int loops, SkCanvas*) override { 53 void onDraw(const int loops, SkCanvas*) override {
54 size_t oldCacheLimitSize = SkGraphics::GetFontCacheLimit(); 54 size_t oldCacheLimitSize = SkGraphics::GetFontCacheLimit();
55 SkGraphics::SetFontCacheLimit(fCacheSize); 55 SkGraphics::SetFontCacheLimit(fCacheSize);
56 SkTypeface* typeface = sk_tool_utils::create_portable_typeface( 56 SkTypeface* typeface = sk_tool_utils::create_portable_typeface(
57 "serif", SkTypeface::kItalic); 57 "serif", SkTypeface::kItalic);
58 SkPaint paint; 58 SkPaint paint;
59 paint.setAntiAlias(true); 59 paint.setAntiAlias(true);
60 paint.setSubpixelText(true); 60 paint.setSubpixelText(true);
61 paint.setTypeface(typeface); 61 paint.setTypeface(typeface);
bungeman-skia 2015/09/18 22:30:31 As a note, this is usually written SkSafeUnref(pa
62 62
63 for (int work = 0; work < loops; work++) { 63 for (int work = 0; work < loops; work++) {
64 do_font_stuff(&paint); 64 do_font_stuff(&paint);
65 } 65 }
66 SkGraphics::SetFontCacheLimit(oldCacheLimitSize); 66 SkGraphics::SetFontCacheLimit(oldCacheLimitSize);
67 SkSafeUnref(typeface);
67 } 68 }
68 69
69 private: 70 private:
70 typedef Benchmark INHERITED; 71 typedef Benchmark INHERITED;
71 const size_t fCacheSize; 72 const size_t fCacheSize;
72 SkString fName; 73 SkString fName;
73 }; 74 };
74 75
75 class SkGlyphCacheStressTest : public Benchmark { 76 class SkGlyphCacheStressTest : public Benchmark {
76 public: 77 public:
(...skipping 19 matching lines...) Expand all
96 for (int work = 0; work < loops; work++) { 97 for (int work = 0; work < loops; work++) {
97 sk_parallel_for(16, [&](int threadIndex) { 98 sk_parallel_for(16, [&](int threadIndex) {
98 SkPaint paint; 99 SkPaint paint;
99 paint.setAntiAlias(true); 100 paint.setAntiAlias(true);
100 paint.setSubpixelText(true); 101 paint.setSubpixelText(true);
101 paint.setTypeface(typefaces[threadIndex % 2]); 102 paint.setTypeface(typefaces[threadIndex % 2]);
102 do_font_stuff(&paint); 103 do_font_stuff(&paint);
103 }); 104 });
104 } 105 }
105 SkGraphics::SetFontCacheLimit(oldCacheLimitSize); 106 SkGraphics::SetFontCacheLimit(oldCacheLimitSize);
107 SkSafeUnref(typefaces[0]);
108 SkSafeUnref(typefaces[1]);
106 } 109 }
107 110
108 private: 111 private:
109 typedef Benchmark INHERITED; 112 typedef Benchmark INHERITED;
110 const size_t fCacheSize; 113 const size_t fCacheSize;
111 SkString fName; 114 SkString fName;
112 }; 115 };
113 116
114 DEF_BENCH( return new SkGlyphCacheBasic(256 * 1024); ) 117 DEF_BENCH( return new SkGlyphCacheBasic(256 * 1024); )
115 DEF_BENCH( return new SkGlyphCacheBasic(32 * 1024 * 1024); ) 118 DEF_BENCH( return new SkGlyphCacheBasic(32 * 1024 * 1024); )
116 DEF_BENCH( return new SkGlyphCacheStressTest(256 * 1024); ) 119 DEF_BENCH( return new SkGlyphCacheStressTest(256 * 1024); )
117 DEF_BENCH( return new SkGlyphCacheStressTest(32 * 1024 * 1024); ) 120 DEF_BENCH( return new SkGlyphCacheStressTest(32 * 1024 * 1024); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698