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 "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const GrConfigConversionEffect& configConversionEffect = | 21 const GrConfigConversionEffect& configConversionEffect = |
22 processor.cast<GrConfigConversionEffect>(); | 22 processor.cast<GrConfigConversionEffect>(); |
23 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue(); | 23 fSwapRedAndBlue = configConversionEffect.swapsRedAndBlue(); |
24 fPMConversion = configConversionEffect.pmConversion(); | 24 fPMConversion = configConversionEffect.pmConversion(); |
25 } | 25 } |
26 | 26 |
27 virtual void emitCode(EmitArgs& args) override { | 27 virtual void emitCode(EmitArgs& args) override { |
28 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. | 28 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. |
29 GrGLSLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecisi
on); | 29 GrGLSLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecisi
on); |
30 SkString tmpDecl; | 30 SkString tmpDecl; |
31 tmpVar.appendDecl(args.fBuilder->glslCaps(), &tmpDecl); | 31 tmpVar.appendDecl(args.fGLSLCaps, &tmpDecl); |
32 | 32 |
33 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 33 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
34 | 34 |
35 fragBuilder->codeAppendf("%s;", tmpDecl.c_str()); | 35 fragBuilder->codeAppendf("%s;", tmpDecl.c_str()); |
36 | 36 |
37 fragBuilder->codeAppendf("%s = ", tmpVar.c_str()); | 37 fragBuilder->codeAppendf("%s = ", tmpVar.c_str()); |
38 fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_st
r(), | 38 fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_st
r(), |
39 args.fCoords[0].getType()); | 39 args.fCoords[0].getType()); |
40 fragBuilder->codeAppend(";"); | 40 fragBuilder->codeAppend(";"); |
41 | 41 |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } else { | 298 } else { |
299 if (kRGBA_8888_GrPixelConfig != texture->config() && | 299 if (kRGBA_8888_GrPixelConfig != texture->config() && |
300 kBGRA_8888_GrPixelConfig != texture->config() && | 300 kBGRA_8888_GrPixelConfig != texture->config() && |
301 kNone_PMConversion != pmConversion) { | 301 kNone_PMConversion != pmConversion) { |
302 // The PM conversions assume colors are 0..255 | 302 // The PM conversions assume colors are 0..255 |
303 return nullptr; | 303 return nullptr; |
304 } | 304 } |
305 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio
n, matrix); | 305 return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversio
n, matrix); |
306 } | 306 } |
307 } | 307 } |
OLD | NEW |