OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorMatrixFilter.h" | 10 #include "SkColorMatrixFilter.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 SkShader::kClamp_TileMode); | 23 SkShader::kClamp_TileMode); |
24 } | 24 } |
25 | 25 |
26 typedef void (*InstallPaint)(SkPaint*, uint32_t, uint32_t); | 26 typedef void (*InstallPaint)(SkPaint*, uint32_t, uint32_t); |
27 | 27 |
28 static void install_nothing(SkPaint* paint, uint32_t, uint32_t) { | 28 static void install_nothing(SkPaint* paint, uint32_t, uint32_t) { |
29 paint->setColorFilter(nullptr); | 29 paint->setColorFilter(nullptr); |
30 } | 30 } |
31 | 31 |
32 static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) { | 32 static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) { |
33 paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(mul, add))->
unref(); | 33 paint->setColorFilter(SkColorMatrixFilter::MakeLightingFilter(mul, add)); |
34 } | 34 } |
35 | 35 |
36 class ColorFiltersGM : public skiagm::GM { | 36 class ColorFiltersGM : public skiagm::GM { |
37 public: | 37 public: |
38 ColorFiltersGM() { | 38 ColorFiltersGM() { |
39 fName.set("lightingcolorfilter"); | 39 fName.set("lightingcolorfilter"); |
40 } | 40 } |
41 | 41 |
42 protected: | 42 protected: |
43 virtual SkString onShortName() override { | 43 virtual SkString onShortName() override { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 private: | 78 private: |
79 SkString fName; | 79 SkString fName; |
80 typedef GM INHERITED; | 80 typedef GM INHERITED; |
81 }; | 81 }; |
82 | 82 |
83 | 83 |
84 ////////////////////////////////////////////////////////////////////////////// | 84 ////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
86 DEF_GM(return new ColorFiltersGM;) | 86 DEF_GM(return new ColorFiltersGM;) |
OLD | NEW |