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 #include "SkLumaColorFilter.h" | 8 #include "SkLumaColorFilter.h" |
9 | 9 |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
11 #include "SkString.h" | 11 #include "SkString.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 #include "gl/GrGLProcessor.h" | 14 #include "gl/GrGLProcessor.h" |
15 #include "gl/builders/GrGLProgramBuilder.h" | 15 #include "gl/builders/GrGLProgramBuilder.h" |
16 #include "GrContext.h" | 16 #include "GrContext.h" |
| 17 #include "GrInvariantOutput.h" |
17 #include "GrTBackendProcessorFactory.h" | 18 #include "GrTBackendProcessorFactory.h" |
18 #endif | 19 #endif |
19 | 20 |
20 void SkLumaColorFilter::filterSpan(const SkPMColor src[], int count, | 21 void SkLumaColorFilter::filterSpan(const SkPMColor src[], int count, |
21 SkPMColor dst[]) const { | 22 SkPMColor dst[]) const { |
22 for (int i = 0; i < count; ++i) { | 23 for (int i = 0; i < count; ++i) { |
23 SkPMColor c = src[i]; | 24 SkPMColor c = src[i]; |
24 | 25 |
25 /* | 26 /* |
26 * While LuminanceToAlpha is defined to operate on un-premultiplied | 27 * While LuminanceToAlpha is defined to operate on un-premultiplied |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 105 |
105 } | 106 } |
106 | 107 |
107 private: | 108 private: |
108 typedef GrGLFragmentProcessor INHERITED; | 109 typedef GrGLFragmentProcessor INHERITED; |
109 }; | 110 }; |
110 | 111 |
111 private: | 112 private: |
112 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { retur
n true; } | 113 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { retur
n true; } |
113 | 114 |
114 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 115 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
115 // The output is always black. The alpha value for the color passed in i
s arbitrary. | 116 // The output is always black. The alpha value for the color passed in i
s arbitrary. |
116 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), | 117 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), |
117 InvariantOutput::kWill_ReadInput); | 118 GrInvariantOutput::kWill_ReadInput); |
118 } | 119 } |
119 }; | 120 }; |
120 | 121 |
121 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const { | 122 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const { |
122 return LumaColorFilterEffect::Create(); | 123 return LumaColorFilterEffect::Create(); |
123 } | 124 } |
124 #endif | 125 #endif |
OLD | NEW |