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

Side by Side Diff: bench/ImageFilterCollapse.cpp

Issue 1037793002: C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla} (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: git cl web Created 5 years, 9 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/ImageCacheBench.cpp ('k') | bench/ImageFilterDAGBench.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 21 matching lines...) Expand all
32 // Create a chain of ImageFilters from colorFilters 32 // Create a chain of ImageFilters from colorFilters
33 fImageFilter = NULL; 33 fImageFilter = NULL;
34 for(int i = nFilters; i --> 0;) { 34 for(int i = nFilters; i --> 0;) {
35 SkAutoTUnref<SkImageFilter> filter( 35 SkAutoTUnref<SkImageFilter> filter(
36 SkColorFilterImageFilter::Create(colorFilters[i], fImage Filter, NULL) 36 SkColorFilterImageFilter::Create(colorFilters[i], fImage Filter, NULL)
37 ); 37 );
38 SkRefCnt_SafeAssign(fImageFilter, filter.get()); 38 SkRefCnt_SafeAssign(fImageFilter, filter.get());
39 } 39 }
40 } 40 }
41 41
42 void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE { 42 void onDraw(const int loops, SkCanvas* canvas) override {
43 makeBitmap(); 43 makeBitmap();
44 44
45 for(int i = 0; i < loops; i++) { 45 for(int i = 0; i < loops; i++) {
46 SkPaint paint; 46 SkPaint paint;
47 paint.setImageFilter(fImageFilter); 47 paint.setImageFilter(fImageFilter);
48 canvas->drawBitmap(fBitmap, 0, 0, &paint); 48 canvas->drawBitmap(fBitmap, 0, 0, &paint);
49 } 49 }
50 } 50 }
51 51
52 private: 52 private:
(...skipping 19 matching lines...) Expand all
72 paint.setShader(shader); 72 paint.setShader(shader);
73 canvas.drawPaint(paint); 73 canvas.drawPaint(paint);
74 } 74 }
75 }; 75 };
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() SK_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() SK_OVERRIDE { 86 virtual void onPreDraw() 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 matrix[2] = matrix[7] = matrix[12] = 0.0722f; 128 matrix[2] = matrix[7] = matrix[12] = 0.0722f;
129 matrix[18] = 1.0f; 129 matrix[18] = 1.0f;
130 return SkColorMatrixFilter::Create(matrix); 130 return SkColorMatrixFilter::Create(matrix);
131 } 131 }
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() SK_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() SK_OVERRIDE { 142 virtual void onPreDraw() 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/ImageCacheBench.cpp ('k') | bench/ImageFilterDAGBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698