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

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

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unneeded assert Created 4 years, 8 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
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('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 "Sk4fLinearGradient.h" 8 #include "Sk4fLinearGradient.h"
9 #include "SkGradientShaderPriv.h" 9 #include "SkGradientShaderPriv.h"
10 #include "SkLinearGradient.h" 10 #include "SkLinearGradient.h"
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 return key; 1020 return key;
1021 } 1021 }
1022 1022
1023 void GrGLGradientEffect::emitColor(GrGLSLFPFragmentBuilder* fragBuilder, 1023 void GrGLGradientEffect::emitColor(GrGLSLFPFragmentBuilder* fragBuilder,
1024 GrGLSLUniformHandler* uniformHandler, 1024 GrGLSLUniformHandler* uniformHandler,
1025 const GrGLSLCaps* glslCaps, 1025 const GrGLSLCaps* glslCaps,
1026 const GrGradientEffect& ge, 1026 const GrGradientEffect& ge,
1027 const char* gradientTValue, 1027 const char* gradientTValue,
1028 const char* outputColor, 1028 const char* outputColor,
1029 const char* inputColor, 1029 const char* inputColor,
1030 const SamplerArray& texSamplers) { 1030 const SamplerHandle* texSamplers) {
1031 if (SkGradientShaderBase::kTwo_GpuColorType == ge.getColorType()){ 1031 if (SkGradientShaderBase::kTwo_GpuColorType == ge.getColorType()){
1032 fragBuilder->codeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1.0));\n", 1032 fragBuilder->codeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1.0));\n",
1033 uniformHandler->getUniformVariable(fColorStartU ni).c_str(), 1033 uniformHandler->getUniformVariable(fColorStartU ni).c_str(),
1034 uniformHandler->getUniformVariable(fColorEndUni ).c_str(), 1034 uniformHandler->getUniformVariable(fColorEndUni ).c_str(),
1035 gradientTValue); 1035 gradientTValue);
1036 // Note that we could skip this step if both colors are known to be opaq ue. Two 1036 // Note that we could skip this step if both colors are known to be opaq ue. Two
1037 // considerations: 1037 // considerations:
1038 // The gradient SkShader reporting opaque is more restrictive than neces sary in the two pt 1038 // The gradient SkShader reporting opaque is more restrictive than neces sary in the two pt
1039 // case. Make sure the key reflects this optimization (and note that it can use the same 1039 // case. Make sure the key reflects this optimization (and note that it can use the same
1040 // shader as thekBeforeIterp case). This same optimization applies to th e 3 color case 1040 // shader as thekBeforeIterp case). This same optimization applies to th e 3 color case
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 (*stops)[i] = stop; 1203 (*stops)[i] = stop;
1204 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1204 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1205 } 1205 }
1206 } 1206 }
1207 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1207 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1208 1208
1209 return outColors; 1209 return outColors;
1210 } 1210 }
1211 1211
1212 #endif 1212 #endif
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698