OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 SkPoint verts[4] = { // for drawVertices path | 127 SkPoint verts[4] = { // for drawVertices path |
128 { 0, 0 }, | 128 { 0, 0 }, |
129 { 0, SkIntToScalar(height) }, | 129 { 0, SkIntToScalar(height) }, |
130 { SkIntToScalar(width), SkIntToScalar(height) }, | 130 { SkIntToScalar(width), SkIntToScalar(height) }, |
131 { SkIntToScalar(width), 0 } | 131 { SkIntToScalar(width), 0 } |
132 }; | 132 }; |
133 uint16_t indices[6] = { 0, 1, 2, 0, 2, 3 }; | 133 uint16_t indices[6] = { 0, 1, 2, 0, 2, 3 }; |
134 | 134 |
135 SkPaint p; | 135 SkPaint p; |
136 p.setColor(0xFF000000); | 136 p.setColor(0xFF000000); |
137 p.setFilterBitmap(true); | 137 p.setFilterLevel(SkPaint::kLow_FilterLevel); |
138 | 138 |
139 SkPaint p2; // for drawVertices path | 139 SkPaint p2; // for drawVertices path |
140 p2.setColor(0xFF000000); | 140 p2.setColor(0xFF000000); |
141 p2.setFilterBitmap(true); | 141 p2.setFilterLevel(SkPaint::kLow_FilterLevel); |
142 p2.setShader(SkShader::CreateBitmapShader(fAtlas, | 142 p2.setShader(SkShader::CreateBitmapShader(fAtlas, |
143 SkShader::kClamp_TileMode, | 143 SkShader::kClamp_TileMode, |
144 SkShader::kClamp_TileMode))->u
nref(); | 144 SkShader::kClamp_TileMode))->u
nref(); |
145 | 145 |
146 for (int i = 0; i < this->getLoops(); ++i, ++fNumSaved) { | 146 for (int i = 0; i < this->getLoops(); ++i, ++fNumSaved) { |
147 if (0 == i % kNumBeforeClear) { | 147 if (0 == i % kNumBeforeClear) { |
148 if (kPartial_Clear == fClear) { | 148 if (kPartial_Clear == fClear) { |
149 for (int j = 0; j < fNumSaved; ++j) { | 149 for (int j = 0; j < fNumSaved; ++j) { |
150 canvas->setMatrix(SkMatrix::I()); | 150 canvas->setMatrix(SkMatrix::I()); |
151 mat.setTranslate(fSaved[j][0], fSaved[j][1]); | 151 mat.setTranslate(fSaved[j][0], fSaved[j][1]); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, | 329 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, |
330 GameBench::kFull_Clear, true)); ) | 330 GameBench::kFull_Clear, true)); ) |
331 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type, | 331 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type, |
332 GameBench::kFull_Clear)); ) | 332 GameBench::kFull_Clear)); ) |
333 | 333 |
334 // Atlased | 334 // Atlased |
335 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, | 335 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, |
336 GameBench::kFull_Clear, false, true)
); ) | 336 GameBench::kFull_Clear, false, true)
); ) |
337 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, | 337 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, |
338 GameBench::kFull_Clear, false, true,
true)); ) | 338 GameBench::kFull_Clear, false, true,
true)); ) |
OLD | NEW |