| 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 "GrDistanceFieldTextContext.h" | 8 #include "GrDistanceFieldTextContext.h" |
| 9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
| 10 #include "GrAtlasTextContext.h" | 10 #include "GrAtlasTextContext.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 | 509 |
| 510 if (fUseLCDText) { | 510 if (fUseLCDText) { |
| 511 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); | 511 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol
or); |
| 512 | 512 |
| 513 float redCorrection = | 513 float redCorrection = |
| 514 fDistanceAdjustTable[GrColorUnpackR(colorNoPreMul) >> kDistanceA
djustLumShift]; | 514 fDistanceAdjustTable[GrColorUnpackR(colorNoPreMul) >> kDistanceA
djustLumShift]; |
| 515 float greenCorrection = | 515 float greenCorrection = |
| 516 fDistanceAdjustTable[GrColorUnpackG(colorNoPreMul) >> kDistanceA
djustLumShift]; | 516 fDistanceAdjustTable[GrColorUnpackG(colorNoPreMul) >> kDistanceA
djustLumShift]; |
| 517 float blueCorrection = | 517 float blueCorrection = |
| 518 fDistanceAdjustTable[GrColorUnpackB(colorNoPreMul) >> kDistanceA
djustLumShift]; | 518 fDistanceAdjustTable[GrColorUnpackB(colorNoPreMul) >> kDistanceA
djustLumShift]; |
| 519 GrDistanceFieldLCDTextureEffect::DistanceAdjust widthAdjust = | 519 GrDistanceFieldLCDTextGeoProc::DistanceAdjust widthAdjust = |
| 520 GrDistanceFieldLCDTextureEffect::DistanceAdjust::Make(redCorrect
ion, | 520 GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(redCorrectio
n, |
| 521 greenCorrecti
on, | 521 greenCorrect
ion, |
| 522 blueCorrectio
n); | 522 blueCorrecti
on); |
| 523 fCachedGeometryProcessor.reset(GrDistanceFieldLCDTextureEffect::Crea
te(color, | 523 fCachedGeometryProcessor.reset(GrDistanceFieldLCDTextGeoProc::Create
(color, |
| 524
fViewMatrix, | 524
fViewMatrix, |
| 525
localMatrix, | 525
localMatrix, |
| 526
fCurrTexture, | 526
fCurrTexture, |
| 527
params, | 527
params, |
| 528
widthAdjust, | 528
widthAdjust, |
| 529
flags)); | 529
flags)); |
| 530 } else { | 530 } else { |
| 531 flags |= kColorAttr_DistanceFieldEffectFlag; | 531 flags |= kColorAttr_DistanceFieldEffectFlag; |
| 532 bool opaque = GrColorIsOpaque(color); | 532 bool opaque = GrColorIsOpaque(color); |
| 533 #ifdef SK_GAMMA_APPLY_TO_A8 | 533 #ifdef SK_GAMMA_APPLY_TO_A8 |
| 534 U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDevicePropertie
s.gamma(), | 534 U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDevicePropertie
s.gamma(), |
| 535 filteredColor); | 535 filteredColor); |
| 536 float correction = fDistanceAdjustTable[lum >> kDistanceAdjustLumShi
ft]; | 536 float correction = fDistanceAdjustTable[lum >> kDistanceAdjustLumShi
ft]; |
| 537 fCachedGeometryProcessor.reset(GrDistanceFieldTextureEffect::Create(
color, | 537 fCachedGeometryProcessor.reset(GrDistanceFieldA8TextGeoProc::Create(
color, |
| 538
fViewMatrix, | 538
fViewMatrix, |
| 539
localMatrix, | 539
localMatrix, |
| 540
fCurrTexture, | 540
fCurrTexture, |
| 541
params, | 541
params, |
| 542
correction, | 542
correction, |
| 543
flags, | 543
flags, |
| 544
opaque)); | 544
opaque)); |
| 545 #else | 545 #else |
| 546 fCachedGeometryProcessor.reset(GrDistanceFieldTextureEffect::Create(
color, | 546 fCachedGeometryProcessor.reset(GrDistanceFieldA8TextGeoProc::Create(
color, |
| 547
fViewMatrix, | 547
fViewMatrix, |
| 548
localMatrix, | 548
localMatrix, |
| 549
fCurrTexture, | 549
fCurrTexture, |
| 550
params, | 550
params, |
| 551
flags, | 551
flags, |
| 552
opaque)); | 552
opaque)); |
| 553 #endif | 553 #endif |
| 554 } | 554 } |
| 555 fEffectTextureUniqueID = textureUniqueID; | 555 fEffectTextureUniqueID = textureUniqueID; |
| 556 fEffectColor = filteredColor; | 556 fEffectColor = filteredColor; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 inline void GrDistanceFieldTextContext::finish() { | 822 inline void GrDistanceFieldTextContext::finish() { |
| 823 this->flush(); | 823 this->flush(); |
| 824 fTotalVertexCount = 0; | 824 fTotalVertexCount = 0; |
| 825 | 825 |
| 826 GrTextContext::finish(); | 826 GrTextContext::finish(); |
| 827 } | 827 } |
| 828 | 828 |
| OLD | NEW |