| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkRandom.h" | 10 #include "SkRandom.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 virtual const char* onGetName() { | 30 virtual const char* onGetName() { |
| 31 return fName.c_str(); | 31 return fName.c_str(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void onDraw(SkCanvas* canvas) { | 34 virtual void onDraw(SkCanvas* canvas) { |
| 35 SkPaint paint; | 35 SkPaint paint; |
| 36 this->setupPaint(&paint); | 36 this->setupPaint(&paint); |
| 37 | 37 |
| 38 paint.setAntiAlias(true); | 38 paint.setAntiAlias(true); |
| 39 | 39 |
| 40 SkMWCRandom rand; | 40 SkRandom rand; |
| 41 SkRect r = SkRect::MakeWH(40, 40); | 41 SkRect r = SkRect::MakeWH(40, 40); |
| 42 SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell
(fScale)); | 42 SkAutoTUnref<SkImageFilter> bicubic(SkBicubicImageFilter::CreateMitchell
(fScale)); |
| 43 paint.setImageFilter(bicubic); | 43 paint.setImageFilter(bicubic); |
| 44 canvas->save(); | 44 canvas->save(); |
| 45 canvas->clipRect(r); | 45 canvas->clipRect(r); |
| 46 canvas->drawOval(r, paint); | 46 canvas->drawOval(r, paint); |
| 47 canvas->restore(); | 47 canvas->restore(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 typedef SkBenchmark INHERITED; | 51 typedef SkBenchmark INHERITED; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 static SkBenchmark* Fact00(void* p) { return new BicubicBench(p, 10.0f, 10.0f);
} | 54 static SkBenchmark* Fact00(void* p) { return new BicubicBench(p, 10.0f, 10.0f);
} |
| 55 static SkBenchmark* Fact01(void* p) { return new BicubicBench(p, 2.5f, 10.0f); } | 55 static SkBenchmark* Fact01(void* p) { return new BicubicBench(p, 2.5f, 10.0f); } |
| 56 static SkBenchmark* Fact02(void* p) { return new BicubicBench(p, 10.0f, 2.5f); } | 56 static SkBenchmark* Fact02(void* p) { return new BicubicBench(p, 10.0f, 2.5f); } |
| 57 static SkBenchmark* Fact03(void* p) { return new BicubicBench(p, 2.5f, 2.5f); } | 57 static SkBenchmark* Fact03(void* p) { return new BicubicBench(p, 2.5f, 2.5f); } |
| 58 | 58 |
| 59 static BenchRegistry gReg00(Fact00); | 59 static BenchRegistry gReg00(Fact00); |
| 60 static BenchRegistry gReg01(Fact01); | 60 static BenchRegistry gReg01(Fact01); |
| 61 static BenchRegistry gReg02(Fact02); | 61 static BenchRegistry gReg02(Fact02); |
| 62 static BenchRegistry gReg03(Fact03); | 62 static BenchRegistry gReg03(Fact03); |
| OLD | NEW |