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

Side by Side Diff: src/effects/gradients/SkLinearGradient.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 * 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 inline int repeat_bits(int x, const int bits) { 10 static inline int repeat_bits(int x, const int bits) {
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 SkPaint paint; 544 SkPaint paint;
545 GrColor paintColor; 545 GrColor paintColor;
546 GrFragmentProcessor* fp; 546 GrFragmentProcessor* fp;
547 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor , &fp)); 547 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor , &fp));
548 return fp; 548 return fp;
549 } 549 }
550 550
551 ///////////////////////////////////////////////////////////////////// 551 /////////////////////////////////////////////////////////////////////
552 552
553 void GrGLLinearGradient::emitCode(GrGLFPBuilder* builder, 553 void GrGLLinearGradient::emitCode(GrGLFPBuilder* builder,
554 const GrFragmentProcessor&, 554 const GrFragmentProcessor& fp,
555 const GrProcessorKey& key, 555 const GrProcessorKey& key,
556 const char* outputColor, 556 const char* outputColor,
557 const char* inputColor, 557 const char* inputColor,
558 const TransformedCoordsArray& coords, 558 const TransformedCoordsArray& coords,
559 const TextureSamplerArray& samplers) { 559 const TextureSamplerArray& samplers) {
560 uint32_t baseKey = key.get32(0); 560 const GrGradientEffect& ge = fp.cast<GrGradientEffect>();
561 this->emitUniforms(builder, baseKey); 561 this->emitUniforms(builder, ge);
562 SkString t = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0 ); 562 SkString t = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0 );
563 t.append(".x"); 563 t.append(".x");
564 this->emitColor(builder, t.c_str(), baseKey, outputColor, inputColor, sample rs); 564 this->emitColor(builder, ge, t.c_str(), outputColor, inputColor, samplers);
565 } 565 }
566 566
567 ///////////////////////////////////////////////////////////////////// 567 /////////////////////////////////////////////////////////////////////
568 568
569 bool SkLinearGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa int, 569 bool SkLinearGradient::asFragmentProcessor(GrContext* context, const SkPaint& pa int,
570 const SkMatrix* localMatrix, GrColor* paintColor, 570 const SkMatrix* localMatrix, GrColor* paintColor,
571 GrFragmentProcessor** fp) const { 571 GrFragmentProcessor** fp) const {
572 SkASSERT(context); 572 SkASSERT(context);
573 573
574 SkMatrix matrix; 574 SkMatrix matrix;
(...skipping 30 matching lines...) Expand all
605 str->append("SkLinearGradient ("); 605 str->append("SkLinearGradient (");
606 606
607 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); 607 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY);
608 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); 608 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY);
609 609
610 this->INHERITED::toString(str); 610 this->INHERITED::toString(str);
611 611
612 str->append(")"); 612 str->append(")");
613 } 613 }
614 #endif 614 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698