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

Side by Side Diff: src/effects/SkArithmeticMode.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/core/SkXfermode.cpp ('k') | src/effects/SkBicubicImageFilter.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 2013 Google Inc. 2 * Copyright 2013 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 "SkArithmeticMode.h" 8 #include "SkArithmeticMode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 void GrGLArithmeticEffect::emitCode(GrGLShaderBuilder* builder, 344 void GrGLArithmeticEffect::emitCode(GrGLShaderBuilder* builder,
345 const GrDrawEffect& drawEffect, 345 const GrDrawEffect& drawEffect,
346 EffectKey key, 346 EffectKey key,
347 const char* outputColor, 347 const char* outputColor,
348 const char* inputColor, 348 const char* inputColor,
349 const TextureSamplerArray& samplers) { 349 const TextureSamplerArray& samplers) {
350 350
351 GrTexture* backgroundTex = drawEffect.castEffect<GrArithmeticEffect>().backg roundTexture(); 351 GrTexture* backgroundTex = drawEffect.castEffect<GrArithmeticEffect>().backg roundTexture();
352 const char* dstColor; 352 const char* dstColor;
353 if (backgroundTex) { 353 if (backgroundTex) {
354 const char* bgCoords; 354 SkString bgCoords;
355 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder, key, & bgCoords, NULL, "BG"); 355 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder, key, & bgCoords, NULL, "BG");
356 builder->fsCodeAppend("\t\tvec4 bgColor = "); 356 builder->fsCodeAppend("\t\tvec4 bgColor = ");
357 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, 357 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType,
358 samplers[0], 358 samplers[0],
359 bgCoords, 359 bgCoords.c_str(),
360 bgCoordsType); 360 bgCoordsType);
361 builder->fsCodeAppendf(";\n"); 361 builder->fsCodeAppendf(";\n");
362 dstColor = "bgColor"; 362 dstColor = "bgColor";
363 } else { 363 } else {
364 dstColor = builder->dstColor(); 364 dstColor = builder->dstColor();
365 } 365 }
366 366
367 SkASSERT(NULL != dstColor); 367 SkASSERT(NULL != dstColor);
368 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, 368 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType,
369 kVec4f_GrSLType, "k"); 369 kVec4f_GrSLType, "k");
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 background); 446 background);
447 } 447 }
448 return true; 448 return true;
449 } 449 }
450 450
451 #endif 451 #endif
452 452
453 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 453 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
454 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 454 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
455 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 455 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkXfermode.cpp ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698