Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: src/gpu/effects/GrConfigConversionEffect.cpp

Issue 23826002: Rename ShaderType enum to ShaderVisibility (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "GrTBackendEffectFactory.h" 10 #include "GrTBackendEffectFactory.h"
(...skipping 15 matching lines...) Expand all
26 26
27 virtual void emitCode(GrGLShaderBuilder* builder, 27 virtual void emitCode(GrGLShaderBuilder* builder,
28 const GrDrawEffect&, 28 const GrDrawEffect&,
29 EffectKey key, 29 EffectKey key,
30 const char* outputColor, 30 const char* outputColor,
31 const char* inputColor, 31 const char* inputColor,
32 const TextureSamplerArray& samplers) SK_OVERRIDE { 32 const TextureSamplerArray& samplers) SK_OVERRIDE {
33 SkString coords; 33 SkString coords;
34 GrSLType coordsType = fEffectMatrix.emitCode(builder, key, &coords); 34 GrSLType coordsType = fEffectMatrix.emitCode(builder, key, &coords);
35 builder->fsCodeAppendf("\t\t%s = ", outputColor); 35 builder->fsCodeAppendf("\t\t%s = ", outputColor);
36 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, 36 builder->fsAppendTextureLookup(samplers[0], coords.c_str(), coordsType);
37 samplers[0],
38 coords.c_str(),
39 coordsType);
40 builder->fsCodeAppend(";\n"); 37 builder->fsCodeAppend(";\n");
41 if (GrConfigConversionEffect::kNone_PMConversion == fPMConversion) { 38 if (GrConfigConversionEffect::kNone_PMConversion == fPMConversion) {
42 SkASSERT(fSwapRedAndBlue); 39 SkASSERT(fSwapRedAndBlue);
43 builder->fsCodeAppendf("\t%s = %s.bgra;\n", outputColor, outputColor ); 40 builder->fsCodeAppendf("\t%s = %s.bgra;\n", outputColor, outputColor );
44 } else { 41 } else {
45 const char* swiz = fSwapRedAndBlue ? "bgr" : "rgb"; 42 const char* swiz = fSwapRedAndBlue ? "bgr" : "rgb";
46 switch (fPMConversion) { 43 switch (fPMConversion) {
47 case GrConfigConversionEffect::kMulByAlpha_RoundUp_PMConversion: 44 case GrConfigConversionEffect::kMulByAlpha_RoundUp_PMConversion:
48 builder->fsCodeAppendf( 45 builder->fsCodeAppendf(
49 "\t\t%s = vec4(ceil(%s.%s * %s.a * 255.0) / 255.0, %s.a) ;\n", 46 "\t\t%s = vec4(ceil(%s.%s * %s.a * 255.0) / 255.0, %s.a) ;\n",
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 // The PM conversions assume colors are 0..255 284 // The PM conversions assume colors are 0..255
288 return NULL; 285 return NULL;
289 } 286 }
290 AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture, 287 AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture,
291 swapRedAndB lue, 288 swapRedAndB lue,
292 pmConversio n, 289 pmConversio n,
293 matrix))); 290 matrix)));
294 return CreateEffectRef(effect); 291 return CreateEffectRef(effect);
295 } 292 }
296 } 293 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointRadialGradient.cpp ('k') | src/gpu/effects/GrConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698