OLD | NEW |
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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if (GrEffect::kCustom_CoordsType == ste.coordsType()) { | 59 if (GrEffect::kCustom_CoordsType == ste.coordsType()) { |
60 return 1 << GrGLEffectMatrix::kKeyBits; | 60 return 1 << GrGLEffectMatrix::kKeyBits; |
61 } else { | 61 } else { |
62 return GrGLEffectMatrix::GenKey(ste.getMatrix(), | 62 return GrGLEffectMatrix::GenKey(ste.getMatrix(), |
63 drawEffect, | 63 drawEffect, |
64 ste.coordsType(), | 64 ste.coordsType(), |
65 ste.texture(0)); | 65 ste.texture(0)); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 virtual void setData(const GrGLUniformManager& uman, | 69 virtual void setData(const GrGLContext& context, |
70 const GrDrawEffect& drawEffect) SK_OVERRIDE { | 70 const GrDrawEffect& drawEffect) SK_OVERRIDE { |
71 const GrSimpleTextureEffect& ste = drawEffect.castEffect<GrSimpleTexture
Effect>(); | 71 const GrSimpleTextureEffect& ste = drawEffect.castEffect<GrSimpleTexture
Effect>(); |
72 if (GrEffect::kCustom_CoordsType == ste.coordsType()) { | 72 if (GrEffect::kCustom_CoordsType == ste.coordsType()) { |
73 GrAssert(ste.getMatrix().isIdentity()); | 73 GrAssert(ste.getMatrix().isIdentity()); |
74 } else { | 74 } else { |
75 fEffectMatrix.get()->setData(uman, ste.getMatrix(), drawEffect, ste.
texture(0)); | 75 fEffectMatrix.get()->setData(context, ste.getMatrix(), drawEffect, s
te.texture(0)); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 private: | 79 private: |
80 SkTLazy<GrGLEffectMatrix> fEffectMatrix; | 80 SkTLazy<GrGLEffectMatrix> fEffectMatrix; |
81 typedef GrGLEffect INHERITED; | 81 typedef GrGLEffect INHERITED; |
82 }; | 82 }; |
83 | 83 |
84 /////////////////////////////////////////////////////////////////////////////// | 84 /////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 }; | 120 }; |
121 CoordsType coordsType = kCoordsTypes[random->nextULessThan(GR_ARRAY_COUNT(kC
oordsTypes))]; | 121 CoordsType coordsType = kCoordsTypes[random->nextULessThan(GR_ARRAY_COUNT(kC
oordsTypes))]; |
122 | 122 |
123 if (kCustom_CoordsType == coordsType) { | 123 if (kCustom_CoordsType == coordsType) { |
124 return GrSimpleTextureEffect::CreateWithCustomCoords(textures[texIdx], p
arams); | 124 return GrSimpleTextureEffect::CreateWithCustomCoords(textures[texIdx], p
arams); |
125 } else { | 125 } else { |
126 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 126 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
127 return GrSimpleTextureEffect::Create(textures[texIdx], matrix); | 127 return GrSimpleTextureEffect::Create(textures[texIdx], matrix); |
128 } | 128 } |
129 } | 129 } |
OLD | NEW |