| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrCircleBlurFragmentProcessor.h" | 9 #include "GrCircleBlurFragmentProcessor.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 void GrGLCircleBlurFragmentProcessor::emitCode(EmitArgs& args) { | 35 void GrGLCircleBlurFragmentProcessor::emitCode(EmitArgs& args) { |
| 36 | 36 |
| 37 const char *dataName; | 37 const char *dataName; |
| 38 | 38 |
| 39 // The data is formatted as: | 39 // The data is formatted as: |
| 40 // x,y - the center of the circle | 40 // x,y - the center of the circle |
| 41 // z - the distance at which the intensity starts falling off (e.g., the
start of the table) | 41 // z - the distance at which the intensity starts falling off (e.g., the
start of the table) |
| 42 // w - the inverse of the profile texture size | 42 // w - the inverse of the profile texture size |
| 43 fDataUniform = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFragm
ent_Visibility, | 43 fDataUniform = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, |
| 44 kVec4f_GrSLType, | 44 kVec4f_GrSLType, |
| 45 kDefault_GrSLPrecision, | 45 kDefault_GrSLPrecision, |
| 46 "data", | 46 "data", |
| 47 &dataName); | 47 &dataName); |
| 48 | 48 |
| 49 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 49 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 50 const char *fragmentPos = fragBuilder->fragmentPosition(); | 50 const char *fragmentPos = fragBuilder->fragmentPosition(); |
| 51 | 51 |
| 52 if (args.fInputColor) { | 52 if (args.fInputColor) { |
| 53 fragBuilder->codeAppendf("vec4 src=%s;", args.fInputColor); | 53 fragBuilder->codeAppendf("vec4 src=%s;", args.fInputColor); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); | 257 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); |
| 258 | 258 |
| 259 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { | 259 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { |
| 260 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); | 260 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); |
| 261 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); | 261 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); |
| 262 SkRect circle = SkRect::MakeWH(wh, wh); | 262 SkRect circle = SkRect::MakeWH(wh, wh); |
| 263 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); | 263 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); |
| 264 } | 264 } |
| 265 | 265 |
| 266 #endif | 266 #endif |
| OLD | NEW |