| 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 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
| 10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 virtual const char* onGetName() { | 52 virtual const char* onGetName() { |
| 53 return fName.c_str(); | 53 return fName.c_str(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void onDraw(SkCanvas* canvas) { | 56 virtual void onDraw(SkCanvas* canvas) { |
| 57 SkPaint paint; | 57 SkPaint paint; |
| 58 this->setupPaint(&paint); | 58 this->setupPaint(&paint); |
| 59 | 59 |
| 60 paint.setAntiAlias(true); | 60 paint.setAntiAlias(true); |
| 61 | 61 |
| 62 SkMWCRandom rand; | 62 SkRandom rand; |
| 63 for (int i = 0; i < SkBENCHLOOP(3); i++) { | 63 for (int i = 0; i < SkBENCHLOOP(3); i++) { |
| 64 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, | 64 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, |
| 65 rand.nextUScalar1() * 400); | 65 rand.nextUScalar1() * 400); |
| 66 r.offset(fRadius, fRadius); | 66 r.offset(fRadius, fRadius); |
| 67 | 67 |
| 68 if (fRadius > 0) { | 68 if (fRadius > 0) { |
| 69 SkMorphologyImageFilter* mf = NULL; | 69 SkMorphologyImageFilter* mf = NULL; |
| 70 switch (fStyle) { | 70 switch (fStyle) { |
| 71 case kDilate_MT: | 71 case kDilate_MT: |
| 72 mf = new SkDilateImageFilter(SkScalarFloorToInt(fRadius), | 72 mf = new SkDilateImageFilter(SkScalarFloorToInt(fRadius), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 static BenchRegistry gReg10(Fact10); | 108 static BenchRegistry gReg10(Fact10); |
| 109 static BenchRegistry gReg11(Fact11); | 109 static BenchRegistry gReg11(Fact11); |
| 110 | 110 |
| 111 static BenchRegistry gReg20(Fact20); | 111 static BenchRegistry gReg20(Fact20); |
| 112 static BenchRegistry gReg21(Fact21); | 112 static BenchRegistry gReg21(Fact21); |
| 113 | 113 |
| 114 static BenchRegistry gRegNone(FactNone); | 114 static BenchRegistry gRegNone(FactNone); |
| 115 | 115 |
| 116 #endif | 116 #endif |
| OLD | NEW |