| 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 "GrDistanceFieldTextureEffect.h" | 8 #include "GrDistanceFieldTextureEffect.h" |
| 9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
| 10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 static inline void GenKey(const GrGeometryProcessor& processor, | 162 static inline void GenKey(const GrGeometryProcessor& processor, |
| 163 const GrBatchTracker& bt, | 163 const GrBatchTracker& bt, |
| 164 const GrGLCaps&, | 164 const GrGLCaps&, |
| 165 GrProcessorKeyBuilder* b) { | 165 GrProcessorKeyBuilder* b) { |
| 166 const GrDistanceFieldTextureEffect& dfTexEffect = | 166 const GrDistanceFieldTextureEffect& dfTexEffect = |
| 167 processor.cast<GrDistanceFieldTextureEffect>(); | 167 processor.cast<GrDistanceFieldTextureEffect>(); |
| 168 const DistanceFieldBatchTracker& local = bt.cast<DistanceFieldBatchTrack
er>(); | 168 const DistanceFieldBatchTracker& local = bt.cast<DistanceFieldBatchTrack
er>(); |
| 169 b->add32(dfTexEffect.getFlags()); | 169 b->add32(dfTexEffect.getFlags()); |
| 170 b->add32(local.fInputColorType); | 170 b->add32((local.fInputColorType << 16) | |
| 171 (local.fUsesLocalCoords && processor.localMatrix().hasPerspecti
ve() ? 0x1 : 0x0)); |
| 171 } | 172 } |
| 172 | 173 |
| 173 private: | 174 private: |
| 174 GrColor fColor; | 175 GrColor fColor; |
| 175 UniformHandle fColorUniform; | 176 UniformHandle fColorUniform; |
| 176 UniformHandle fTextureSizeUni; | 177 UniformHandle fTextureSizeUni; |
| 177 SkISize fTextureSize; | 178 SkISize fTextureSize; |
| 178 UniformHandle fLuminanceUni; | 179 UniformHandle fLuminanceUni; |
| 179 float fLuminance; | 180 float fLuminance; |
| 180 | 181 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 417 |
| 417 static inline void GenKey(const GrGeometryProcessor& proc, | 418 static inline void GenKey(const GrGeometryProcessor& proc, |
| 418 const GrBatchTracker& bt, | 419 const GrBatchTracker& bt, |
| 419 const GrGLCaps&, | 420 const GrGLCaps&, |
| 420 GrProcessorKeyBuilder* b) { | 421 GrProcessorKeyBuilder* b) { |
| 421 const GrDistanceFieldNoGammaTextureEffect& dfTexEffect = | 422 const GrDistanceFieldNoGammaTextureEffect& dfTexEffect = |
| 422 proc.cast<GrDistanceFieldNoGammaTextureEffect>(); | 423 proc.cast<GrDistanceFieldNoGammaTextureEffect>(); |
| 423 | 424 |
| 424 const DistanceFieldNoGammaBatchTracker& local = bt.cast<DistanceFieldNoG
ammaBatchTracker>(); | 425 const DistanceFieldNoGammaBatchTracker& local = bt.cast<DistanceFieldNoG
ammaBatchTracker>(); |
| 425 b->add32(dfTexEffect.getFlags()); | 426 b->add32(dfTexEffect.getFlags()); |
| 426 b->add32(local.fInputColorType); | 427 b->add32((local.fInputColorType << 16) | |
| 428 (local.fUsesLocalCoords && proc.localMatrix().hasPerspective()
? 0x1 : 0x0)); |
| 427 } | 429 } |
| 428 | 430 |
| 429 private: | 431 private: |
| 430 UniformHandle fColorUniform; | 432 UniformHandle fColorUniform; |
| 431 UniformHandle fTextureSizeUni; | 433 UniformHandle fTextureSizeUni; |
| 432 GrColor fColor; | 434 GrColor fColor; |
| 433 SkISize fTextureSize; | 435 SkISize fTextureSize; |
| 434 | 436 |
| 435 typedef GrGLGeometryProcessor INHERITED; | 437 typedef GrGLGeometryProcessor INHERITED; |
| 436 }; | 438 }; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 | 720 |
| 719 static inline void GenKey(const GrGeometryProcessor& processor, | 721 static inline void GenKey(const GrGeometryProcessor& processor, |
| 720 const GrBatchTracker& bt, | 722 const GrBatchTracker& bt, |
| 721 const GrGLCaps&, | 723 const GrGLCaps&, |
| 722 GrProcessorKeyBuilder* b) { | 724 GrProcessorKeyBuilder* b) { |
| 723 const GrDistanceFieldLCDTextureEffect& dfTexEffect = | 725 const GrDistanceFieldLCDTextureEffect& dfTexEffect = |
| 724 processor.cast<GrDistanceFieldLCDTextureEffect>(); | 726 processor.cast<GrDistanceFieldLCDTextureEffect>(); |
| 725 | 727 |
| 726 const DistanceFieldLCDBatchTracker& local = bt.cast<DistanceFieldLCDBatc
hTracker>(); | 728 const DistanceFieldLCDBatchTracker& local = bt.cast<DistanceFieldLCDBatc
hTracker>(); |
| 727 b->add32(dfTexEffect.getFlags()); | 729 b->add32(dfTexEffect.getFlags()); |
| 728 b->add32(local.fInputColorType); | 730 b->add32((local.fInputColorType << 16) | |
| 731 (local.fUsesLocalCoords && processor.localMatrix().hasPerspecti
ve() ? 0x1 : 0x0)); |
| 729 } | 732 } |
| 730 | 733 |
| 731 private: | 734 private: |
| 732 GrColor fColor; | 735 GrColor fColor; |
| 733 UniformHandle fColorUniform; | 736 UniformHandle fColorUniform; |
| 734 UniformHandle fTextureSizeUni; | 737 UniformHandle fTextureSizeUni; |
| 735 SkISize fTextureSize; | 738 SkISize fTextureSize; |
| 736 UniformHandle fTextColorUni; | 739 UniformHandle fTextColorUni; |
| 737 SkColor fTextColor; | 740 SkColor fTextColor; |
| 738 | 741 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 random->nextULessThan(256), | 834 random->nextULessThan(256), |
| 832 random->nextULessThan(256)); | 835 random->nextULessThan(256)); |
| 833 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 836 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
| 834 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 837 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
| 835 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 838 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
| 836 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), textur
es[texIdx], params, | 839 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), textur
es[texIdx], params, |
| 837 textures[texIdx2], params2, | 840 textures[texIdx2], params2, |
| 838 textColor, | 841 textColor, |
| 839 flags); | 842 flags); |
| 840 } | 843 } |
| OLD | NEW |