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

Side by Side Diff: src/effects/gradients/SkGradientShader.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
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkGradientShaderPriv.h" 8 #include "SkGradientShaderPriv.h"
9 #include "SkLinearGradient.h" 9 #include "SkLinearGradient.h"
10 #include "SkRadialGradient.h" 10 #include "SkRadialGradient.h"
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 } 850 }
851 851
852 GrGLEffect::EffectKey GrGLGradientEffect::GenMatrixKey(const GrDrawEffect& drawE ffect) { 852 GrGLEffect::EffectKey GrGLGradientEffect::GenMatrixKey(const GrDrawEffect& drawE ffect) {
853 const GrGradientEffect& e = drawEffect.castEffect<GrGradientEffect>(); 853 const GrGradientEffect& e = drawEffect.castEffect<GrGradientEffect>();
854 const GrTexture* texture = e.texture(0); 854 const GrTexture* texture = e.texture(0);
855 return GrGLEffectMatrix::GenKey(e.getMatrix(), drawEffect, kCoordsType, text ure); 855 return GrGLEffectMatrix::GenKey(e.getMatrix(), drawEffect, kCoordsType, text ure);
856 } 856 }
857 857
858 void GrGLGradientEffect::setupMatrix(GrGLShaderBuilder* builder, 858 void GrGLGradientEffect::setupMatrix(GrGLShaderBuilder* builder,
859 EffectKey key, 859 EffectKey key,
860 const char** fsCoordName, 860 SkString* fsCoordName,
861 const char** vsVaryingName, 861 SkString* vsVaryingName,
862 GrSLType* vsVaryingType) { 862 GrSLType* vsVaryingType) {
863 fEffectMatrix.emitCodeMakeFSCoords2D(builder, 863 fEffectMatrix.emitCodeMakeFSCoords2D(builder,
864 key & kMatrixKeyMask, 864 key & kMatrixKeyMask,
865 fsCoordName, 865 fsCoordName,
866 vsVaryingName, 866 vsVaryingName,
867 vsVaryingType); 867 vsVaryingType);
868 } 868 }
869 869
870 void GrGLGradientEffect::emitColorLookup(GrGLShaderBuilder* builder, 870 void GrGLGradientEffect::emitColorLookup(GrGLShaderBuilder* builder,
871 const char* gradientTValue, 871 const char* gradientTValue,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 (*stops)[i] = stop; 976 (*stops)[i] = stop;
977 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 977 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
978 } 978 }
979 } 979 }
980 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 980 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
981 981
982 return outColors; 982 return outColors;
983 } 983 }
984 984
985 #endif 985 #endif
OLDNEW
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShaderPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698