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

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

Issue 1490283004: Create GLSLUniformHandler class for gpu backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up public api of uniformhandler Created 5 years 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 dstX += SK_Scalar1; 408 dstX += SK_Scalar1;
409 } while (--count != 0); 409 } while (--count != 0);
410 } 410 }
411 } 411 }
412 412
413 ///////////////////////////////////////////////////////////////////// 413 /////////////////////////////////////////////////////////////////////
414 414
415 #if SK_SUPPORT_GPU 415 #if SK_SUPPORT_GPU
416 416
417 #include "SkGr.h" 417 #include "SkGr.h"
418 #include "gl/builders/GrGLProgramBuilder.h" 418 #include "glsl/GrGLSLCaps.h"
419 #include "glsl/GrGLSLFragmentShaderBuilder.h"
419 420
420 class GrGLRadialGradient : public GrGLGradientEffect { 421 class GrGLRadialGradient : public GrGLGradientEffect {
421 public: 422 public:
422 423
423 GrGLRadialGradient(const GrProcessor&) {} 424 GrGLRadialGradient(const GrProcessor&) {}
424 virtual ~GrGLRadialGradient() { } 425 virtual ~GrGLRadialGradient() { }
425 426
426 virtual void emitCode(EmitArgs&) override; 427 virtual void emitCode(EmitArgs&) override;
427 428
428 static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProces sorKeyBuilder* b) { 429 static void GenKey(const GrProcessor& processor, const GrGLSLCaps&, GrProces sorKeyBuilder* b) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, 493 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
493 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); 494 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
494 GrAlwaysAssert(fp); 495 GrAlwaysAssert(fp);
495 return fp; 496 return fp;
496 } 497 }
497 498
498 ///////////////////////////////////////////////////////////////////// 499 /////////////////////////////////////////////////////////////////////
499 500
500 void GrGLRadialGradient::emitCode(EmitArgs& args) { 501 void GrGLRadialGradient::emitCode(EmitArgs& args) {
501 const GrRadialGradient& ge = args.fFp.cast<GrRadialGradient>(); 502 const GrRadialGradient& ge = args.fFp.cast<GrRadialGradient>();
502 this->emitUniforms(args.fBuilder, ge); 503 this->emitUniforms(args.fUniformHandler, ge);
503 SkString t("length("); 504 SkString t("length(");
504 t.append(args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0)); 505 t.append(args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0));
505 t.append(")"); 506 t.append(")");
506 this->emitColor(args.fBuilder, 507 this->emitColor(args.fFragBuilder,
507 args.fFragBuilder, 508 args.fUniformHandler,
508 args.fGLSLCaps, 509 args.fGLSLCaps,
509 ge, t.c_str(), 510 ge, t.c_str(),
510 args.fOutputColor, 511 args.fOutputColor,
511 args.fInputColor, 512 args.fInputColor,
512 args.fSamplers); 513 args.fSamplers);
513 } 514 }
514 515
515 ///////////////////////////////////////////////////////////////////// 516 /////////////////////////////////////////////////////////////////////
516 517
517 const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor( 518 const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 str->appendScalar(fCenter.fY); 551 str->appendScalar(fCenter.fY);
551 str->append(") radius: "); 552 str->append(") radius: ");
552 str->appendScalar(fRadius); 553 str->appendScalar(fRadius);
553 str->append(" "); 554 str->append(" ");
554 555
555 this->INHERITED::toString(str); 556 this->INHERITED::toString(str);
556 557
557 str->append(")"); 558 str->append(")");
558 } 559 }
559 #endif 560 #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