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