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

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

Issue 761643002: remove one place we read from gpu key in effects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 /* 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 , fFSVaryingName(NULL) 561 , fFSVaryingName(NULL)
562 , fCachedCenter(SK_ScalarMax) 562 , fCachedCenter(SK_ScalarMax)
563 , fCachedRadius(-SK_ScalarMax) 563 , fCachedRadius(-SK_ScalarMax)
564 , fCachedPosRoot(0) { 564 , fCachedPosRoot(0) {
565 565
566 const GrRadial2Gradient& data = processor.cast<GrRadial2Gradient>(); 566 const GrRadial2Gradient& data = processor.cast<GrRadial2Gradient>();
567 fIsDegenerate = data.isDegenerate(); 567 fIsDegenerate = data.isDegenerate();
568 } 568 }
569 569
570 void GrGLRadial2Gradient::emitCode(GrGLFPBuilder* builder, 570 void GrGLRadial2Gradient::emitCode(GrGLFPBuilder* builder,
571 const GrFragmentProcessor&, 571 const GrFragmentProcessor& fp,
572 const GrProcessorKey& key, 572 const GrProcessorKey& key,
573 const char* outputColor, 573 const char* outputColor,
574 const char* inputColor, 574 const char* inputColor,
575 const TransformedCoordsArray& coords, 575 const TransformedCoordsArray& coords,
576 const TextureSamplerArray& samplers) { 576 const TextureSamplerArray& samplers) {
577 uint32_t baseKey = key.get32(0); 577 const GrGradientEffect& ge = fp.cast<GrGradientEffect>();
578 this->emitUniforms(builder, baseKey); 578 this->emitUniforms(builder, ge);
579 fParamUni = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibilit y, 579 fParamUni = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibilit y,
580 kFloat_GrSLType, "Radial2FSParams", 6); 580 kFloat_GrSLType, "Radial2FSParams", 6);
581 581
582 SkString cName("c"); 582 SkString cName("c");
583 SkString ac4Name("ac4"); 583 SkString ac4Name("ac4");
584 SkString rootName("root"); 584 SkString rootName("root");
585 SkString t; 585 SkString t;
586 SkString p0; 586 SkString p0;
587 SkString p1; 587 SkString p1;
588 SkString p2; 588 SkString p2;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 ac4Name.c_str()); 631 ac4Name.c_str());
632 632
633 // t is: (-b + params[5] * sqrt(b^2-4ac)) * params[1] 633 // t is: (-b + params[5] * sqrt(b^2-4ac)) * params[1]
634 t.printf("(-%s + %s * %s) * %s", bVar.c_str(), p5.c_str(), 634 t.printf("(-%s + %s * %s) * %s", bVar.c_str(), p5.c_str(),
635 rootName.c_str(), p1.c_str()); 635 rootName.c_str(), p1.c_str());
636 } else { 636 } else {
637 // t is: -c/b 637 // t is: -c/b
638 t.printf("-%s / %s", cName.c_str(), bVar.c_str()); 638 t.printf("-%s / %s", cName.c_str(), bVar.c_str());
639 } 639 }
640 640
641 this->emitColor(builder, t.c_str(), baseKey, outputColor, inputColor, sample rs); 641 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers);
642 } 642 }
643 643
644 void GrGLRadial2Gradient::setData(const GrGLProgramDataManager& pdman, 644 void GrGLRadial2Gradient::setData(const GrGLProgramDataManager& pdman,
645 const GrProcessor& processor) { 645 const GrProcessor& processor) {
646 INHERITED::setData(pdman, processor); 646 INHERITED::setData(pdman, processor);
647 const GrRadial2Gradient& data = processor.cast<GrRadial2Gradient>(); 647 const GrRadial2Gradient& data = processor.cast<GrRadial2Gradient>();
648 SkASSERT(data.isDegenerate() == fIsDegenerate); 648 SkASSERT(data.isDegenerate() == fIsDegenerate);
649 SkScalar centerX1 = data.center(); 649 SkScalar centerX1 = data.center();
650 SkScalar radius0 = data.radius(); 650 SkScalar radius0 = data.radius();
651 if (fCachedCenter != centerX1 || 651 if (fCachedCenter != centerX1 ||
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 720
721 #else 721 #else
722 722
723 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, c onst SkMatrix*, 723 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, c onst SkMatrix*,
724 GrColor*, GrFragmentProcessor **) const { 724 GrColor*, GrFragmentProcessor **) const {
725 SkDEBUGFAIL("Should not call in GPU-less build"); 725 SkDEBUGFAIL("Should not call in GPU-less build");
726 return false; 726 return false;
727 } 727 }
728 728
729 #endif 729 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698