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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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/GrCircleBlurFragmentProcessor.h ('k') | 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // w - the size of the profile texture 76 // w - the size of the profile texture
77 pdman.set4f(fDataUniform, circle.centerX(), circle.centerY(), cbfp.offset(), 77 pdman.set4f(fDataUniform, circle.centerX(), circle.centerY(), cbfp.offset(),
78 SkIntToScalar(cbfp.profileSize())); 78 SkIntToScalar(cbfp.profileSize()));
79 } 79 }
80 80
81 /////////////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////////
82 82
83 GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(const SkRect& circl e, 83 GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(const SkRect& circl e,
84 float sigma, 84 float sigma,
85 float offset, 85 float offset,
86 GrTexture* blurProf ile) 86 GrTexture* blurProf ile,
87 GrRenderTarget* dst RT)
87 : fCircle(circle) 88 : fCircle(circle)
88 , fSigma(sigma) 89 , fSigma(sigma)
89 , fOffset(offset) 90 , fOffset(offset)
90 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) { 91 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode, SkSha der::kClamp_TileMode, dstRT) {
91 this->initClassID<GrCircleBlurFragmentProcessor>(); 92 this->initClassID<GrCircleBlurFragmentProcessor>();
92 this->addTextureAccess(&fBlurProfileAccess); 93 this->addTextureAccess(&fBlurProfileAccess);
93 this->setWillReadFragmentPosition(); 94 this->setWillReadFragmentPosition();
94 } 95 }
95 96
96 GrGLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLInstance() const { 97 GrGLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLInstance() const {
97 return new GrGLCircleBlurFragmentProcessor(*this); 98 return new GrGLCircleBlurFragmentProcessor(*this);
98 } 99 }
99 100
100 void GrCircleBlurFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps& caps, 101 void GrCircleBlurFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps& caps,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 weights[i] = eval_at(offset+i, halfWH, halfKernel.get(), kernelWH); 209 weights[i] = eval_at(offset+i, halfWH, halfKernel.get(), kernelWH);
209 } 210 }
210 211
211 return weights; 212 return weights;
212 } 213 }
213 214
214 GrTexture* GrCircleBlurFragmentProcessor::CreateCircleBlurProfileTexture( 215 GrTexture* GrCircleBlurFragmentProcessor::CreateCircleBlurProfileTexture(
215 GrTextureProvide r* textureProvider, 216 GrTextureProvide r* textureProvider,
216 const SkRect& ci rcle, 217 const SkRect& ci rcle,
217 float sigma, 218 float sigma,
218 float* offset) { 219 float* offset,
220 GrRenderTarget* dstRT) {
219 float halfWH = circle.width() / 2.0f; 221 float halfWH = circle.width() / 2.0f;
220 222
221 int size; 223 int size;
222 compute_profile_offset_and_size(halfWH, sigma, offset, &size); 224 compute_profile_offset_and_size(halfWH, sigma, offset, &size);
223 225
224 GrSurfaceDesc texDesc; 226 GrSurfaceDesc texDesc;
225 texDesc.fWidth = size; 227 texDesc.fWidth = size;
226 texDesc.fHeight = 1; 228 texDesc.fHeight = 1;
227 texDesc.fConfig = kAlpha_8_GrPixelConfig; 229 texDesc.fConfig = kAlpha_8_GrPixelConfig;
228 230
(...skipping 19 matching lines...) Expand all
248 250
249 return blurProfile; 251 return blurProfile;
250 } 252 }
251 253
252 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); 254 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor);
253 255
254 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor TestData* d) { 256 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor TestData* d) {
255 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); 257 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f);
256 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); 258 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f);
257 SkRect circle = SkRect::MakeWH(wh, wh); 259 SkRect circle = SkRect::MakeWH(wh, wh);
258 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(), circle, sigma); 260 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(), circle, sigma, NULL);
259 } 261 }
260 262
261 #endif 263 #endif
OLDNEW
« no previous file with comments | « src/effects/GrCircleBlurFragmentProcessor.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698