| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkLumaColorFilter_DEFINED | 8 #ifndef SkLumaColorFilter_DEFINED |
| 9 #define SkLumaColorFilter_DEFINED | 9 #define SkLumaColorFilter_DEFINED |
| 10 | 10 |
| 11 #include "SkColorFilter.h" | 11 #include "SkColorFilter.h" |
| 12 #include "SkRefCnt.h" |
| 12 | 13 |
| 13 /** | 14 /** |
| 14 * Luminance-to-alpha color filter, as defined in | 15 * Luminance-to-alpha color filter, as defined in |
| 15 * http://www.w3.org/TR/SVG/masking.html#Masking | 16 * http://www.w3.org/TR/SVG/masking.html#Masking |
| 16 * http://www.w3.org/TR/css-masking/#MaskValues | 17 * http://www.w3.org/TR/css-masking/#MaskValues |
| 17 * | 18 * |
| 18 * The resulting color is black with transparency equal to the | 19 * The resulting color is black with transparency equal to the |
| 19 * luminance value modulated by alpha: | 20 * luminance value modulated by alpha: |
| 20 * | 21 * |
| 21 * C' = [ Lum * a, 0, 0, 0 ] | 22 * C' = [ Lum * a, 0, 0, 0 ] |
| 22 * | 23 * |
| 23 */ | 24 */ |
| 24 class SK_API SkLumaColorFilter : public SkColorFilter { | 25 class SK_API SkLumaColorFilter : public SkColorFilter { |
| 25 public: | 26 public: |
| 26 static sk_sp<SkColorFilter> Make(); | 27 static sk_sp<SkColorFilter> Make(); |
| 27 | 28 |
| 28 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR | 29 #ifdef SK_SUPPORT_LEGACY_COLORFILTER_PTR |
| 29 static SkColorFilter* Create() { return Make().release(); } | 30 static SkColorFilter* Create() { return Make().release(); } |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid
e; | 33 void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const overrid
e; |
| 33 | 34 |
| 34 #if SK_SUPPORT_GPU | 35 #if SK_SUPPORT_GPU |
| 35 const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override; | 36 sk_sp<GrFragmentProcessor> asFragmentProcessor(GrContext*) const override; |
| 36 #endif | 37 #endif |
| 37 | 38 |
| 38 SK_TO_STRING_OVERRIDE() | 39 SK_TO_STRING_OVERRIDE() |
| 39 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter) | 40 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter) |
| 40 | 41 |
| 41 protected: | 42 protected: |
| 42 void flatten(SkWriteBuffer&) const override; | 43 void flatten(SkWriteBuffer&) const override; |
| 43 | 44 |
| 44 private: | 45 private: |
| 45 SkLumaColorFilter(); | 46 SkLumaColorFilter(); |
| 46 | 47 |
| 47 typedef SkColorFilter INHERITED; | 48 typedef SkColorFilter INHERITED; |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 #endif | 51 #endif |
| OLD | NEW |