OLD | NEW |
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 "GrCustomCoordsTextureEffect.h" | 8 #include "GrCustomCoordsTextureEffect.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 "gl/GrGLVertexEffect.h" | 13 #include "gl/GrGLVertexEffect.h" |
14 #include "GrTBackendEffectFactory.h" | 14 #include "GrTBackendEffectFactory.h" |
15 #include "GrTexture.h" | 15 #include "GrTexture.h" |
16 | 16 |
17 class GrGLCustomCoordsTextureEffect : public GrGLVertexEffect { | 17 class GrGLCustomCoordsTextureEffect : public GrGLVertexEffect { |
18 public: | 18 public: |
19 GrGLCustomCoordsTextureEffect(const GrBackendEffectFactory& factory, const G
rDrawEffect& drawEffect) | 19 GrGLCustomCoordsTextureEffect(const GrBackendEffectFactory& factory, const G
rDrawEffect& drawEffect) |
20 : INHERITED (factory) {} | 20 : INHERITED (factory) {} |
21 | 21 |
22 virtual void emitCode(GrGLFullShaderBuilder* builder, | 22 virtual void emitCode(GrGLFullShaderBuilder* 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&, | 27 const TransformedCoordsArray&, |
28 const TextureSamplerArray& samplers) SK_OVERRIDE { | 28 const TextureSamplerArray& samplers) SK_OVERRIDE { |
29 SkASSERT(1 == drawEffect.castEffect<GrCustomCoordsTextureEffect>().numVe
rtexAttribs()); | 29 SkASSERT(1 == drawEffect.castEffect<GrCustomCoordsTextureEffect>().numVe
rtexAttribs()); |
30 | 30 |
31 SkString fsCoordName; | 31 SkString fsCoordName; |
32 const char* vsVaryingName; | 32 const char* vsVaryingName; |
33 const char* fsVaryingNamePtr; | 33 const char* fsVaryingNamePtr; |
34 builder->addVarying(kVec2f_GrSLType, "textureCoords", &vsVaryingName, &f
sVaryingNamePtr); | 34 builder->addVarying(kVec2f_GrSLType, "textureCoords", &vsVaryingName, &f
sVaryingNamePtr); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 }; | 98 }; |
99 SkShader::TileMode tileModes[] = { | 99 SkShader::TileMode tileModes[] = { |
100 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 100 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
101 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 101 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
102 }; | 102 }; |
103 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 103 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
104 GrTextureParams::kNon
e_FilterMode); | 104 GrTextureParams::kNon
e_FilterMode); |
105 | 105 |
106 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); | 106 return GrCustomCoordsTextureEffect::Create(textures[texIdx], params); |
107 } | 107 } |
OLD | NEW |