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" |
(...skipping 15 matching lines...) Expand all Loading... |
26 const GrFragmentProcessor&, | 26 const GrFragmentProcessor&, |
27 const char* outputColor, | 27 const char* outputColor, |
28 const char* inputColor, | 28 const char* inputColor, |
29 const TransformedCoordsArray& coords, | 29 const TransformedCoordsArray& coords, |
30 const TextureSamplerArray& samplers) override { | 30 const TextureSamplerArray& samplers) override { |
31 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. | 31 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. |
32 GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecision
); | 32 GrGLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecision
); |
33 SkString tmpDecl; | 33 SkString tmpDecl; |
34 tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl); | 34 tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl); |
35 | 35 |
36 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 36 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
37 | 37 |
38 fsBuilder->codeAppendf("%s;", tmpDecl.c_str()); | 38 fsBuilder->codeAppendf("%s;", tmpDecl.c_str()); |
39 | 39 |
40 fsBuilder->codeAppendf("%s = ", tmpVar.c_str()); | 40 fsBuilder->codeAppendf("%s = ", tmpVar.c_str()); |
41 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0]
.getType()); | 41 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0]
.getType()); |
42 fsBuilder->codeAppend(";"); | 42 fsBuilder->codeAppend(";"); |
43 | 43 |
44 if (GrConfigConversionEffect::kNone_PMConversion == fPMConversion) { | 44 if (GrConfigConversionEffect::kNone_PMConversion == fPMConversion) { |
45 SkASSERT(fSwapRedAndBlue); | 45 SkASSERT(fSwapRedAndBlue); |
46 fsBuilder->codeAppendf("%s = %s.bgra;", outputColor, tmpVar.c_str())
; | 46 fsBuilder->codeAppendf("%s = %s.bgra;", outputColor, tmpVar.c_str())
; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 kNone_PMConversion != pmConversion) { | 289 kNone_PMConversion != pmConversion) { |
290 // The PM conversions assume colors are 0..255 | 290 // The PM conversions assume colors are 0..255 |
291 return NULL; | 291 return NULL; |
292 } | 292 } |
293 return SkNEW_ARGS(GrConfigConversionEffect, (texture, | 293 return SkNEW_ARGS(GrConfigConversionEffect, (texture, |
294 swapRedAndBlue, | 294 swapRedAndBlue, |
295 pmConversion, | 295 pmConversion, |
296 matrix)); | 296 matrix)); |
297 } | 297 } |
298 } | 298 } |
OLD | NEW |