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