| OLD | NEW |
| 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 "SkHalf.h" | 10 #include "SkHalf.h" |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 return key; | 1241 return key; |
| 1242 } | 1242 } |
| 1243 | 1243 |
| 1244 void GrGradientEffect::GLSLProcessor::emitColor(GrGLSLFPFragmentBuilder* fragBui
lder, | 1244 void GrGradientEffect::GLSLProcessor::emitColor(GrGLSLFPFragmentBuilder* fragBui
lder, |
| 1245 GrGLSLUniformHandler* uniformHan
dler, | 1245 GrGLSLUniformHandler* uniformHan
dler, |
| 1246 const GrGLSLCaps* glslCaps, | 1246 const GrGLSLCaps* glslCaps, |
| 1247 const GrGradientEffect& ge, | 1247 const GrGradientEffect& ge, |
| 1248 const char* gradientTValue, | 1248 const char* gradientTValue, |
| 1249 const char* outputColor, | 1249 const char* outputColor, |
| 1250 const char* inputColor, | 1250 const char* inputColor, |
| 1251 const SamplerHandle* texSamplers
) { | 1251 const TextureSamplers& texSample
rs) { |
| 1252 switch (ge.getColorType()) { | 1252 switch (ge.getColorType()) { |
| 1253 #if GR_GL_USE_ACCURATE_HARD_STOP_GRADIENTS | 1253 #if GR_GL_USE_ACCURATE_HARD_STOP_GRADIENTS |
| 1254 case kHardStopCentered_ColorType: { | 1254 case kHardStopCentered_ColorType: { |
| 1255 const char* t = gradientTValue; | 1255 const char* t = gradientTValue; |
| 1256 const char* colors = uniformHandler->getUniformCStr(fColorsUni); | 1256 const char* colors = uniformHandler->getUniformCStr(fColorsUni); |
| 1257 | 1257 |
| 1258 fragBuilder->codeAppendf("float clamp_t = clamp(%s, 0.0, 1.0);", t); | 1258 fragBuilder->codeAppendf("float clamp_t = clamp(%s, 0.0, 1.0);", t); |
| 1259 | 1259 |
| 1260 // Account for tile mode | 1260 // Account for tile mode |
| 1261 if (SkShader::kRepeat_TileMode == ge.fTileMode) { | 1261 if (SkShader::kRepeat_TileMode == ge.fTileMode) { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 (*stops)[i] = stop; | 1614 (*stops)[i] = stop; |
| 1615 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; | 1615 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st
op) : 1.f; |
| 1616 } | 1616 } |
| 1617 } | 1617 } |
| 1618 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); | 1618 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM
odeCount)); |
| 1619 | 1619 |
| 1620 return outColors; | 1620 return outColors; |
| 1621 } | 1621 } |
| 1622 | 1622 |
| 1623 #endif | 1623 #endif |
| OLD | NEW |