| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // vertical flip if necessary | 119 // vertical flip if necessary |
| 120 if (kBottomLeft_GrSurfaceOrigin == texDom.texture(0)->origin()) { | 120 if (kBottomLeft_GrSurfaceOrigin == texDom.texture(0)->origin()) { |
| 121 values[1] = 1.0f - values[1]; | 121 values[1] = 1.0f - values[1]; |
| 122 values[3] = 1.0f - values[3]; | 122 values[3] = 1.0f - values[3]; |
| 123 // The top and bottom were just flipped, so correct the ordering | 123 // The top and bottom were just flipped, so correct the ordering |
| 124 // of elements so that values = (l, t, r, b). | 124 // of elements so that values = (l, t, r, b). |
| 125 SkTSwap(values[1], values[3]); | 125 SkTSwap(values[1], values[3]); |
| 126 } | 126 } |
| 127 if (0 != memcmp(values, fPrevDomain, 4 * sizeof(GrGLfloat))) { | 127 if (0 != memcmp(values, fPrevDomain, 4 * sizeof(GrGLfloat))) { |
| 128 uman.set4fv(fNameUni, 0, 1, values); | 128 uman.set4fv(fNameUni, 0, 1, values); |
| 129 memcpy(fPrevDomain, values, 4 * sizeof(GrGLfloat)); |
| 129 } | 130 } |
| 130 fEffectMatrix.setData(uman, | 131 fEffectMatrix.setData(uman, |
| 131 texDom.getMatrix(), | 132 texDom.getMatrix(), |
| 132 drawEffect, | 133 drawEffect, |
| 133 texDom.texture(0)); | 134 texDom.texture(0)); |
| 134 } | 135 } |
| 135 | 136 |
| 136 GrGLEffect::EffectKey GrGLTextureDomainEffect::GenKey(const GrDrawEffect& drawEf
fect, | 137 GrGLEffect::EffectKey GrGLTextureDomainEffect::GenKey(const GrDrawEffect& drawEf
fect, |
| 137 const GrGLCaps&) { | 138 const GrGLCaps&) { |
| 138 const GrTextureDomainEffect& texDom = drawEffect.castEffect<GrTextureDomainE
ffect>(); | 139 const GrTextureDomainEffect& texDom = drawEffect.castEffect<GrTextureDomainE
ffect>(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 235 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
| 235 bool bilerp = random->nextBool(); | 236 bool bilerp = random->nextBool(); |
| 236 CoordsType coords = random->nextBool() ? kLocal_CoordsType : kPosition_Coord
sType; | 237 CoordsType coords = random->nextBool() ? kLocal_CoordsType : kPosition_Coord
sType; |
| 237 return GrTextureDomainEffect::Create(textures[texIdx], | 238 return GrTextureDomainEffect::Create(textures[texIdx], |
| 238 matrix, | 239 matrix, |
| 239 domain, | 240 domain, |
| 240 wrapMode, | 241 wrapMode, |
| 241 bilerp, | 242 bilerp, |
| 242 coords); | 243 coords); |
| 243 } | 244 } |
| OLD | NEW |