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

Side by Side Diff: src/gpu/effects/GrSimpleTextureEffect.cpp

Issue 385713005: Allow GrGLEffects to produce variable length keys. (Closed) Base URL: https://skia.googlesource.com/skia.git@key
Patch Set: rebase Created 6 years, 5 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
« no previous file with comments | « src/gpu/effects/GrRRectEffect.cpp ('k') | src/gpu/effects/GrTextureDomain.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 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 #include "GrSimpleTextureEffect.h" 8 #include "GrSimpleTextureEffect.h"
9 #include "gl/GrGLEffect.h" 9 #include "gl/GrGLEffect.h"
10 #include "gl/GrGLShaderBuilder.h" 10 #include "gl/GrGLShaderBuilder.h"
11 #include "gl/GrGLSL.h" 11 #include "gl/GrGLSL.h"
12 #include "gl/GrGLTexture.h" 12 #include "gl/GrGLTexture.h"
13 #include "GrTBackendEffectFactory.h" 13 #include "GrTBackendEffectFactory.h"
14 #include "GrTexture.h" 14 #include "GrTexture.h"
15 15
16 class GrGLSimpleTextureEffect : public GrGLEffect { 16 class GrGLSimpleTextureEffect : public GrGLEffect {
17 public: 17 public:
18 GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrDrawE ffect&) 18 GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrDrawE ffect&)
19 : INHERITED (factory) { 19 : INHERITED (factory) {
20 } 20 }
21 21
22 virtual void emitCode(GrGLShaderBuilder* builder, 22 virtual void emitCode(GrGLShaderBuilder* builder,
23 const GrDrawEffect& drawEffect, 23 const GrDrawEffect& drawEffect,
24 EffectKey key, 24 const GrEffectKey& key,
25 const char* outputColor, 25 const char* outputColor,
26 const char* inputColor, 26 const char* inputColor,
27 const TransformedCoordsArray& coords, 27 const TransformedCoordsArray& coords,
28 const TextureSamplerArray& samplers) SK_OVERRIDE { 28 const TextureSamplerArray& samplers) SK_OVERRIDE {
29 builder->fsCodeAppendf("\t%s = ", outputColor); 29 builder->fsCodeAppendf("\t%s = ", outputColor);
30 builder->fsAppendTextureLookupAndModulate(inputColor, 30 builder->fsAppendTextureLookupAndModulate(inputColor,
31 samplers[0], 31 samplers[0],
32 coords[0].c_str(), 32 coords[0].c_str(),
33 coords[0].type()); 33 coords[0].type());
34 builder->fsCodeAppend(";\n"); 34 builder->fsCodeAppend(";\n");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 static const GrCoordSet kCoordSets[] = { 73 static const GrCoordSet kCoordSets[] = {
74 kLocal_GrCoordSet, 74 kLocal_GrCoordSet,
75 kPosition_GrCoordSet 75 kPosition_GrCoordSet
76 }; 76 };
77 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord Sets))]; 77 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord Sets))];
78 78
79 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); 79 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
80 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); 80 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet);
81 } 81 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrRRectEffect.cpp ('k') | src/gpu/effects/GrTextureDomain.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698