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

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

Issue 1109863004: Use GLSLCaps for creating processor keys and GLSL-specific programs (Closed) Base URL: https://chromium.googlesource.com/skia@master
Patch Set: Created 5 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
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 "SkTwoPointRadialGradient.h" 9 #include "SkTwoPointRadialGradient.h"
10 10
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 virtual ~GrGLRadial2Gradient() { } 401 virtual ~GrGLRadial2Gradient() { }
402 402
403 virtual void emitCode(GrGLFPBuilder*, 403 virtual void emitCode(GrGLFPBuilder*,
404 const GrFragmentProcessor&, 404 const GrFragmentProcessor&,
405 const char* outputColor, 405 const char* outputColor,
406 const char* inputColor, 406 const char* inputColor,
407 const TransformedCoordsArray&, 407 const TransformedCoordsArray&,
408 const TextureSamplerArray&) override; 408 const TextureSamplerArray&) override;
409 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; 409 void setData(const GrGLProgramDataManager&, const GrProcessor&) override;
410 410
411 static void GenKey(const GrProcessor&, const GrGLCaps& caps, GrProcessorKeyB uilder* b); 411 static void GenKey(const GrProcessor&, const GrGLSLCaps& caps, GrProcessorKe yBuilder* b);
412 412
413 protected: 413 protected:
414 414
415 UniformHandle fParamUni; 415 UniformHandle fParamUni;
416 416
417 const char* fVSVaryingName; 417 const char* fVSVaryingName;
418 const char* fFSVaryingName; 418 const char* fFSVaryingName;
419 419
420 bool fIsDegenerate; 420 bool fIsDegenerate;
421 421
(...skipping 20 matching lines...) Expand all
442 const SkTwoPointRadialGradient& shader, 442 const SkTwoPointRadialGradient& shader,
443 const SkMatrix& matrix, 443 const SkMatrix& matrix,
444 SkShader::TileMode tm) { 444 SkShader::TileMode tm) {
445 return SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm)); 445 return SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm));
446 } 446 }
447 447
448 virtual ~GrRadial2Gradient() { } 448 virtual ~GrRadial2Gradient() { }
449 449
450 const char* name() const override { return "Two-Point Radial Gradient"; } 450 const char* name() const override { return "Two-Point Radial Gradient"; }
451 451
452 virtual void getGLProcessorKey(const GrGLCaps& caps, 452 virtual void getGLProcessorKey(const GrGLSLCaps& caps,
453 GrProcessorKeyBuilder* b) const override { 453 GrProcessorKeyBuilder* b) const override {
454 GrGLRadial2Gradient::GenKey(*this, caps, b); 454 GrGLRadial2Gradient::GenKey(*this, caps, b);
455 } 455 }
456 456
457 GrGLFragmentProcessor* createGLInstance() const override { 457 GrGLFragmentProcessor* createGLInstance() const override {
458 return SkNEW_ARGS(GrGLRadial2Gradient, (*this)); 458 return SkNEW_ARGS(GrGLRadial2Gradient, (*this));
459 } 459 }
460 460
461 // The radial gradient parameters can collapse to a linear (instead of quadr atic) equation. 461 // The radial gradient parameters can collapse to a linear (instead of quadr atic) equation.
462 bool isDegenerate() const { return SK_Scalar1 == fCenterX1; } 462 bool isDegenerate() const { return SK_Scalar1 == fCenterX1; }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 }; 662 };
663 663
664 pdman.set1fv(fParamUni, 6, values); 664 pdman.set1fv(fParamUni, 6, values);
665 fCachedCenter = centerX1; 665 fCachedCenter = centerX1;
666 fCachedRadius = radius0; 666 fCachedRadius = radius0;
667 fCachedPosRoot = data.isPosRoot(); 667 fCachedPosRoot = data.isPosRoot();
668 } 668 }
669 } 669 }
670 670
671 void GrGLRadial2Gradient::GenKey(const GrProcessor& processor, 671 void GrGLRadial2Gradient::GenKey(const GrProcessor& processor,
672 const GrGLCaps&, GrProcessorKeyBuilder* b) { 672 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
673 uint32_t* key = b->add32n(2); 673 uint32_t* key = b->add32n(2);
674 key[0] = GenBaseGradientKey(processor); 674 key[0] = GenBaseGradientKey(processor);
675 key[1] = processor.cast<GrRadial2Gradient>().isDegenerate(); 675 key[1] = processor.cast<GrRadial2Gradient>().isDegenerate();
676 } 676 }
677 677
678 ///////////////////////////////////////////////////////////////////// 678 /////////////////////////////////////////////////////////////////////
679 679
680 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext* context, const SkP aint& paint, 680 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext* context, const SkP aint& paint,
681 const SkMatrix&, 681 const SkMatrix&,
682 const SkMatrix* localMatrix, GrColor* paintColor, 682 const SkMatrix* localMatrix, GrColor* paintColor,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 #else 715 #else
716 716
717 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, c onst SkMatrix&, 717 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, c onst SkMatrix&,
718 const SkMatrix*, 718 const SkMatrix*,
719 GrColor*, GrFragmentProcessor **) const { 719 GrColor*, GrFragmentProcessor **) const {
720 SkDEBUGFAIL("Should not call in GPU-less build"); 720 SkDEBUGFAIL("Should not call in GPU-less build");
721 return false; 721 return false;
722 } 722 }
723 723
724 #endif 724 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698