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

Side by Side Diff: src/effects/gradients/SkRadialGradient.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
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.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 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 "SkRadialGradient.h" 9 #include "SkRadialGradient.h"
10 #include "SkRadialGradient_Table.h" 10 #include "SkRadialGradient_Table.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 494
495 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 495 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
496 496
497 typedef GrGradientEffect INHERITED; 497 typedef GrGradientEffect INHERITED;
498 }; 498 };
499 499
500 ///////////////////////////////////////////////////////////////////// 500 /////////////////////////////////////////////////////////////////////
501 501
502 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRadialGradient); 502 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrRadialGradient);
503 503
504 GrFragmentProcessor* GrRadialGradient::TestCreate(SkRandom* random, 504 GrFragmentProcessor* GrRadialGradient::TestCreate(GrProcessorTestData* d) {
505 GrContext* context, 505 SkPoint center = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
506 const GrCaps&, 506 SkScalar radius = d->fRandom->nextUScalar1();
507 GrTexture**) {
508 SkPoint center = {random->nextUScalar1(), random->nextUScalar1()};
509 SkScalar radius = random->nextUScalar1();
510 507
511 SkColor colors[kMaxRandomGradientColors]; 508 SkColor colors[kMaxRandomGradientColors];
512 SkScalar stopsArray[kMaxRandomGradientColors]; 509 SkScalar stopsArray[kMaxRandomGradientColors];
513 SkScalar* stops = stopsArray; 510 SkScalar* stops = stopsArray;
514 SkShader::TileMode tm; 511 SkShader::TileMode tm;
515 int colorCount = RandomGradientParams(random, colors, &stops, &tm); 512 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm);
516 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center, radius, 513 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center, radius,
517 colors, stops, colorCount, 514 colors, stops, colorCount,
518 tm)); 515 tm));
519 SkPaint paint; 516 SkPaint paint;
520 GrColor paintColor; 517 GrColor paintColor;
521 GrFragmentProcessor* fp; 518 GrFragmentProcessor* fp;
522 GrPaint grPaint; 519 SkAssertResult(shader->asFragmentProcessor(d->fContext, paint,
523 SkAssertResult(shader->asFragmentProcessor(context, paint, 520 GrTest::TestMatrix(d->fRandom), N ULL,
524 GrTest::TestMatrix(random), NULL, 521 &paintColor, d->fShaderDataManage r, &fp));
525 &paintColor, grPaint.getShaderDat aManager(), &fp));
526 return fp; 522 return fp;
527 } 523 }
528 524
529 ///////////////////////////////////////////////////////////////////// 525 /////////////////////////////////////////////////////////////////////
530 526
531 void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder, 527 void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder,
532 const GrFragmentProcessor& fp, 528 const GrFragmentProcessor& fp,
533 const char* outputColor, 529 const char* outputColor,
534 const char* inputColor, 530 const char* inputColor,
535 const TransformedCoordsArray& coords, 531 const TransformedCoordsArray& coords,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 str->appendScalar(fCenter.fY); 587 str->appendScalar(fCenter.fY);
592 str->append(") radius: "); 588 str->append(") radius: ");
593 str->appendScalar(fRadius); 589 str->appendScalar(fRadius);
594 str->append(" "); 590 str->append(" ");
595 591
596 this->INHERITED::toString(str); 592 this->INHERITED::toString(str);
597 593
598 str->append(")"); 594 str->append(")");
599 } 595 }
600 #endif 596 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.cpp ('k') | src/effects/gradients/SkSweepGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698