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