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

Side by Side Diff: src/effects/gradients/SkGradientShaderPriv.h

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/gradients/SkGradientShader.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('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 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 #ifndef SkGradientShaderPriv_DEFINED 8 #ifndef SkGradientShaderPriv_DEFINED
9 #define SkGradientShaderPriv_DEFINED 9 #define SkGradientShaderPriv_DEFINED
10 10
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 /** 310 /**
311 * Inserts code to implement the GrGradientEffect's matrix. This should be c alled before a 311 * Inserts code to implement the GrGradientEffect's matrix. This should be c alled before a
312 * subclass emits its own code. The name of the 2D coords is output via fsCo ordName and already 312 * subclass emits its own code. The name of the 2D coords is output via fsCo ordName and already
313 * incorporates any perspective division. The caller can also optionally ret rieve the name of 313 * incorporates any perspective division. The caller can also optionally ret rieve the name of
314 * the varying inserted in the VS and its type, which may be either vec2f or vec3f depending 314 * the varying inserted in the VS and its type, which may be either vec2f or vec3f depending
315 * upon whether the matrix has perspective or not. It is not necessary to ma sk the key before 315 * upon whether the matrix has perspective or not. It is not necessary to ma sk the key before
316 * calling. 316 * calling.
317 */ 317 */
318 void setupMatrix(GrGLShaderBuilder* builder, 318 void setupMatrix(GrGLShaderBuilder* builder,
319 EffectKey key, 319 EffectKey key,
320 const char** fsCoordName, 320 SkString* fsCoordName,
321 const char** vsVaryingName = NULL, 321 SkString* vsVaryingName = NULL,
322 GrSLType* vsVaryingType = NULL); 322 GrSLType* vsVaryingType = NULL);
323 323
324 // Emits the uniform used as the y-coord to texture samples in derived class es. Subclasses 324 // Emits the uniform used as the y-coord to texture samples in derived class es. Subclasses
325 // should call this method from their emitCode(). 325 // should call this method from their emitCode().
326 void emitYCoordUniform(GrGLShaderBuilder* builder); 326 void emitYCoordUniform(GrGLShaderBuilder* builder);
327 327
328 // emit code that gets a fragment's color from an expression for t; for now this always uses the 328 // emit code that gets a fragment's color from an expression for t; for now this always uses the
329 // texture, but for simpler cases we'll be able to lerp. Subclasses should c all this method from 329 // texture, but for simpler cases we'll be able to lerp. Subclasses should c all this method from
330 // their emitCode(). 330 // their emitCode().
331 void emitColorLookup(GrGLShaderBuilder* builder, 331 void emitColorLookup(GrGLShaderBuilder* builder,
332 const char* gradientTValue, 332 const char* gradientTValue,
333 const char* outputColor, 333 const char* outputColor,
334 const char* inputColor, 334 const char* inputColor,
335 const GrGLShaderBuilder::TextureSampler&); 335 const GrGLShaderBuilder::TextureSampler&);
336 336
337 private: 337 private:
338 static const GrEffect::CoordsType kCoordsType = GrEffect::kLocal_CoordsType; 338 static const GrEffect::CoordsType kCoordsType = GrEffect::kLocal_CoordsType;
339 339
340 SkScalar fCachedYCoord; 340 SkScalar fCachedYCoord;
341 GrGLUniformManager::UniformHandle fFSYUni; 341 GrGLUniformManager::UniformHandle fFSYUni;
342 GrGLEffectMatrix fEffectMatrix; 342 GrGLEffectMatrix fEffectMatrix;
343 343
344 typedef GrGLEffect INHERITED; 344 typedef GrGLEffect INHERITED;
345 }; 345 };
346 346
347 #endif 347 #endif
348 348
349 #endif 349 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShader.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698