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