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 "SkLumaXfermode.h" | 8 #include "SkLumaXfermode.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkFlattenableBuffers.h" | 10 #include "SkFlattenableBuffers.h" |
11 #include "SkString.h" | 11 #include "SkString.h" |
12 | 12 |
13 #if SK_SUPPORT_GPU | 13 #if SK_SUPPORT_GPU |
14 #include "gl/GrGLEffect.h" | 14 #include "gl/GrGLEffect.h" |
15 #include "gl/GrGLEffectMatrix.h" | |
16 #include "GrContext.h" | 15 #include "GrContext.h" |
17 #include "GrTBackendEffectFactory.h" | 16 #include "GrTBackendEffectFactory.h" |
18 #endif | 17 #endif |
19 | 18 |
20 class SkLumaMaskXfermodeSrcOver : public SkLumaMaskXfermode { | 19 class SkLumaMaskXfermodeSrcOver : public SkLumaMaskXfermode { |
21 public: | 20 public: |
22 SkLumaMaskXfermodeSrcOver(); | 21 SkLumaMaskXfermodeSrcOver(); |
23 | 22 |
24 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaMaskXfermodeSrcOve
r) | 23 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaMaskXfermodeSrcOve
r) |
25 | 24 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 class GrGLLumaMaskEffect : public GrGLEffect { | 151 class GrGLLumaMaskEffect : public GrGLEffect { |
153 public: | 152 public: |
154 GrGLLumaMaskEffect(const GrBackendEffectFactory&, const GrDrawEffect&); | 153 GrGLLumaMaskEffect(const GrBackendEffectFactory&, const GrDrawEffect&); |
155 virtual ~GrGLLumaMaskEffect(); | 154 virtual ~GrGLLumaMaskEffect(); |
156 | 155 |
157 virtual void emitCode(GrGLShaderBuilder*, | 156 virtual void emitCode(GrGLShaderBuilder*, |
158 const GrDrawEffect&, | 157 const GrDrawEffect&, |
159 EffectKey, | 158 EffectKey, |
160 const char* outputColor, | 159 const char* outputColor, |
161 const char* inputColor, | 160 const char* inputColor, |
| 161 const TransformedCoordsArray&, |
162 const TextureSamplerArray&) SK_OVERRIDE; | 162 const TextureSamplerArray&) SK_OVERRIDE; |
163 | 163 |
164 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&); | 164 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&); |
165 | 165 |
166 private: | 166 private: |
167 typedef GrGLEffect INHERITED; | 167 typedef GrGLEffect INHERITED; |
168 }; | 168 }; |
169 | 169 |
170 class GrLumaMaskEffect : public GrEffect { | 170 class GrLumaMaskEffect : public GrEffect { |
171 public: | 171 public: |
(...skipping 24 matching lines...) Expand all Loading... |
196 | 196 |
197 GrGLLumaMaskEffect::GrGLLumaMaskEffect(const GrBackendEffectFactory& factory, | 197 GrGLLumaMaskEffect::GrGLLumaMaskEffect(const GrBackendEffectFactory& factory, |
198 const GrDrawEffect&) | 198 const GrDrawEffect&) |
199 : INHERITED(factory) { | 199 : INHERITED(factory) { |
200 } | 200 } |
201 | 201 |
202 GrGLLumaMaskEffect::~GrGLLumaMaskEffect() { | 202 GrGLLumaMaskEffect::~GrGLLumaMaskEffect() { |
203 } | 203 } |
204 | 204 |
205 void GrGLLumaMaskEffect::emitCode(GrGLShaderBuilder* builder, | 205 void GrGLLumaMaskEffect::emitCode(GrGLShaderBuilder* builder, |
206 const GrDrawEffect& effect, | 206 const GrDrawEffect& effect, |
207 EffectKey key, | 207 EffectKey key, |
208 const char* outputColor, | 208 const char* outputColor, |
209 const char* inputColor, | 209 const char* inputColor, |
210 const TextureSamplerArray& samplers) { | 210 const TransformedCoordsArray&, |
| 211 const TextureSamplerArray& samplers) { |
211 | 212 |
212 const GrLumaMaskEffect& lumaEffect = effect.castEffect<GrLumaMaskEffect>(); | 213 const GrLumaMaskEffect& lumaEffect = effect.castEffect<GrLumaMaskEffect>(); |
213 const char* dstColor = builder->dstColor(); | 214 const char* dstColor = builder->dstColor(); |
214 SkASSERT(NULL != dstColor); | 215 SkASSERT(NULL != dstColor); |
215 if (NULL == inputColor) { | 216 if (NULL == inputColor) { |
216 inputColor = GrGLSLOnesVecf(4); | 217 inputColor = GrGLSLOnesVecf(4); |
217 } | 218 } |
218 | 219 |
219 const char *opA = lumaOpA<char>(lumaEffect.getMode(), inputColor, dstColor); | 220 const char *opA = lumaOpA<char>(lumaEffect.getMode(), inputColor, dstColor); |
220 const char *opB = lumaOpB<char>(lumaEffect.getMode(), inputColor, dstColor); | 221 const char *opB = lumaOpB<char>(lumaEffect.getMode(), inputColor, dstColor); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // No background texture support. | 269 // No background texture support. |
269 if (effect && !background) { | 270 if (effect && !background) { |
270 *effect = GrLumaMaskEffect::Create(fMode); | 271 *effect = GrLumaMaskEffect::Create(fMode); |
271 return true; | 272 return true; |
272 } | 273 } |
273 | 274 |
274 return false; | 275 return false; |
275 } | 276 } |
276 | 277 |
277 #endif // SK_SUPPORT_GPU | 278 #endif // SK_SUPPORT_GPU |
OLD | NEW |