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

Side by Side Diff: src/effects/gradients/SkGradientShader.cpp

Issue 25605008: Repurpose GrGLCoordTransform as GrGLEffectArray (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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
« no previous file with comments | « include/gpu/GrTBackendEffectFactory.h ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkGradientShaderPriv.h" 8 #include "SkGradientShaderPriv.h"
9 #include "SkLinearGradient.h" 9 #include "SkLinearGradient.h"
10 #include "SkRadialGradient.h" 10 #include "SkRadialGradient.h"
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 } 928 }
929 929
930 return key; 930 return key;
931 } 931 }
932 932
933 void GrGLGradientEffect::emitColor(GrGLShaderBuilder* builder, 933 void GrGLGradientEffect::emitColor(GrGLShaderBuilder* builder,
934 const char* gradientTValue, 934 const char* gradientTValue,
935 EffectKey key, 935 EffectKey key,
936 const char* outputColor, 936 const char* outputColor,
937 const char* inputColor, 937 const char* inputColor,
938 const GrGLShaderBuilder::TextureSamplerArray& samplers) { 938 const TextureSamplerArray& samplers) {
939 if (GrGradientEffect::kTwo_ColorType == ColorTypeFromKey(key)){ 939 if (GrGradientEffect::kTwo_ColorType == ColorTypeFromKey(key)){
940 builder->fsCodeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1. 0));\n", 940 builder->fsCodeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1. 0));\n",
941 builder->getUniformVariable(fColorStartUni).c_str (), 941 builder->getUniformVariable(fColorStartUni).c_str (),
942 builder->getUniformVariable(fColorEndUni).c_str() , 942 builder->getUniformVariable(fColorEndUni).c_str() ,
943 gradientTValue); 943 gradientTValue);
944 // Note that we could skip this step if both colors are known to be opaq ue. Two 944 // Note that we could skip this step if both colors are known to be opaq ue. Two
945 // considerations: 945 // considerations:
946 // The gradient SkShader reporting opaque is more restrictive than neces sary in the two pt 946 // The gradient SkShader reporting opaque is more restrictive than neces sary in the two pt
947 // case. Make sure the key reflects this optimization (and note that it can use the same 947 // case. Make sure the key reflects this optimization (and note that it can use the same
948 // shader as thekBeforeIterp case). This same optimization applies to th e 3 color case below. 948 // shader as thekBeforeIterp case). This same optimization applies to th e 3 color case below.
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 (*stops)[i] = stop; 1136 (*stops)[i] = stop;
1137 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1137 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1138 } 1138 }
1139 } 1139 }
1140 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1140 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1141 1141
1142 return outColors; 1142 return outColors;
1143 } 1143 }
1144 1144
1145 #endif 1145 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrTBackendEffectFactory.h ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698