| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 GrProcessorKeyBuilder* b) c
onst { | 245 GrProcessorKeyBuilder* b) c
onst { |
| 246 GrGLDistanceFieldTextureEffect::GenKey(*this, bt, caps, b); | 246 GrGLDistanceFieldTextureEffect::GenKey(*this, bt, caps, b); |
| 247 } | 247 } |
| 248 | 248 |
| 249 GrGLPrimitiveProcessor* | 249 GrGLPrimitiveProcessor* |
| 250 GrDistanceFieldTextureEffect::createGLInstance(const GrBatchTracker& bt, | 250 GrDistanceFieldTextureEffect::createGLInstance(const GrBatchTracker& bt, |
| 251 const GrGLCaps&) const { | 251 const GrGLCaps&) const { |
| 252 return SkNEW_ARGS(GrGLDistanceFieldTextureEffect, (*this, bt)); | 252 return SkNEW_ARGS(GrGLDistanceFieldTextureEffect, (*this, bt)); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void GrDistanceFieldTextureEffect::initBatchTracker(GrBatchTracker* bt, const Gr
PipelineInfo& init) const { | 255 void GrDistanceFieldTextureEffect::initBatchTracker(GrBatchTracker* bt, const In
itBT& init) const { |
| 256 DistanceFieldBatchTracker* local = bt->cast<DistanceFieldBatchTracker>(); | 256 DistanceFieldBatchTracker* local = bt->cast<DistanceFieldBatchTracker>(); |
| 257 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, | 257 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, |
| 258 SkToBool(fInColor)); | 258 SkToBool(fInColor)); |
| 259 local->fUsesLocalCoords = init.fUsesLocalCoords; | 259 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| 260 } | 260 } |
| 261 | 261 |
| 262 bool GrDistanceFieldTextureEffect::onCanMakeEqual(const GrBatchTracker& m, | 262 bool GrDistanceFieldTextureEffect::onCanMakeEqual(const GrBatchTracker& m, |
| 263 const GrGeometryProcessor& tha
t, | 263 const GrGeometryProcessor& tha
t, |
| 264 const GrBatchTracker& t) const
{ | 264 const GrBatchTracker& t) const
{ |
| 265 const DistanceFieldBatchTracker& mine = m.cast<DistanceFieldBatchTracker>(); | 265 const DistanceFieldBatchTracker& mine = m.cast<DistanceFieldBatchTracker>(); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 GrGLDistanceFieldNoGammaTextureEffect::GenKey(*this, bt, caps, b); | 501 GrGLDistanceFieldNoGammaTextureEffect::GenKey(*this, bt, caps, b); |
| 502 } | 502 } |
| 503 | 503 |
| 504 GrGLPrimitiveProcessor* | 504 GrGLPrimitiveProcessor* |
| 505 GrDistanceFieldNoGammaTextureEffect::createGLInstance(const GrBatchTracker& bt, | 505 GrDistanceFieldNoGammaTextureEffect::createGLInstance(const GrBatchTracker& bt, |
| 506 const GrGLCaps&) const { | 506 const GrGLCaps&) const { |
| 507 return SkNEW_ARGS(GrGLDistanceFieldNoGammaTextureEffect, (*this, bt)); | 507 return SkNEW_ARGS(GrGLDistanceFieldNoGammaTextureEffect, (*this, bt)); |
| 508 } | 508 } |
| 509 | 509 |
| 510 void GrDistanceFieldNoGammaTextureEffect::initBatchTracker(GrBatchTracker* bt, | 510 void GrDistanceFieldNoGammaTextureEffect::initBatchTracker(GrBatchTracker* bt, |
| 511 const GrPipelineInfo&
init) const { | 511 const InitBT& init) c
onst { |
| 512 DistanceFieldNoGammaBatchTracker* local = bt->cast<DistanceFieldNoGammaBatch
Tracker>(); | 512 DistanceFieldNoGammaBatchTracker* local = bt->cast<DistanceFieldNoGammaBatch
Tracker>(); |
| 513 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, | 513 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, |
| 514 SkToBool(fInColor)); | 514 SkToBool(fInColor)); |
| 515 local->fUsesLocalCoords = init.fUsesLocalCoords; | 515 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| 516 } | 516 } |
| 517 | 517 |
| 518 bool GrDistanceFieldNoGammaTextureEffect::onCanMakeEqual(const GrBatchTracker& m
, | 518 bool GrDistanceFieldNoGammaTextureEffect::onCanMakeEqual(const GrBatchTracker& m
, |
| 519 const GrGeometryProcess
or& that, | 519 const GrGeometryProcess
or& that, |
| 520 const GrBatchTracker& t
) const { | 520 const GrBatchTracker& t
) const { |
| 521 const DistanceFieldNoGammaBatchTracker& mine = m.cast<DistanceFieldNoGammaBa
tchTracker>(); | 521 const DistanceFieldNoGammaBatchTracker& mine = m.cast<DistanceFieldNoGammaBa
tchTracker>(); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 GrGLDistanceFieldLCDTextureEffect::GenKey(*this, bt, caps, b); | 817 GrGLDistanceFieldLCDTextureEffect::GenKey(*this, bt, caps, b); |
| 818 } | 818 } |
| 819 | 819 |
| 820 GrGLPrimitiveProcessor* | 820 GrGLPrimitiveProcessor* |
| 821 GrDistanceFieldLCDTextureEffect::createGLInstance(const GrBatchTracker& bt, | 821 GrDistanceFieldLCDTextureEffect::createGLInstance(const GrBatchTracker& bt, |
| 822 const GrGLCaps&) const { | 822 const GrGLCaps&) const { |
| 823 return SkNEW_ARGS(GrGLDistanceFieldLCDTextureEffect, (*this, bt)); | 823 return SkNEW_ARGS(GrGLDistanceFieldLCDTextureEffect, (*this, bt)); |
| 824 } | 824 } |
| 825 | 825 |
| 826 void GrDistanceFieldLCDTextureEffect::initBatchTracker(GrBatchTracker* bt, | 826 void GrDistanceFieldLCDTextureEffect::initBatchTracker(GrBatchTracker* bt, |
| 827 const GrPipelineInfo& ini
t) const { | 827 const InitBT& init) const
{ |
| 828 DistanceFieldLCDBatchTracker* local = bt->cast<DistanceFieldLCDBatchTracker>
(); | 828 DistanceFieldLCDBatchTracker* local = bt->cast<DistanceFieldLCDBatchTracker>
(); |
| 829 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, false); | 829 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, false); |
| 830 local->fUsesLocalCoords = init.fUsesLocalCoords; | 830 local->fUsesLocalCoords = init.fUsesLocalCoords; |
| 831 } | 831 } |
| 832 | 832 |
| 833 bool GrDistanceFieldLCDTextureEffect::onCanMakeEqual(const GrBatchTracker& m, | 833 bool GrDistanceFieldLCDTextureEffect::onCanMakeEqual(const GrBatchTracker& m, |
| 834 const GrGeometryProcessor&
that, | 834 const GrGeometryProcessor&
that, |
| 835 const GrBatchTracker& t) co
nst { | 835 const GrBatchTracker& t) co
nst { |
| 836 const DistanceFieldLCDBatchTracker& mine = m.cast<DistanceFieldLCDBatchTrack
er>(); | 836 const DistanceFieldLCDBatchTracker& mine = m.cast<DistanceFieldLCDBatchTrack
er>(); |
| 837 const DistanceFieldLCDBatchTracker& theirs = t.cast<DistanceFieldLCDBatchTra
cker>(); | 837 const DistanceFieldLCDBatchTracker& theirs = t.cast<DistanceFieldLCDBatchTra
cker>(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 873 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
| 874 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 874 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
| 875 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 875 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
| 876 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), | 876 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), |
| 877 GrProcessorUnitTest::TestMatr
ix(random), | 877 GrProcessorUnitTest::TestMatr
ix(random), |
| 878 textures[texIdx], params, | 878 textures[texIdx], params, |
| 879 textures[texIdx2], params2, | 879 textures[texIdx2], params2, |
| 880 textColor, | 880 textColor, |
| 881 flags); | 881 flags); |
| 882 } | 882 } |
| OLD | NEW |