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

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

Issue 23706003: Fix case where GrGLEffectMatrix gives back a dangling ptr for the coords var name. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Rob's comments Created 7 years, 3 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->emitYCoordUniform(builder);
476 const char* coords; 476 SkString 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.c_str(), coo rds.c_str());
480 this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[ 0]); 480 this->emitColorLookup(builder, t.c_str(), outputColor, inputColor, samplers[ 0]);
481 } 481 }
482 482
483 ///////////////////////////////////////////////////////////////////// 483 /////////////////////////////////////////////////////////////////////
484 484
485 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co nst { 485 GrEffectRef* SkSweepGradient::asNewEffect(GrContext* context, const SkPaint&) co nst {
486 SkMatrix matrix; 486 SkMatrix matrix;
487 if (!this->getLocalMatrix().invert(&matrix)) { 487 if (!this->getLocalMatrix().invert(&matrix)) {
488 return NULL; 488 return NULL;
489 } 489 }
(...skipping 18 matching lines...) Expand all
508 str->appendScalar(fCenter.fX); 508 str->appendScalar(fCenter.fX);
509 str->append(", "); 509 str->append(", ");
510 str->appendScalar(fCenter.fY); 510 str->appendScalar(fCenter.fY);
511 str->append(") "); 511 str->append(") ");
512 512
513 this->INHERITED::toString(str); 513 this->INHERITED::toString(str);
514 514
515 str->append(")"); 515 str->append(")");
516 } 516 }
517 #endif 517 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkRadialGradient.cpp ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698