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 "GrTextureDomainEffect.h" | 8 #include "GrTextureDomainEffect.h" |
9 #include "GrSimpleTextureEffect.h" | 9 #include "GrSimpleTextureEffect.h" |
10 #include "GrTBackendEffectFactory.h" | 10 #include "GrTBackendEffectFactory.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 }; | 106 }; |
107 // vertical flip if necessary | 107 // vertical flip if necessary |
108 if (kBottomLeft_GrSurfaceOrigin == texDom.texture(0)->origin()) { | 108 if (kBottomLeft_GrSurfaceOrigin == texDom.texture(0)->origin()) { |
109 values[1] = 1.0f - values[1]; | 109 values[1] = 1.0f - values[1]; |
110 values[3] = 1.0f - values[3]; | 110 values[3] = 1.0f - values[3]; |
111 // The top and bottom were just flipped, so correct the ordering | 111 // The top and bottom were just flipped, so correct the ordering |
112 // of elements so that values = (l, t, r, b). | 112 // of elements so that values = (l, t, r, b). |
113 SkTSwap(values[1], values[3]); | 113 SkTSwap(values[1], values[3]); |
114 } | 114 } |
115 if (0 != memcmp(values, fPrevDomain, 4 * sizeof(GrGLfloat))) { | 115 if (0 != memcmp(values, fPrevDomain, 4 * sizeof(GrGLfloat))) { |
116 uman.set4fv(fNameUni, 0, 1, values); | 116 uman.set4fv(fNameUni, 1, values); |
117 memcpy(fPrevDomain, values, 4 * sizeof(GrGLfloat)); | 117 memcpy(fPrevDomain, values, 4 * sizeof(GrGLfloat)); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 GrGLEffect::EffectKey GrGLTextureDomainEffect::GenKey(const GrDrawEffect& drawEf
fect, | 121 GrGLEffect::EffectKey GrGLTextureDomainEffect::GenKey(const GrDrawEffect& drawEf
fect, |
122 const GrGLCaps&) { | 122 const GrGLCaps&) { |
123 return drawEffect.castEffect<GrTextureDomainEffect>().wrapMode(); | 123 return drawEffect.castEffect<GrTextureDomainEffect>().wrapMode(); |
124 } | 124 } |
125 | 125 |
126 | 126 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 212 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
213 bool bilerp = random->nextBool(); | 213 bool bilerp = random->nextBool(); |
214 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; | 214 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; |
215 return GrTextureDomainEffect::Create(textures[texIdx], | 215 return GrTextureDomainEffect::Create(textures[texIdx], |
216 matrix, | 216 matrix, |
217 domain, | 217 domain, |
218 wrapMode, | 218 wrapMode, |
219 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 219 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
220 coords); | 220 coords); |
221 } | 221 } |
OLD | NEW |