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

Side by Side Diff: bench/ImageFilterCollapse.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/GrResourceCacheBench.cpp ('k') | bench/MagnifierBench.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 2014 Google Inc. 2 * Copyright 2014 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 "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 class TableCollapseBench: public BaseImageFilterCollapseBench { 77 class TableCollapseBench: public BaseImageFilterCollapseBench {
78 public: 78 public:
79 virtual ~TableCollapseBench() {} 79 virtual ~TableCollapseBench() {}
80 80
81 protected: 81 protected:
82 virtual const char* onGetName() override { 82 virtual const char* onGetName() override {
83 return "image_filter_collapse_table"; 83 return "image_filter_collapse_table";
84 } 84 }
85 85
86 virtual void onPreDraw() override { 86 virtual void onDelayedSetup() override {
87 for (int i = 0; i < 256; ++i) { 87 for (int i = 0; i < 256; ++i) {
88 int n = i >> 5; 88 int n = i >> 5;
89 table1[i] = (n << 5) | (n << 2) | (n >> 1); 89 table1[i] = (n << 5) | (n << 2) | (n >> 1);
90 90
91 table2[i] = i * i / 255; 91 table2[i] = i * i / 255;
92 92
93 float fi = i / 255.0f; 93 float fi = i / 255.0f;
94 table3[i] = static_cast<uint8_t>(sqrtf(fi) * 255); 94 table3[i] = static_cast<uint8_t>(sqrtf(fi) * 255);
95 } 95 }
96 96
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 class MatrixCollapseBench: public BaseImageFilterCollapseBench { 133 class MatrixCollapseBench: public BaseImageFilterCollapseBench {
134 public: 134 public:
135 virtual ~MatrixCollapseBench() {} 135 virtual ~MatrixCollapseBench() {}
136 136
137 protected: 137 protected:
138 virtual const char* onGetName() override { 138 virtual const char* onGetName() override {
139 return "image_filter_collapse_matrix"; 139 return "image_filter_collapse_matrix";
140 } 140 }
141 141
142 virtual void onPreDraw() override { 142 virtual void onDelayedSetup() override {
143 SkColorFilter* colorFilters[] = { 143 SkColorFilter* colorFilters[] = {
144 make_brightness(0.1f), 144 make_brightness(0.1f),
145 make_grayscale(), 145 make_grayscale(),
146 make_brightness(-0.1f), 146 make_brightness(-0.1f),
147 }; 147 };
148 148
149 doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters)); 149 doPreDraw(colorFilters, SK_ARRAY_COUNT(colorFilters));
150 150
151 for(unsigned i = 0; i < SK_ARRAY_COUNT(colorFilters); i++) { 151 for(unsigned i = 0; i < SK_ARRAY_COUNT(colorFilters); i++) {
152 colorFilters[i]->unref(); 152 colorFilters[i]->unref();
153 } 153 }
154 } 154 }
155 }; 155 };
156 156
157 DEF_BENCH(return new TableCollapseBench;) 157 DEF_BENCH(return new TableCollapseBench;)
158 DEF_BENCH(return new MatrixCollapseBench;) 158 DEF_BENCH(return new MatrixCollapseBench;)
OLDNEW
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | bench/MagnifierBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698