| 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 "GrDistanceFieldGeoProc.h" | 8 #include "GrDistanceFieldGeoProc.h" |
| 9 #include "GrFontAtlasSizes.h" | 9 #include "GrFontAtlasSizes.h" |
| 10 #include "GrInvariantOutput.h" | 10 #include "GrInvariantOutput.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 /////////////////////////////////////////////////////////////////////////////// | 190 /////////////////////////////////////////////////////////////////////////////// |
| 191 | 191 |
| 192 GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color, | 192 GrDistanceFieldA8TextGeoProc::GrDistanceFieldA8TextGeoProc(GrColor color, |
| 193 const SkMatrix& viewM
atrix, | 193 const SkMatrix& viewM
atrix, |
| 194 GrTexture* texture, | 194 GrTexture* texture, |
| 195 const GrTextureParams
& params, | 195 const GrTextureParams
& params, |
| 196 #ifdef SK_GAMMA_APPLY_TO_A8 | 196 #ifdef SK_GAMMA_APPLY_TO_A8 |
| 197 float distanceAdjust, | 197 float distanceAdjust, |
| 198 #endif | 198 #endif |
| 199 uint32_t flags) | 199 uint32_t flags) |
| 200 : INHERITED(color, viewMatrix, SkMatrix::I()) | 200 : INHERITED(viewMatrix, SkMatrix::I()) |
| 201 , fColor(color) |
| 201 , fTextureAccess(texture, params) | 202 , fTextureAccess(texture, params) |
| 202 #ifdef SK_GAMMA_APPLY_TO_A8 | 203 #ifdef SK_GAMMA_APPLY_TO_A8 |
| 203 , fDistanceAdjust(distanceAdjust) | 204 , fDistanceAdjust(distanceAdjust) |
| 204 #endif | 205 #endif |
| 205 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) | 206 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) |
| 206 , fInColor(NULL) { | 207 , fInColor(NULL) { |
| 207 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); | 208 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); |
| 208 this->initClassID<GrDistanceFieldA8TextGeoProc>(); | 209 this->initClassID<GrDistanceFieldA8TextGeoProc>(); |
| 209 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 210 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 210 if (flags & kColorAttr_DistanceFieldEffectFlag) { | 211 if (flags & kColorAttr_DistanceFieldEffectFlag) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 }; | 417 }; |
| 417 | 418 |
| 418 /////////////////////////////////////////////////////////////////////////////// | 419 /////////////////////////////////////////////////////////////////////////////// |
| 419 | 420 |
| 420 GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc( | 421 GrDistanceFieldPathGeoProc::GrDistanceFieldPathGeoProc( |
| 421 GrColor color, | 422 GrColor color, |
| 422 const SkMatrix& viewMatrix, | 423 const SkMatrix& viewMatrix, |
| 423 GrTexture* texture, | 424 GrTexture* texture, |
| 424 const GrTextureParams& params, | 425 const GrTextureParams& params, |
| 425 uint32_t flags) | 426 uint32_t flags) |
| 426 : INHERITED(color, viewMatrix, SkMatrix::I()) | 427 : INHERITED(viewMatrix, SkMatrix::I()) |
| 428 , fColor(color) |
| 427 , fTextureAccess(texture, params) | 429 , fTextureAccess(texture, params) |
| 428 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) | 430 , fFlags(flags & kNonLCD_DistanceFieldEffectMask) |
| 429 , fInColor(NULL) { | 431 , fInColor(NULL) { |
| 430 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); | 432 SkASSERT(!(flags & ~kNonLCD_DistanceFieldEffectMask)); |
| 431 this->initClassID<GrDistanceFieldPathGeoProc>(); | 433 this->initClassID<GrDistanceFieldPathGeoProc>(); |
| 432 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 434 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 433 if (flags & kColorAttr_DistanceFieldEffectFlag) { | 435 if (flags & kColorAttr_DistanceFieldEffectFlag) { |
| 434 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); | 436 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); |
| 435 } | 437 } |
| 436 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", | 438 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 typedef GrGLGeometryProcessor INHERITED; | 686 typedef GrGLGeometryProcessor INHERITED; |
| 685 }; | 687 }; |
| 686 | 688 |
| 687 /////////////////////////////////////////////////////////////////////////////// | 689 /////////////////////////////////////////////////////////////////////////////// |
| 688 | 690 |
| 689 GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( | 691 GrDistanceFieldLCDTextGeoProc::GrDistanceFieldLCDTextGeoProc( |
| 690 GrColor color, const SkMatrix&
viewMatrix, | 692 GrColor color, const SkMatrix&
viewMatrix, |
| 691 GrTexture* texture, const GrTe
xtureParams& params, | 693 GrTexture* texture, const GrTe
xtureParams& params, |
| 692 DistanceAdjust distanceAdjust, | 694 DistanceAdjust distanceAdjust, |
| 693 uint32_t flags) | 695 uint32_t flags) |
| 694 : INHERITED(color, viewMatrix, SkMatrix::I()) | 696 : INHERITED(viewMatrix, SkMatrix::I()) |
| 697 , fColor(color) |
| 695 , fTextureAccess(texture, params) | 698 , fTextureAccess(texture, params) |
| 696 , fDistanceAdjust(distanceAdjust) | 699 , fDistanceAdjust(distanceAdjust) |
| 697 , fFlags(flags & kLCD_DistanceFieldEffectMask){ | 700 , fFlags(flags & kLCD_DistanceFieldEffectMask){ |
| 698 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan
ceFieldEffectFlag)); | 701 SkASSERT(!(flags & ~kLCD_DistanceFieldEffectMask) && (flags & kUseLCD_Distan
ceFieldEffectFlag)); |
| 699 this->initClassID<GrDistanceFieldLCDTextGeoProc>(); | 702 this->initClassID<GrDistanceFieldLCDTextGeoProc>(); |
| 700 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); | 703 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVertex
AttribType)); |
| 701 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", | 704 fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords", |
| 702 kVec2s_GrVertexAttribT
ype)); | 705 kVec2s_GrVertexAttribT
ype)); |
| 703 this->addTextureAccess(&fTextureAccess); | 706 this->addTextureAccess(&fTextureAccess); |
| 704 } | 707 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; | 749 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; |
| 747 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 750 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
| 748 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 751 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
| 749 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 752 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
| 750 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), | 753 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), |
| 751 GrTest::TestMatrix(random), | 754 GrTest::TestMatrix(random), |
| 752 textures[texIdx], params, | 755 textures[texIdx], params, |
| 753 wa, | 756 wa, |
| 754 flags); | 757 flags); |
| 755 } | 758 } |
| OLD | NEW |