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

Side by Side Diff: bench/TextBlobBench.cpp

Issue 1379853003: Fix for nexus 5 crashing in GL benches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 2 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 | « bench/TextBench.cpp ('k') | bench/nanobench.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 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "Benchmark.h" 9 #include "Benchmark.h"
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 11 matching lines...) Expand all
22 /* 22 /*
23 * A trivial test which benchmarks the performance of a textblob with a single r un. 23 * A trivial test which benchmarks the performance of a textblob with a single r un.
24 */ 24 */
25 class TextBlobBench : public Benchmark { 25 class TextBlobBench : public Benchmark {
26 public: 26 public:
27 TextBlobBench() 27 TextBlobBench()
28 : fTypeface(nullptr) { 28 : fTypeface(nullptr) {
29 } 29 }
30 30
31 protected: 31 protected:
32 void onPreDraw() override { 32 void onDelayedSetup() override {
33 fTypeface.reset(sk_tool_utils::create_portable_typeface("serif", SkTypef ace::kNormal)); 33 fTypeface.reset(sk_tool_utils::create_portable_typeface("serif", SkTypef ace::kNormal));
34 // make textblob 34 // make textblob
35 SkPaint paint; 35 SkPaint paint;
36 paint.setTypeface(fTypeface); 36 paint.setTypeface(fTypeface);
37 const char* text = "Hello blob!"; 37 const char* text = "Hello blob!";
38 SkTDArray<uint16_t> glyphs; 38 SkTDArray<uint16_t> glyphs;
39 size_t len = strlen(text); 39 size_t len = strlen(text);
40 glyphs.append(paint.textToGlyphs(text, len, nullptr)); 40 glyphs.append(paint.textToGlyphs(text, len, nullptr));
41 paint.textToGlyphs(text, len, glyphs.begin()); 41 paint.textToGlyphs(text, len, glyphs.begin());
42 42
(...skipping 23 matching lines...) Expand all
66 private: 66 private:
67 67
68 SkAutoTUnref<const SkTextBlob> fBlob; 68 SkAutoTUnref<const SkTextBlob> fBlob;
69 SkTDArray<uint16_t> fGlyphs; 69 SkTDArray<uint16_t> fGlyphs;
70 SkAutoTUnref<SkTypeface> fTypeface; 70 SkAutoTUnref<SkTypeface> fTypeface;
71 71
72 typedef Benchmark INHERITED; 72 typedef Benchmark INHERITED;
73 }; 73 };
74 74
75 DEF_BENCH( return new TextBlobBench(); ) 75 DEF_BENCH( return new TextBlobBench(); )
OLDNEW
« no previous file with comments | « bench/TextBench.cpp ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698