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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 GrProcessorKeyBuilder* b) c
onst { | 251 GrProcessorKeyBuilder* b) c
onst { |
252 GrGLDistanceFieldTextureEffect::GenKey(*this, bt, caps, b); | 252 GrGLDistanceFieldTextureEffect::GenKey(*this, bt, caps, b); |
253 } | 253 } |
254 | 254 |
255 GrGLPrimitiveProcessor* | 255 GrGLPrimitiveProcessor* |
256 GrDistanceFieldTextureEffect::createGLInstance(const GrBatchTracker& bt, | 256 GrDistanceFieldTextureEffect::createGLInstance(const GrBatchTracker& bt, |
257 const GrGLCaps&) const { | 257 const GrGLCaps&) const { |
258 return SkNEW_ARGS(GrGLDistanceFieldTextureEffect, (*this, bt)); | 258 return SkNEW_ARGS(GrGLDistanceFieldTextureEffect, (*this, bt)); |
259 } | 259 } |
260 | 260 |
261 void GrDistanceFieldTextureEffect::initBatchTracker(GrBatchTracker* bt, const In
itBT& init) const { | 261 void GrDistanceFieldTextureEffect::initBatchTracker(GrBatchTracker* bt, const Gr
PipelineInfo& init) const { |
262 DistanceFieldBatchTracker* local = bt->cast<DistanceFieldBatchTracker>(); | 262 DistanceFieldBatchTracker* local = bt->cast<DistanceFieldBatchTracker>(); |
263 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, | 263 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, |
264 SkToBool(fInColor)); | 264 SkToBool(fInColor)); |
265 local->fUsesLocalCoords = init.fUsesLocalCoords; | 265 local->fUsesLocalCoords = init.fUsesLocalCoords; |
266 } | 266 } |
267 | 267 |
268 bool GrDistanceFieldTextureEffect::onCanMakeEqual(const GrBatchTracker& m, | 268 bool GrDistanceFieldTextureEffect::onCanMakeEqual(const GrBatchTracker& m, |
269 const GrGeometryProcessor& tha
t, | 269 const GrGeometryProcessor& tha
t, |
270 const GrBatchTracker& t) const
{ | 270 const GrBatchTracker& t) const
{ |
271 const DistanceFieldBatchTracker& mine = m.cast<DistanceFieldBatchTracker>(); | 271 const DistanceFieldBatchTracker& mine = m.cast<DistanceFieldBatchTracker>(); |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 GrGLDistanceFieldNoGammaTextureEffect::GenKey(*this, bt, caps, b); | 513 GrGLDistanceFieldNoGammaTextureEffect::GenKey(*this, bt, caps, b); |
514 } | 514 } |
515 | 515 |
516 GrGLPrimitiveProcessor* | 516 GrGLPrimitiveProcessor* |
517 GrDistanceFieldNoGammaTextureEffect::createGLInstance(const GrBatchTracker& bt, | 517 GrDistanceFieldNoGammaTextureEffect::createGLInstance(const GrBatchTracker& bt, |
518 const GrGLCaps&) const { | 518 const GrGLCaps&) const { |
519 return SkNEW_ARGS(GrGLDistanceFieldNoGammaTextureEffect, (*this, bt)); | 519 return SkNEW_ARGS(GrGLDistanceFieldNoGammaTextureEffect, (*this, bt)); |
520 } | 520 } |
521 | 521 |
522 void GrDistanceFieldNoGammaTextureEffect::initBatchTracker(GrBatchTracker* bt, | 522 void GrDistanceFieldNoGammaTextureEffect::initBatchTracker(GrBatchTracker* bt, |
523 const InitBT& init) c
onst { | 523 const GrPipelineInfo&
init) const { |
524 DistanceFieldNoGammaBatchTracker* local = bt->cast<DistanceFieldNoGammaBatch
Tracker>(); | 524 DistanceFieldNoGammaBatchTracker* local = bt->cast<DistanceFieldNoGammaBatch
Tracker>(); |
525 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, | 525 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, |
526 SkToBool(fInColor)); | 526 SkToBool(fInColor)); |
527 local->fUsesLocalCoords = init.fUsesLocalCoords; | 527 local->fUsesLocalCoords = init.fUsesLocalCoords; |
528 } | 528 } |
529 | 529 |
530 bool GrDistanceFieldNoGammaTextureEffect::onCanMakeEqual(const GrBatchTracker& m
, | 530 bool GrDistanceFieldNoGammaTextureEffect::onCanMakeEqual(const GrBatchTracker& m
, |
531 const GrGeometryProcess
or& that, | 531 const GrGeometryProcess
or& that, |
532 const GrBatchTracker& t
) const { | 532 const GrBatchTracker& t
) const { |
533 const DistanceFieldNoGammaBatchTracker& mine = m.cast<DistanceFieldNoGammaBa
tchTracker>(); | 533 const DistanceFieldNoGammaBatchTracker& mine = m.cast<DistanceFieldNoGammaBa
tchTracker>(); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 GrGLDistanceFieldLCDTextureEffect::GenKey(*this, bt, caps, b); | 834 GrGLDistanceFieldLCDTextureEffect::GenKey(*this, bt, caps, b); |
835 } | 835 } |
836 | 836 |
837 GrGLPrimitiveProcessor* | 837 GrGLPrimitiveProcessor* |
838 GrDistanceFieldLCDTextureEffect::createGLInstance(const GrBatchTracker& bt, | 838 GrDistanceFieldLCDTextureEffect::createGLInstance(const GrBatchTracker& bt, |
839 const GrGLCaps&) const { | 839 const GrGLCaps&) const { |
840 return SkNEW_ARGS(GrGLDistanceFieldLCDTextureEffect, (*this, bt)); | 840 return SkNEW_ARGS(GrGLDistanceFieldLCDTextureEffect, (*this, bt)); |
841 } | 841 } |
842 | 842 |
843 void GrDistanceFieldLCDTextureEffect::initBatchTracker(GrBatchTracker* bt, | 843 void GrDistanceFieldLCDTextureEffect::initBatchTracker(GrBatchTracker* bt, |
844 const InitBT& init) const
{ | 844 const GrPipelineInfo& ini
t) const { |
845 DistanceFieldLCDBatchTracker* local = bt->cast<DistanceFieldLCDBatchTracker>
(); | 845 DistanceFieldLCDBatchTracker* local = bt->cast<DistanceFieldLCDBatchTracker>
(); |
846 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, false); | 846 local->fInputColorType = GetColorInputType(&local->fColor, this->color(), in
it, false); |
847 local->fUsesLocalCoords = init.fUsesLocalCoords; | 847 local->fUsesLocalCoords = init.fUsesLocalCoords; |
848 } | 848 } |
849 | 849 |
850 bool GrDistanceFieldLCDTextureEffect::onCanMakeEqual(const GrBatchTracker& m, | 850 bool GrDistanceFieldLCDTextureEffect::onCanMakeEqual(const GrBatchTracker& m, |
851 const GrGeometryProcessor&
that, | 851 const GrGeometryProcessor&
that, |
852 const GrBatchTracker& t) co
nst { | 852 const GrBatchTracker& t) co
nst { |
853 const DistanceFieldLCDBatchTracker& mine = m.cast<DistanceFieldLCDBatchTrack
er>(); | 853 const DistanceFieldLCDBatchTracker& mine = m.cast<DistanceFieldLCDBatchTrack
er>(); |
854 const DistanceFieldLCDBatchTracker& theirs = t.cast<DistanceFieldLCDBatchTra
cker>(); | 854 const DistanceFieldLCDBatchTracker& theirs = t.cast<DistanceFieldLCDBatchTra
cker>(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 890 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
891 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 891 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
892 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 892 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
893 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), | 893 return GrDistanceFieldLCDTextureEffect::Create(GrRandomColor(random), |
894 GrProcessorUnitTest::TestMatr
ix(random), | 894 GrProcessorUnitTest::TestMatr
ix(random), |
895 textures[texIdx], params, | 895 textures[texIdx], params, |
896 textures[texIdx2], params2, | 896 textures[texIdx2], params2, |
897 textColor, | 897 textColor, |
898 flags); | 898 flags); |
899 } | 899 } |
OLD | NEW |