| 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" |
| 11 #include "GrInvariantOutput.h" | 11 #include "GrInvariantOutput.h" |
| 12 #include "GrSimpleTextureEffect.h" | 12 #include "GrSimpleTextureEffect.h" |
| 13 #include "SkMatrix.h" | 13 #include "SkMatrix.h" |
| 14 #include "glsl/GrGLSLFragmentProcessor.h" | 14 #include "glsl/GrGLSLFragmentProcessor.h" |
| 15 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 15 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 16 | 16 |
| 17 class GrGLConfigConversionEffect : public GrGLSLFragmentProcessor { | 17 class GrGLConfigConversionEffect : public GrGLSLFragmentProcessor { |
| 18 public: | 18 public: |
| 19 GrGLConfigConversionEffect() {} | 19 void emitCode(EmitArgs& args) override { |
| 20 | |
| 21 virtual void emitCode(EmitArgs& args) override { | |
| 22 const GrConfigConversionEffect& cce = args.fFp.cast<GrConfigConversionEf
fect>(); | 20 const GrConfigConversionEffect& cce = args.fFp.cast<GrConfigConversionEf
fect>(); |
| 23 const GrSwizzle& swizzle = cce.swizzle(); | 21 const GrSwizzle& swizzle = cce.swizzle(); |
| 24 GrConfigConversionEffect::PMConversion pmConversion = cce.pmConversion()
; | 22 GrConfigConversionEffect::PMConversion pmConversion = cce.pmConversion()
; |
| 25 | 23 |
| 26 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. | 24 // Using highp for GLES here in order to avoid some precision issues on
specific GPUs. |
| 27 GrGLSLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecisi
on); | 25 GrGLSLShaderVar tmpVar("tmpColor", kVec4f_GrSLType, 0, kHigh_GrSLPrecisi
on); |
| 28 SkString tmpDecl; | 26 SkString tmpDecl; |
| 29 tmpVar.appendDecl(args.fGLSLCaps, &tmpDecl); | 27 tmpVar.appendDecl(args.fGLSLCaps, &tmpDecl); |
| 30 | 28 |
| 31 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 29 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } else { | 296 } else { |
| 299 if (kRGBA_8888_GrPixelConfig != texture->config() && | 297 if (kRGBA_8888_GrPixelConfig != texture->config() && |
| 300 kBGRA_8888_GrPixelConfig != texture->config() && | 298 kBGRA_8888_GrPixelConfig != texture->config() && |
| 301 kNone_PMConversion != pmConversion) { | 299 kNone_PMConversion != pmConversion) { |
| 302 // The PM conversions assume colors are 0..255 | 300 // The PM conversions assume colors are 0..255 |
| 303 return nullptr; | 301 return nullptr; |
| 304 } | 302 } |
| 305 return new GrConfigConversionEffect(texture, swizzle, pmConversion, matr
ix); | 303 return new GrConfigConversionEffect(texture, swizzle, pmConversion, matr
ix); |
| 306 } | 304 } |
| 307 } | 305 } |
| OLD | NEW |