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

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

Issue 22854005: GPU Gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Moved mode toggling back to base class, fixed EffectKey masking. Created 7 years, 4 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 | Annotate | Revision Log
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 "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 } 465 }
466 466
467 ///////////////////////////////////////////////////////////////////// 467 /////////////////////////////////////////////////////////////////////
468 468
469 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder, 469 void GrGLSweepGradient::emitCode(GrGLShaderBuilder* builder,
470 const GrDrawEffect&, 470 const GrDrawEffect&,
471 EffectKey key, 471 EffectKey key,
472 const char* outputColor, 472 const char* outputColor,
473 const char* inputColor, 473 const char* inputColor,
474 const TextureSamplerArray& samplers) { 474 const TextureSamplerArray& samplers) {
475 this->emitYCoordUniform(builder); 475 this->emitUniforms(builder, key);
476 const char* coords; 476 const char* coords;
477 this->setupMatrix(builder, key, &coords); 477 this->setupMatrix(builder, key, &coords);
478 SkString t; 478 SkString t;
479 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords, coords); 479 t.printf("atan(- %s.y, - %s.x) * 0.1591549430918 + 0.5", coords, coords);
480 this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[ 0]); 480 this->emitColor(builder, t.c_str(), key,
481 outputColor, inputColor, samplers);
481 } 482 }
482 483
483 ///////////////////////////////////////////////////////////////////// 484 /////////////////////////////////////////////////////////////////////
484 485
485 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co nst { 486 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co nst {
486 SkMatrix matrix; 487 SkMatrix matrix;
487 if (!this->getLocalMatrix().invert(&matrix)) { 488 if (!this->getLocalMatrix().invert(&matrix)) {
488 return NULL; 489 return NULL;
489 } 490 }
490 matrix.postConcat(fPtsToUnit); 491 matrix.postConcat(fPtsToUnit);
(...skipping 17 matching lines...) Expand all
508 str->appendScalar(fCenter.fX); 509 str->appendScalar(fCenter.fX);
509 str->append(", "); 510 str->append(", ");
510 str->appendScalar(fCenter.fY); 511 str->appendScalar(fCenter.fY);
511 str->append(") "); 512 str->append(") ");
512 513
513 this->INHERITED::toString(str); 514 this->INHERITED::toString(str);
514 515
515 str->append(")"); 516 str->append(")");
516 } 517 }
517 #endif 518 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698