| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 const GrGLSLCaps&) const { | 225 const GrGLSLCaps&) const { |
| 226 return SkNEW_ARGS(GrGLDistanceFieldA8TextGeoProc, (*this, bt)); | 226 return SkNEW_ARGS(GrGLDistanceFieldA8TextGeoProc, (*this, bt)); |
| 227 } | 227 } |
| 228 | 228 |
| 229 /////////////////////////////////////////////////////////////////////////////// | 229 /////////////////////////////////////////////////////////////////////////////// |
| 230 | 230 |
| 231 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldA8TextGeoProc); | 231 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldA8TextGeoProc); |
| 232 | 232 |
| 233 GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(SkRandom* random, | 233 GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(SkRandom* random, |
| 234 GrContext*, | 234 GrContext*, |
| 235 const GrDrawTarget
Caps&, | 235 const GrCaps&, |
| 236 GrTexture* texture
s[]) { | 236 GrTexture* texture
s[]) { |
| 237 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : | 237 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : |
| 238 GrProcessorUnitTest::kAlphaTextureIdx; | 238 GrProcessorUnitTest::kAlphaTextureIdx; |
| 239 static const SkShader::TileMode kTileModes[] = { | 239 static const SkShader::TileMode kTileModes[] = { |
| 240 SkShader::kClamp_TileMode, | 240 SkShader::kClamp_TileMode, |
| 241 SkShader::kRepeat_TileMode, | 241 SkShader::kRepeat_TileMode, |
| 242 SkShader::kMirror_TileMode, | 242 SkShader::kMirror_TileMode, |
| 243 }; | 243 }; |
| 244 SkShader::TileMode tileModes[] = { | 244 SkShader::TileMode tileModes[] = { |
| 245 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 245 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 GrDistanceFieldPathGeoProc::createGLInstance(const GrBatchTracker& bt, const GrG
LSLCaps&) const { | 439 GrDistanceFieldPathGeoProc::createGLInstance(const GrBatchTracker& bt, const GrG
LSLCaps&) const { |
| 440 return SkNEW_ARGS(GrGLDistanceFieldPathGeoProc, (*this, bt)); | 440 return SkNEW_ARGS(GrGLDistanceFieldPathGeoProc, (*this, bt)); |
| 441 } | 441 } |
| 442 | 442 |
| 443 /////////////////////////////////////////////////////////////////////////////// | 443 /////////////////////////////////////////////////////////////////////////////// |
| 444 | 444 |
| 445 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldPathGeoProc); | 445 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldPathGeoProc); |
| 446 | 446 |
| 447 GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(SkRandom* random, | 447 GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(SkRandom* random, |
| 448 GrContext*, | 448 GrContext*, |
| 449 const GrDrawTargetCa
ps&, | 449 const GrCaps&, |
| 450 GrTexture* textures[
]) { | 450 GrTexture* textures[
]) { |
| 451 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx | 451 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx |
| 452 : GrProcessorUnitTest::kAlphaTextureIdx; | 452 : GrProcessorUnitTest::kAlphaTextureIdx; |
| 453 static const SkShader::TileMode kTileModes[] = { | 453 static const SkShader::TileMode kTileModes[] = { |
| 454 SkShader::kClamp_TileMode, | 454 SkShader::kClamp_TileMode, |
| 455 SkShader::kRepeat_TileMode, | 455 SkShader::kRepeat_TileMode, |
| 456 SkShader::kMirror_TileMode, | 456 SkShader::kMirror_TileMode, |
| 457 }; | 457 }; |
| 458 SkShader::TileMode tileModes[] = { | 458 SkShader::TileMode tileModes[] = { |
| 459 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 459 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 const GrGLSLCaps&) const { | 691 const GrGLSLCaps&) const { |
| 692 return SkNEW_ARGS(GrGLDistanceFieldLCDTextGeoProc, (*this, bt)); | 692 return SkNEW_ARGS(GrGLDistanceFieldLCDTextGeoProc, (*this, bt)); |
| 693 } | 693 } |
| 694 | 694 |
| 695 /////////////////////////////////////////////////////////////////////////////// | 695 /////////////////////////////////////////////////////////////////////////////// |
| 696 | 696 |
| 697 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextGeoProc); | 697 GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextGeoProc); |
| 698 | 698 |
| 699 GrGeometryProcessor* GrDistanceFieldLCDTextGeoProc::TestCreate(SkRandom* random, | 699 GrGeometryProcessor* GrDistanceFieldLCDTextGeoProc::TestCreate(SkRandom* random, |
| 700 GrContext*, | 700 GrContext*, |
| 701 const GrDrawTar
getCaps&, | 701 const GrCaps&, |
| 702 GrTexture* text
ures[]) { | 702 GrTexture* text
ures[]) { |
| 703 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : | 703 int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : |
| 704 GrProcessorUnitTest::kAlphaTextureIdx; | 704 GrProcessorUnitTest::kAlphaTextureIdx; |
| 705 static const SkShader::TileMode kTileModes[] = { | 705 static const SkShader::TileMode kTileModes[] = { |
| 706 SkShader::kClamp_TileMode, | 706 SkShader::kClamp_TileMode, |
| 707 SkShader::kRepeat_TileMode, | 707 SkShader::kRepeat_TileMode, |
| 708 SkShader::kMirror_TileMode, | 708 SkShader::kMirror_TileMode, |
| 709 }; | 709 }; |
| 710 SkShader::TileMode tileModes[] = { | 710 SkShader::TileMode tileModes[] = { |
| 711 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 711 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| 712 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], | 712 kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], |
| 713 }; | 713 }; |
| 714 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : | 714 GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBil
erp_FilterMode : |
| 715 GrTextureParams::kNone_FilterMode); | 715 GrTextureParams::kNone_FilterMode); |
| 716 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; | 716 DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; |
| 717 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; | 717 uint32_t flags = kUseLCD_DistanceFieldEffectFlag; |
| 718 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; | 718 flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; |
| 719 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; | 719 flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; |
| 720 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), | 720 return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), |
| 721 GrTest::TestMatrix(random), | 721 GrTest::TestMatrix(random), |
| 722 textures[texIdx], params, | 722 textures[texIdx], params, |
| 723 wa, | 723 wa, |
| 724 flags, | 724 flags, |
| 725 random->nextBool()); | 725 random->nextBool()); |
| 726 } | 726 } |
| OLD | NEW |