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

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

Issue 23471008: Add a requiresVertexShader method to GrGLEffect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: brace formatting issue 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/gpu/effects/GrBezierEffect.cpp ('k') | src/gpu/gl/GrGLEffect.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/GrGLEffectMatrix.h" 10 #include "gl/GrGLEffectMatrix.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& drawEffect) 18 GrGLSimpleTextureEffect(const GrBackendEffectFactory& factory, const GrDrawE ffect& drawEffect)
19 : INHERITED (factory) { 19 : INHERITED (factory) {
20 GrEffect::CoordsType coordsType = 20 GrEffect::CoordsType coordsType =
21 drawEffect.castEffect<GrSimpleTextureEffect>().coordsType(); 21 drawEffect.castEffect<GrSimpleTextureEffect>().coordsType();
22 if (GrEffect::kCustom_CoordsType != coordsType) { 22 if (GrEffect::kCustom_CoordsType != coordsType) {
23 SkNEW_IN_TLAZY(&fEffectMatrix, GrGLEffectMatrix, (coordsType)); 23 SkNEW_IN_TLAZY(&fEffectMatrix, GrGLEffectMatrix, (coordsType));
24 } 24 }
25 } 25 }
26 26
27 virtual bool requiresVertexShader(const GrDrawEffect& drawEffect) const SK_O VERRIDE {
28 const GrSimpleTextureEffect& ste = drawEffect.castEffect<GrSimpleTexture Effect>();
29 return GrEffect::kCustom_CoordsType == ste.coordsType();
30 }
31
27 virtual void emitCode(GrGLShaderBuilder* builder, 32 virtual void emitCode(GrGLShaderBuilder* builder,
28 const GrDrawEffect& drawEffect, 33 const GrDrawEffect& drawEffect,
29 EffectKey key, 34 EffectKey key,
30 const char* outputColor, 35 const char* outputColor,
31 const char* inputColor, 36 const char* inputColor,
32 const TextureSamplerArray& samplers) SK_OVERRIDE { 37 const TextureSamplerArray& samplers) SK_OVERRIDE {
33 const GrSimpleTextureEffect& ste = drawEffect.castEffect<GrSimpleTexture Effect>(); 38 const GrSimpleTextureEffect& ste = drawEffect.castEffect<GrSimpleTexture Effect>();
34 SkString fsCoordName; 39 SkString fsCoordName;
35 GrSLType fsCoordSLType; 40 GrSLType fsCoordSLType;
36 if (GrEffect::kCustom_CoordsType == ste.coordsType()) { 41 if (GrEffect::kCustom_CoordsType == ste.coordsType()) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 }; 128 };
124 CoordsType coordsType = kCoordsTypes[random->nextULessThan(GR_ARRAY_COUNT(kC oordsTypes))]; 129 CoordsType coordsType = kCoordsTypes[random->nextULessThan(GR_ARRAY_COUNT(kC oordsTypes))];
125 130
126 if (kCustom_CoordsType == coordsType) { 131 if (kCustom_CoordsType == coordsType) {
127 return GrSimpleTextureEffect::CreateWithCustomCoords(textures[texIdx], p arams); 132 return GrSimpleTextureEffect::CreateWithCustomCoords(textures[texIdx], p arams);
128 } else { 133 } else {
129 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); 134 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random);
130 return GrSimpleTextureEffect::Create(textures[texIdx], matrix); 135 return GrSimpleTextureEffect::Create(textures[texIdx], matrix);
131 } 136 }
132 } 137 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBezierEffect.cpp ('k') | src/gpu/gl/GrGLEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698