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

Side by Side Diff: src/effects/gradients/SkLinearGradient.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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkLinearGradient.h" 8 #include "SkLinearGradient.h"
9 9
10 static const float kInv255Float = 1.0f / 255; 10 static const float kInv255Float = 1.0f / 255;
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 *dstC++ = cache[toggle + index]; 508 *dstC++ = cache[toggle + index];
509 toggle = next_dither_toggle16(toggle); 509 toggle = next_dither_toggle16(toggle);
510 510
511 dstX += SK_Scalar1; 511 dstX += SK_Scalar1;
512 } while (--count != 0); 512 } while (--count != 0);
513 } 513 }
514 } 514 }
515 515
516 #if SK_SUPPORT_GPU 516 #if SK_SUPPORT_GPU
517 517
518 #include "gl/builders/GrGLProgramBuilder.h" 518 #include "glsl/GrGLSLCaps.h"
519 #include "glsl/GrGLSLFragmentShaderBuilder.h"
519 #include "SkGr.h" 520 #include "SkGr.h"
520 521
521 ///////////////////////////////////////////////////////////////////// 522 /////////////////////////////////////////////////////////////////////
522 523
523 class GrGLLinearGradient : public GrGLGradientEffect { 524 class GrGLLinearGradient : public GrGLGradientEffect {
524 public: 525 public:
525 526
526 GrGLLinearGradient(const GrProcessor&) {} 527 GrGLLinearGradient(const GrProcessor&) {}
527 528
528 virtual ~GrGLLinearGradient() { } 529 virtual ~GrGLLinearGradient() { }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, 597 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
597 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality); 598 GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
598 GrAlwaysAssert(fp); 599 GrAlwaysAssert(fp);
599 return fp; 600 return fp;
600 } 601 }
601 602
602 ///////////////////////////////////////////////////////////////////// 603 /////////////////////////////////////////////////////////////////////
603 604
604 void GrGLLinearGradient::emitCode(EmitArgs& args) { 605 void GrGLLinearGradient::emitCode(EmitArgs& args) {
605 const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>(); 606 const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>();
606 this->emitUniforms(args.fBuilder, ge); 607 this->emitUniforms(args.fUniformHandler, ge);
607 SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); 608 SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0);
608 t.append(".x"); 609 t.append(".x");
609 this->emitColor(args.fBuilder, 610 this->emitColor(args.fFragBuilder,
610 args.fFragBuilder, 611 args.fUniformHandler,
611 args.fGLSLCaps, 612 args.fGLSLCaps,
612 ge, t.c_str(), 613 ge, t.c_str(),
613 args.fOutputColor, 614 args.fOutputColor,
614 args.fInputColor, 615 args.fInputColor,
615 args.fSamplers); 616 args.fSamplers);
616 } 617 }
617 618
618 ///////////////////////////////////////////////////////////////////// 619 /////////////////////////////////////////////////////////////////////
619 620
620 const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor( 621 const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor(
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 } 921 }
921 } else { 922 } else {
922 if (fApplyAlphaAfterInterp) { 923 if (fApplyAlphaAfterInterp) {
923 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r); 924 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r);
924 } else { 925 } else {
925 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er); 926 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er);
926 } 927 }
927 } 928 }
928 } 929 }
929 930
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698