OLD | NEW |
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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 virtual ~AlternatingColorPatternBench() { | 107 virtual ~AlternatingColorPatternBench() { |
108 SkSafeUnref(fBmShader); | 108 SkSafeUnref(fBmShader); |
109 } | 109 } |
110 | 110 |
111 protected: | 111 protected: |
112 const char* onGetName() override { | 112 const char* onGetName() override { |
113 return fName.c_str(); | 113 return fName.c_str(); |
114 } | 114 } |
115 | 115 |
116 void onPreDraw() override { | 116 void onDelayedSetup() override { |
117 int w = 40; | 117 int w = 40; |
118 int h = 40; | 118 int h = 40; |
119 makebm(&fBmp, w, h); | 119 makebm(&fBmp, w, h); |
120 fBmShader = SkShader::CreateBitmapShader(fBmp, | 120 fBmShader = SkShader::CreateBitmapShader(fBmp, |
121 SkShader::kRepeat_TileMode, | 121 SkShader::kRepeat_TileMode, |
122 SkShader::kRepeat_TileMode); | 122 SkShader::kRepeat_TileMode); |
123 int offset = 2; | 123 int offset = 2; |
124 int count = 0; | 124 int count = 0; |
125 for (int j = 0; j < NY; ++j) { | 125 for (int j = 0; j < NY; ++j) { |
126 for (int i = 0; i < NX; ++i) { | 126 for (int i = 0; i < NX; ++i) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, | 192 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, |
193 kOpaqueBitmap_ColorPattern, | 193 kOpaqueBitmap_ColorPattern, |
194 kRect_DrawType);) | 194 kRect_DrawType);) |
195 DEF_BENCH(return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern, | 195 DEF_BENCH(return new AlternatingColorPatternBench(kAlphaBitmap_ColorPattern, |
196 kAlphaBitmap_ColorPattern, | 196 kAlphaBitmap_ColorPattern, |
197 kRect_DrawType);) | 197 kRect_DrawType);) |
198 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, | 198 DEF_BENCH(return new AlternatingColorPatternBench(kOpaqueBitmap_ColorPattern, |
199 kAlphaBitmap_ColorPattern, | 199 kAlphaBitmap_ColorPattern, |
200 kRect_DrawType);) | 200 kRect_DrawType);) |
OLD | NEW |