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

Side by Side Diff: src/core/SkXfermode.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 | « no previous file | src/effects/SkArithmeticMode.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 9
10 #include "SkXfermode.h" 10 #include "SkXfermode.h"
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 virtual void emitCode(GrGLShaderBuilder* builder, 941 virtual void emitCode(GrGLShaderBuilder* builder,
942 const GrDrawEffect& drawEffect, 942 const GrDrawEffect& drawEffect,
943 EffectKey key, 943 EffectKey key,
944 const char* outputColor, 944 const char* outputColor,
945 const char* inputColor, 945 const char* inputColor,
946 const TextureSamplerArray& samplers) SK_OVERRIDE { 946 const TextureSamplerArray& samplers) SK_OVERRIDE {
947 SkXfermode::Mode mode = drawEffect.castEffect<XferEffect>().mode(); 947 SkXfermode::Mode mode = drawEffect.castEffect<XferEffect>().mode();
948 const GrTexture* backgroundTex = drawEffect.castEffect<XferEffect>() .backgroundAccess().getTexture(); 948 const GrTexture* backgroundTex = drawEffect.castEffect<XferEffect>() .backgroundAccess().getTexture();
949 const char* dstColor; 949 const char* dstColor;
950 if (backgroundTex) { 950 if (backgroundTex) {
951 const char* bgCoords; 951 SkString bgCoords;
952 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder , key, &bgCoords, NULL, "BG"); 952 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder , key, &bgCoords, NULL, "BG");
953 dstColor = "bgColor"; 953 dstColor = "bgColor";
954 builder->fsCodeAppendf("\t\tvec4 %s = ", dstColor); 954 builder->fsCodeAppendf("\t\tvec4 %s = ", dstColor);
955 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_Shader Type, 955 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_Shader Type,
956 samplers[0], 956 samplers[0],
957 bgCoords, 957 bgCoords.c_str(),
958 bgCoordsType); 958 bgCoordsType);
959 builder->fsCodeAppendf(";\n"); 959 builder->fsCodeAppendf(";\n");
960 } else { 960 } else {
961 dstColor = builder->dstColor(); 961 dstColor = builder->dstColor();
962 } 962 }
963 SkASSERT(NULL != dstColor); 963 SkASSERT(NULL != dstColor);
964 964
965 // We don't try to optimize for this case at all 965 // We don't try to optimize for this case at all
966 if (NULL == inputColor) { 966 if (NULL == inputColor) {
967 builder->fsCodeAppendf("\t\tconst vec4 ones = %s;\n", GrGLSLOnes Vecf(4)); 967 builder->fsCodeAppendf("\t\tconst vec4 ones = %s;\n", GrGLSLOnes Vecf(4));
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 return proc16; 1971 return proc16;
1972 } 1972 }
1973 1973
1974 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1974 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1975 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1975 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1976 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) 1976 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode)
1977 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) 1977 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode)
1978 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) 1978 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode)
1979 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) 1979 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode)
1980 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1980 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkArithmeticMode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698