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 "gl/builders/GrGLFullProgramBuilder.h" | 9 #include "gl/builders/GrGLFullProgramBuilder.h" |
10 #include "gl/GrGLProcessor.h" | 10 #include "gl/GrGLProcessor.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool GrDistanceFieldTextureEffect::onIsEqual(const GrProcessor& other) const { | 199 bool GrDistanceFieldTextureEffect::onIsEqual(const GrProcessor& other) const { |
200 const GrDistanceFieldTextureEffect& cte = other.cast<GrDistanceFieldTextureE
ffect>(); | 200 const GrDistanceFieldTextureEffect& cte = other.cast<GrDistanceFieldTextureE
ffect>(); |
201 return fTextureAccess == cte.fTextureAccess && | 201 return fTextureAccess == cte.fTextureAccess && |
202 #ifdef SK_GAMMA_APPLY_TO_A8 | 202 #ifdef SK_GAMMA_APPLY_TO_A8 |
203 fGammaTextureAccess == cte.fGammaTextureAccess && | 203 fGammaTextureAccess == cte.fGammaTextureAccess && |
204 fLuminance == cte.fLuminance && | 204 fLuminance == cte.fLuminance && |
205 #endif | 205 #endif |
206 fFlags == cte.fFlags; | 206 fFlags == cte.fFlags; |
207 } | 207 } |
208 | 208 |
209 void GrDistanceFieldTextureEffect::getConstantColorComponents(GrColor* color, | 209 void GrDistanceFieldTextureEffect::onGetConstantColorComponents(GrColor* color, |
210 uint32_t* validFlag
s) const { | 210 uint32_t* validF
lags, |
| 211 bool* isSingleCo
mponent) const { |
211 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color
) && | 212 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color
) && |
212 GrPixelConfigIsOpaque(this->texture(0)->config())) { | 213 GrPixelConfigIsOpaque(this->texture(0)->config())) { |
213 *validFlags = kA_GrColorComponentFlag; | 214 *validFlags = kA_GrColorComponentFlag; |
214 } else { | 215 } else { |
215 *validFlags = 0; | 216 *validFlags = 0; |
216 } | 217 } |
217 } | 218 } |
218 | 219 |
219 const GrBackendGeometryProcessorFactory& GrDistanceFieldTextureEffect::getFactor
y() const { | 220 const GrBackendGeometryProcessorFactory& GrDistanceFieldTextureEffect::getFactor
y() const { |
220 return GrTBackendGeometryProcessorFactory<GrDistanceFieldTextureEffect>::get
Instance(); | 221 return GrTBackendGeometryProcessorFactory<GrDistanceFieldTextureEffect>::get
Instance(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 } | 470 } |
470 | 471 |
471 bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrProcessor& other) const
{ | 472 bool GrDistanceFieldLCDTextureEffect::onIsEqual(const GrProcessor& other) const
{ |
472 const GrDistanceFieldLCDTextureEffect& cte = other.cast<GrDistanceFieldLCDTe
xtureEffect>(); | 473 const GrDistanceFieldLCDTextureEffect& cte = other.cast<GrDistanceFieldLCDTe
xtureEffect>(); |
473 return (fTextureAccess == cte.fTextureAccess && | 474 return (fTextureAccess == cte.fTextureAccess && |
474 fGammaTextureAccess == cte.fGammaTextureAccess && | 475 fGammaTextureAccess == cte.fGammaTextureAccess && |
475 fTextColor == cte.fTextColor && | 476 fTextColor == cte.fTextColor && |
476 fFlags == cte.fFlags); | 477 fFlags == cte.fFlags); |
477 } | 478 } |
478 | 479 |
479 void GrDistanceFieldLCDTextureEffect::getConstantColorComponents(GrColor* color, | 480 void GrDistanceFieldLCDTextureEffect::onGetConstantColorComponents(GrColor* colo
r, |
480 uint32_t* valid
Flags) const { | 481 uint32_t* val
idFlags, |
| 482 bool *isSingl
eComponent) const { |
481 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color
) && | 483 if ((*validFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(*color
) && |
482 GrPixelConfigIsOpaque(this->texture(0)->config())) { | 484 GrPixelConfigIsOpaque(this->texture(0)->config())) { |
483 *validFlags = kA_GrColorComponentFlag; | 485 *validFlags = kA_GrColorComponentFlag; |
484 } else { | 486 } else { |
485 *validFlags = 0; | 487 *validFlags = 0; |
486 } | 488 } |
487 } | 489 } |
488 | 490 |
489 const GrBackendGeometryProcessorFactory& GrDistanceFieldLCDTextureEffect::getFac
tory() const { | 491 const GrBackendGeometryProcessorFactory& GrDistanceFieldLCDTextureEffect::getFac
tory() const { |
490 return GrTBackendGeometryProcessorFactory<GrDistanceFieldLCDTextureEffect>::
getInstance(); | 492 return GrTBackendGeometryProcessorFactory<GrDistanceFieldLCDTextureEffect>::
getInstance(); |
(...skipping 29 matching lines...) Expand all Loading... |
520 random->nextULessThan(256), | 522 random->nextULessThan(256), |
521 random->nextULessThan(256)); | 523 random->nextULessThan(256)); |
522 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 524 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
523 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 525 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
524 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 526 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
525 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params, | 527 return GrDistanceFieldLCDTextureEffect::Create(textures[texIdx], params, |
526 textures[texIdx2], params2, | 528 textures[texIdx2], params2, |
527 textColor, | 529 textColor, |
528 flags); | 530 flags); |
529 } | 531 } |
OLD | NEW |