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

Side by Side Diff: bench/ColorPrivBench.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/ColorCubeBench.cpp ('k') | bench/DecodingBench.h » ('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 #include "Benchmark.h" 7 #include "Benchmark.h"
8 #include "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkRandom.h" 9 #include "SkRandom.h"
10 #include "SkString.h" 10 #include "SkString.h"
11 11
12 template <bool kFast, bool kScale> 12 template <bool kFast, bool kScale>
13 class FourByteInterpBench : public Benchmark { 13 class FourByteInterpBench : public Benchmark {
14 public: 14 public:
15 FourByteInterpBench() { 15 FourByteInterpBench() {
16 fName.set("four_byte_interp"); 16 fName.set("four_byte_interp");
17 fName.append(kFast ? "_fast" : "_slow"); 17 fName.append(kFast ? "_fast" : "_slow");
18 fName.append(kScale ? "_255" : "_256"); 18 fName.append(kScale ? "_255" : "_256");
19 } 19 }
20 20
21 bool isSuitableFor(Backend backend) override { 21 bool isSuitableFor(Backend backend) override {
22 return backend == kNonRendering_Backend; 22 return backend == kNonRendering_Backend;
23 } 23 }
24 24
25 const char* onGetName() override { return fName.c_str(); } 25 const char* onGetName() override { return fName.c_str(); }
26 26
27 void onPreDraw() override { 27 void onDelayedSetup() override {
28 // A handful of random srcs and dsts. 28 // A handful of random srcs and dsts.
29 SkRandom rand; 29 SkRandom rand;
30 for (int i = 0; i < kInputs; i++) { 30 for (int i = 0; i < kInputs; i++) {
31 fSrcs[i] = SkPreMultiplyColor(rand.nextU()); 31 fSrcs[i] = SkPreMultiplyColor(rand.nextU());
32 fDsts[i] = SkPreMultiplyColor(rand.nextU()); 32 fDsts[i] = SkPreMultiplyColor(rand.nextU());
33 } 33 }
34 34
35 // We'll exhaustively test all scales instead of using random numbers. 35 // We'll exhaustively test all scales instead of using random numbers.
36 for (int i = 0; i <= 256; i++) { 36 for (int i = 0; i <= 256; i++) {
37 fScales[i] = i; 37 fScales[i] = i;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 volatile unsigned fDsts[kInputs]; 78 volatile unsigned fDsts[kInputs];
79 unsigned fScales[257]; // We need space for [0, 256]. 79 unsigned fScales[257]; // We need space for [0, 256].
80 }; 80 };
81 81
82 #define COMMA , 82 #define COMMA ,
83 DEF_BENCH(return (new FourByteInterpBench<true COMMA true>);) 83 DEF_BENCH(return (new FourByteInterpBench<true COMMA true>);)
84 DEF_BENCH(return (new FourByteInterpBench<true COMMA false>);) 84 DEF_BENCH(return (new FourByteInterpBench<true COMMA false>);)
85 DEF_BENCH(return (new FourByteInterpBench<false COMMA true>);) 85 DEF_BENCH(return (new FourByteInterpBench<false COMMA true>);)
86 DEF_BENCH(return (new FourByteInterpBench<false COMMA false>);) 86 DEF_BENCH(return (new FourByteInterpBench<false COMMA false>);)
87 #undef COMMA 87 #undef COMMA
OLDNEW
« no previous file with comments | « bench/ColorCubeBench.cpp ('k') | bench/DecodingBench.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698