| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 if (kScale_Type == fType) { | 183 if (kScale_Type == fType) { |
| 184 fSaved[fNumSaved][2] = scaleRand.nextRangeScalar(0.5f, 1.5f); | 184 fSaved[fNumSaved][2] = scaleRand.nextRangeScalar(0.5f, 1.5f); |
| 185 mat.preScale(fSaved[fNumSaved][2], fSaved[fNumSaved][2]); | 185 mat.preScale(fSaved[fNumSaved][2], fSaved[fNumSaved][2]); |
| 186 } else if (kRotate_Type == fType) { | 186 } else if (kRotate_Type == fType) { |
| 187 fSaved[fNumSaved][2] = rotRand.nextRangeScalar(0.0f, 360.0f); | 187 fSaved[fNumSaved][2] = rotRand.nextRangeScalar(0.0f, 360.0f); |
| 188 mat.preRotate(fSaved[fNumSaved][2]); | 188 mat.preRotate(fSaved[fNumSaved][2]); |
| 189 } | 189 } |
| 190 | 190 |
| 191 canvas->concat(mat); | 191 canvas->concat(mat); |
| 192 if (fUseAtlas) { | 192 if (fUseAtlas) { |
| 193 static int curCell = 0; | 193 const int curCell = i % (kNumAtlasedX * kNumAtlasedY); |
| 194 SkIRect src = fAtlasRects[curCell % (kNumAtlasedX)][curCell / (k
NumAtlasedX)]; | 194 SkIRect src = fAtlasRects[curCell % (kNumAtlasedX)][curCell / (k
NumAtlasedX)]; |
| 195 curCell = (curCell + 1) % (kNumAtlasedX*kNumAtlasedY); | |
| 196 | 195 |
| 197 if (fUseDrawVertices) { | 196 if (fUseDrawVertices) { |
| 198 SkPoint uvs[4] = { | 197 SkPoint uvs[4] = { |
| 199 { SkIntToScalar(src.fLeft), SkIntToScalar(src.fBottom)
}, | 198 { SkIntToScalar(src.fLeft), SkIntToScalar(src.fBottom)
}, |
| 200 { SkIntToScalar(src.fLeft), SkIntToScalar(src.fTop) }, | 199 { SkIntToScalar(src.fLeft), SkIntToScalar(src.fTop) }, |
| 201 { SkIntToScalar(src.fRight), SkIntToScalar(src.fTop) }, | 200 { SkIntToScalar(src.fRight), SkIntToScalar(src.fTop) }, |
| 202 { SkIntToScalar(src.fRight), SkIntToScalar(src.fBottom)
}, | 201 { SkIntToScalar(src.fRight), SkIntToScalar(src.fBottom)
}, |
| 203 }; | 202 }; |
| 204 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, | 203 canvas->drawVertices(SkCanvas::kTriangles_VertexMode, |
| 205 4, verts, uvs, NULL, NULL, | 204 4, verts, uvs, NULL, NULL, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, | 328 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, |
| 330 GameBench::kFull_Clear, true)); ) | 329 GameBench::kFull_Clear, true)); ) |
| 331 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type, | 330 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kRotate_Type, |
| 332 GameBench::kFull_Clear)); ) | 331 GameBench::kFull_Clear)); ) |
| 333 | 332 |
| 334 // Atlased | 333 // Atlased |
| 335 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, | 334 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, |
| 336 GameBench::kFull_Clear, false, true)
); ) | 335 GameBench::kFull_Clear, false, true)
); ) |
| 337 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, | 336 DEF_BENCH( return SkNEW_ARGS(GameBench, (GameBench::kTranslate_Type, |
| 338 GameBench::kFull_Clear, false, true,
true)); ) | 337 GameBench::kFull_Clear, false, true,
true)); ) |
| OLD | NEW |