OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrConfigConversionEffect.h" | 8 #include "GrConfigConversionEffect.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
11 #include "GrTBackendProcessorFactory.h" | 11 #include "GrTBackendProcessorFactory.h" |
12 #include "GrSimpleTextureEffect.h" | 12 #include "GrSimpleTextureEffect.h" |
13 #include "gl/GrGLProcessor.h" | 13 #include "gl/GrGLProcessor.h" |
14 #include "gl/builders/GrGLProgramBuilder.h" | 14 #include "gl/builders/GrGLProgramBuilder.h" |
15 #include "SkMatrix.h" | 15 #include "SkMatrix.h" |
16 | 16 |
17 class GrGLConfigConversionEffect : public GrGLFragmentProcessor { | 17 class GrGLConfigConversionEffect : public GrGLFragmentProcessor { |
18 public: | 18 public: |
19 GrGLConfigConversionEffect(const GrBackendProcessorFactory& factory, | 19 GrGLConfigConversionEffect(const GrBackendProcessorFactory& factory, |
20 const GrProcessor& processor) | 20 const GrProcessor& processor) |
21 : INHERITED (factory) { | 21 : INHERITED (factory) { |
22 const GrConfigConversionEffect& configConversionEffect = | 22 const GrConfigConversionEffect& configConversionEffect = |
23 processor.cast<GrConfigConversionEffect>(); | 23 processor.cast<GrConfigConversionEffect>(); |
24 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue(); | 24 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue(); |
25 fPMConversion = configConversionEffect.pmConversion(); | 25 fPMConversion = configConversionEffect.pmConversion(); |
26 } | 26 } |
27 | 27 |
28 virtual void emitCode(GrGLFPBuilder* builder, | 28 virtual void emitCode(GrGLFPBuilder* builder, |
29 const GrFragmentProcessor&, | 29 const GrFragmentProcessor&, |
30 const GrProcessorKey& key, | |
31 const char* outputColor, | 30 const char* outputColor, |
32 const char* inputColor, | 31 const char* inputColor, |
33 const TransformedCoordsArray& coords, | 32 const TransformedCoordsArray& coords, |
34 const TextureSamplerArray& samplers) SK_OVERRIDE { | 33 const TextureSamplerArray& samplers) SK_OVERRIDE { |
35 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. | 34 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. |
36 GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, GrGLShaderVar::kHig
h_Precision); | 35 GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, GrGLShaderVar::kHig
h_Precision); |
37 SkString tmpDecl; | 36 SkString tmpDecl; |
38 tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl); | 37 tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl); |
39 | 38 |
40 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 39 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 kNone_PMConversion != pmConversion) { | 274 kNone_PMConversion != pmConversion) { |
276 // The PM conversions assume colors are 0..255 | 275 // The PM conversions assume colors are 0..255 |
277 return NULL; | 276 return NULL; |
278 } | 277 } |
279 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 278 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
280 swapRedAndBlue, | 279 swapRedAndBlue, |
281 pmConversion, | 280 pmConversion, |
282 matrix)); | 281 matrix)); |
283 } | 282 } |
284 } | 283 } |
OLD | NEW |