OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #ifndef SkColorMatrixFilter_DEFINED | 8 #ifndef SkColorMatrixFilter_DEFINED |
9 #define SkColorMatrixFilter_DEFINED | 9 #define SkColorMatrixFilter_DEFINED |
10 | 10 |
11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
12 | 12 |
13 class SK_API SkColorMatrixFilterRowMajor255 : public SkColorFilter { | 13 class SK_API SkColorMatrixFilterRowMajor255 : public SkColorFilter { |
14 public: | 14 public: |
15 explicit SkColorMatrixFilterRowMajor255(const SkScalar array[20]); | 15 explicit SkColorMatrixFilterRowMajor255(const SkScalar array[20]); |
16 | 16 |
| 17 /** Creates a color matrix filter that returns the same value in all four ch
annels. */ |
| 18 static SkColorFilter* CreateSingleChannelOutput(const SkScalar row[5]); |
| 19 |
17 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid
e; | 20 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid
e; |
18 void filterSpan4f(const SkPM4f src[], int count, SkPM4f[]) const override; | 21 void filterSpan4f(const SkPM4f src[], int count, SkPM4f[]) const override; |
19 uint32_t getFlags() const override; | 22 uint32_t getFlags() const override; |
20 bool asColorMatrix(SkScalar matrix[20]) const override; | 23 bool asColorMatrix(SkScalar matrix[20]) const override; |
21 SkColorFilter* newComposed(const SkColorFilter*) const override; | 24 SkColorFilter* newComposed(const SkColorFilter*) const override; |
22 | 25 |
23 #if SK_SUPPORT_GPU | 26 #if SK_SUPPORT_GPU |
24 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override; | 27 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override; |
25 #endif | 28 #endif |
26 | 29 |
27 SK_TO_STRING_OVERRIDE() | 30 SK_TO_STRING_OVERRIDE() |
28 | 31 |
29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter) | 32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorMatrixFilter) |
30 | 33 |
31 protected: | 34 protected: |
32 void flatten(SkWriteBuffer&) const override; | 35 void flatten(SkWriteBuffer&) const override; |
33 | 36 |
34 private: | 37 private: |
| 38 SkColorMatrixFilterRowMajor255() {}; |
| 39 |
35 SkScalar fMatrix[20]; | 40 SkScalar fMatrix[20]; |
36 float fTranspose[20]; // for Sk4s | 41 float fTranspose[20]; // for Sk4s |
37 uint32_t fFlags; | 42 uint32_t fFlags; |
38 | 43 |
39 void initState(const SkScalar array[20]); | 44 void initState(); |
40 | 45 |
41 typedef SkColorFilter INHERITED; | 46 typedef SkColorFilter INHERITED; |
42 }; | 47 }; |
43 | 48 |
44 #endif | 49 #endif |
OLD | NEW |