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

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

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 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 "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 } 238 }
239 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 239 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
240 240
241 typedef GrGradientEffect INHERITED; 241 typedef GrGradientEffect INHERITED;
242 }; 242 };
243 243
244 ///////////////////////////////////////////////////////////////////// 244 /////////////////////////////////////////////////////////////////////
245 245
246 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSweepGradient); 246 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSweepGradient);
247 247
248 GrFragmentProcessor* GrSweepGradient::TestCreate(SkRandom* random, 248 GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) {
249 GrContext* context, 249 SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
250 const GrCaps&,
251 GrTexture**) {
252 SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
253 250
254 SkColor colors[kMaxRandomGradientColors]; 251 SkColor colors[kMaxRandomGradientColors];
255 SkScalar stopsArray[kMaxRandomGradientColors]; 252 SkScalar stopsArray[kMaxRandomGradientColors];
256 SkScalar* stops = stopsArray; 253 SkScalar* stops = stopsArray;
257 SkShader::TileMode tmIgnored; 254 SkShader::TileMode tmIgnored;
258 int colorCount = RandomGradientParams(random, colors, &stops, &tmIgnored); 255 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tmIgnored );
259 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateSweep(center.fX, cente r.fY, 256 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateSweep(center.fX, cente r.fY,
260 colors, stops, c olorCount)); 257 colors, stops, c olorCount));
261 SkPaint paint; 258 SkPaint paint;
262 GrFragmentProcessor* fp; 259 GrFragmentProcessor* fp;
263 GrColor paintColor; 260 GrColor paintColor;
264 GrPaint grPaint; 261 SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
265 SkAssertResult(shader->asFragmentProcessor(context, paint, 262 GrTest::TestMatrix(d->fRandom), N ULL,
266 GrTest::TestMatrix(random), NULL, 263 &paintColor, d->fShaderDataManage r, &fp));
267 &paintColor, grPaint.getShaderDat aManager(), &fp));
268 return fp; 264 return fp;
269 } 265 }
270 266
271 ///////////////////////////////////////////////////////////////////// 267 /////////////////////////////////////////////////////////////////////
272 268
273 void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder, 269 void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder,
274 const GrFragmentProcessor& fp, 270 const GrFragmentProcessor& fp,
275 const char* outputColor, 271 const char* outputColor,
276 const char* inputColor, 272 const char* inputColor,
277 const TransformedCoordsArray& coords, 273 const TransformedCoordsArray& coords,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 str->appendScalar(fCenter.fX); 336 str->appendScalar(fCenter.fX);
341 str->append(", "); 337 str->append(", ");
342 str->appendScalar(fCenter.fY); 338 str->appendScalar(fCenter.fY);
343 str->append(") "); 339 str->append(") ");
344 340
345 this->INHERITED::toString(str); 341 this->INHERITED::toString(str);
346 342
347 str->append(")"); 343 str->append(")");
348 } 344 }
349 #endif 345 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698