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

Side by Side Diff: src/effects/GrCircleBlurFragmentProcessor.cpp

Issue 1709153002: Add more specialized fragment builders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make MSVC happy Created 4 years, 10 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 | « no previous file | src/effects/SkAlphaThresholdFilter.cpp » ('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 /* 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 28 matching lines...) Expand all
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(kFragment_GrShaderFlag, 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 GrGLSLFPFragmentBuilder* 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);
54 } else { 54 } else {
55 fragBuilder->codeAppendf("vec4 src=vec4(1);"); 55 fragBuilder->codeAppendf("vec4 src=vec4(1);");
56 } 56 }
57 57
58 // We just want to compute "length(vec) - %s.z + 0.5) * %s.w" but need to re arrange 58 // We just want to compute "length(vec) - %s.z + 0.5) * %s.w" but need to re arrange
59 // for precision 59 // for precision
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698