OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorMatrixFilter.h" | 9 #include "SkColorMatrixFilter.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
11 #include "SkImage.h" | 11 #include "SkImage.h" |
12 | 12 |
13 #define WIDTH 500 | 13 #define WIDTH 500 |
14 #define HEIGHT 500 | 14 #define HEIGHT 500 |
15 | 15 |
16 static void set_color_matrix(SkPaint* paint, const SkColorMatrix& matrix) { | 16 static void set_color_matrix(SkPaint* paint, const SkColorMatrix& matrix) { |
17 paint->setColorFilter(SkColorMatrixFilter::Create(matrix))->unref(); | 17 paint->setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix.fMat
)); |
18 } | 18 } |
19 | 19 |
20 static void set_array(SkPaint* paint, const SkScalar array[]) { | 20 static void set_array(SkPaint* paint, const SkScalar array[]) { |
21 paint->setColorFilter(SkColorMatrixFilter::Create(array))->unref(); | 21 paint->setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(array)); |
22 } | 22 } |
23 | 23 |
24 class ColorMatrixGM : public skiagm::GM { | 24 class ColorMatrixGM : public skiagm::GM { |
25 public: | 25 public: |
26 ColorMatrixGM() { | 26 ColorMatrixGM() { |
27 this->setBGColor(sk_tool_utils::color_to_565(0xFF808080)); | 27 this->setBGColor(sk_tool_utils::color_to_565(0xFF808080)); |
28 } | 28 } |
29 | 29 |
30 protected: | 30 protected: |
31 SkString onShortName() override { | 31 SkString onShortName() override { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 | 140 |
141 private: | 141 private: |
142 sk_sp<SkImage> fSolidImg; | 142 sk_sp<SkImage> fSolidImg; |
143 sk_sp<SkImage> fTransparentImg; | 143 sk_sp<SkImage> fTransparentImg; |
144 | 144 |
145 typedef skiagm::GM INHERITED; | 145 typedef skiagm::GM INHERITED; |
146 }; | 146 }; |
147 DEF_GM( return new ColorMatrixGM; ) | 147 DEF_GM( return new ColorMatrixGM; ) |
148 | 148 |
OLD | NEW |