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 #include "SkBenchmark.h" | 7 #include "Benchmark.h" |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColorFilterImageFilter.h" | 9 #include "SkColorFilterImageFilter.h" |
10 #include "SkColorMatrixFilter.h" | 10 #include "SkColorMatrixFilter.h" |
11 #include "SkLumaColorFilter.h" | 11 #include "SkLumaColorFilter.h" |
12 #include "SkTableColorFilter.h" | 12 #include "SkTableColorFilter.h" |
13 | 13 |
14 #define FILTER_WIDTH_SMALL SkIntToScalar(32) | 14 #define FILTER_WIDTH_SMALL SkIntToScalar(32) |
15 #define FILTER_HEIGHT_SMALL SkIntToScalar(32) | 15 #define FILTER_HEIGHT_SMALL SkIntToScalar(32) |
16 #define FILTER_WIDTH_LARGE SkIntToScalar(256) | 16 #define FILTER_WIDTH_LARGE SkIntToScalar(256) |
17 #define FILTER_HEIGHT_LARGE SkIntToScalar(256) | 17 #define FILTER_HEIGHT_LARGE SkIntToScalar(256) |
18 | 18 |
19 class ColorFilterBaseBench : public SkBenchmark { | 19 class ColorFilterBaseBench : public Benchmark { |
20 | 20 |
21 public: | 21 public: |
22 ColorFilterBaseBench(bool small) : fIsSmall(small) { } | 22 ColorFilterBaseBench(bool small) : fIsSmall(small) { } |
23 | 23 |
24 protected: | 24 protected: |
25 SkRect getFilterRect() const { | 25 SkRect getFilterRect() const { |
26 return isSmall() ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_SMAL
L) : | 26 return isSmall() ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_SMAL
L) : |
27 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_LARG
E); | 27 SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_LARG
E); |
28 } | 28 } |
29 | 29 |
(...skipping 21 matching lines...) Expand all Loading... |
51 static SkImageFilter* make_mode_blue(SkImageFilter* input = NULL) { | 51 static SkImageFilter* make_mode_blue(SkImageFilter* input = NULL) { |
52 SkAutoTUnref<SkColorFilter> filter( | 52 SkAutoTUnref<SkColorFilter> filter( |
53 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod
e)); | 53 SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mod
e)); |
54 return SkColorFilterImageFilter::Create(filter, input); | 54 return SkColorFilterImageFilter::Create(filter, input); |
55 } | 55 } |
56 | 56 |
57 inline bool isSmall() const { return fIsSmall; } | 57 inline bool isSmall() const { return fIsSmall; } |
58 private: | 58 private: |
59 bool fIsSmall; | 59 bool fIsSmall; |
60 | 60 |
61 typedef SkBenchmark INHERITED; | 61 typedef Benchmark INHERITED; |
62 }; | 62 }; |
63 | 63 |
64 class ColorFilterDimBrightBench : public ColorFilterBaseBench { | 64 class ColorFilterDimBrightBench : public ColorFilterBaseBench { |
65 | 65 |
66 public: | 66 public: |
67 ColorFilterDimBrightBench(bool small) : INHERITED(small) { | 67 ColorFilterDimBrightBench(bool small) : INHERITED(small) { |
68 } | 68 } |
69 | 69 |
70 protected: | 70 protected: |
71 virtual const char* onGetName() SK_OVERRIDE { | 71 virtual const char* onGetName() SK_OVERRIDE { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 DEF_BENCH( return new ColorFilterDimBrightBench(false); ) | 358 DEF_BENCH( return new ColorFilterDimBrightBench(false); ) |
359 DEF_BENCH( return new ColorFilterBrightGrayBench(false); ) | 359 DEF_BENCH( return new ColorFilterBrightGrayBench(false); ) |
360 DEF_BENCH( return new ColorFilterGrayBrightBench(false); ) | 360 DEF_BENCH( return new ColorFilterGrayBrightBench(false); ) |
361 DEF_BENCH( return new ColorFilterBlueBrightBench(false); ) | 361 DEF_BENCH( return new ColorFilterBlueBrightBench(false); ) |
362 DEF_BENCH( return new ColorFilterBrightBlueBench(false); ) | 362 DEF_BENCH( return new ColorFilterBrightBlueBench(false); ) |
363 DEF_BENCH( return new ColorFilterBrightBench(false); ) | 363 DEF_BENCH( return new ColorFilterBrightBench(false); ) |
364 DEF_BENCH( return new ColorFilterBlueBench(false); ) | 364 DEF_BENCH( return new ColorFilterBlueBench(false); ) |
365 DEF_BENCH( return new ColorFilterGrayBench(false); ) | 365 DEF_BENCH( return new ColorFilterGrayBench(false); ) |
366 DEF_BENCH( return new TableColorFilterBench(false); ) | 366 DEF_BENCH( return new TableColorFilterBench(false); ) |
367 DEF_BENCH( return new LumaColorFilterBench(false); ) | 367 DEF_BENCH( return new LumaColorFilterBench(false); ) |
OLD | NEW |