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 "SkDither.h" | 8 #include "SkDither.h" |
9 #include "SkPerlinNoiseShader2.h" | 9 #include "SkPerlinNoiseShader2.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 723 |
724 sk_sp<SkShader> shader(d->fRandom->nextBool() ? | 724 sk_sp<SkShader> shader(d->fRandom->nextBool() ? |
725 SkPerlinNoiseShader2::MakeFractalNoise(baseFrequencyX, baseFrequencyY, n
umOctaves, seed, | 725 SkPerlinNoiseShader2::MakeFractalNoise(baseFrequencyX, baseFrequencyY, n
umOctaves, seed, |
726 stitchTiles ? &tileSize : nullptr
) : | 726 stitchTiles ? &tileSize : nullptr
) : |
727 SkPerlinNoiseShader2::MakeTurbulence(baseFrequencyX, baseFrequencyY, num
Octaves, seed, | 727 SkPerlinNoiseShader2::MakeTurbulence(baseFrequencyX, baseFrequencyY, num
Octaves, seed, |
728 stitchTiles ? &tileSize : nullptr))
; | 728 stitchTiles ? &tileSize : nullptr))
; |
729 | 729 |
730 GrPaint grPaint; | 730 GrPaint grPaint; |
731 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 731 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
732 return shader->asFragmentProcessor(SkShader::AsFPArgs(d->fContext, &viewMatr
ix, nullptr, | 732 return shader->asFragmentProcessor(SkShader::AsFPArgs(d->fContext, &viewMatr
ix, nullptr, |
733 kNone_SkFilterQuality, | 733 kNone_SkFilterQuality,
nullptr, |
734 SkSourceGammaTreatment
::kRespect)); | 734 SkSourceGammaTreatment
::kRespect)); |
735 } | 735 } |
736 | 736 |
737 void GrGLPerlinNoise2::emitCode(EmitArgs& args) { | 737 void GrGLPerlinNoise2::emitCode(EmitArgs& args) { |
738 const GrPerlinNoise2Effect& pne = args.fFp.cast<GrPerlinNoise2Effect>(); | 738 const GrPerlinNoise2Effect& pne = args.fFp.cast<GrPerlinNoise2Effect>(); |
739 | 739 |
740 GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; | 740 GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; |
741 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; | 741 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
742 SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0); | 742 SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0); |
743 | 743 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 SkScalar z = SkIntToScalar(d->fRandom->nextU()); | 1131 SkScalar z = SkIntToScalar(d->fRandom->nextU()); |
1132 | 1132 |
1133 sk_sp<SkShader> shader(SkPerlinNoiseShader2::MakeImprovedNoise(baseFrequency
X, | 1133 sk_sp<SkShader> shader(SkPerlinNoiseShader2::MakeImprovedNoise(baseFrequency
X, |
1134 baseFrequency
Y, | 1134 baseFrequency
Y, |
1135 numOctaves, | 1135 numOctaves, |
1136 z)); | 1136 z)); |
1137 | 1137 |
1138 GrPaint grPaint; | 1138 GrPaint grPaint; |
1139 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 1139 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
1140 return shader->asFragmentProcessor(SkShader::AsFPArgs(d->fContext, &viewMatr
ix, nullptr, | 1140 return shader->asFragmentProcessor(SkShader::AsFPArgs(d->fContext, &viewMatr
ix, nullptr, |
1141 kNone_SkFilterQuality, | 1141 kNone_SkFilterQuality,
nullptr, |
1142 SkSourceGammaTreatment
::kRespect)); | 1142 SkSourceGammaTreatment
::kRespect)); |
1143 } | 1143 } |
1144 | 1144 |
1145 void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) { | 1145 void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) { |
1146 GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; | 1146 GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder; |
1147 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; | 1147 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
1148 SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0); | 1148 SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0); |
1149 | 1149 |
1150 fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag, | 1150 fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag, |
1151 kVec2f_GrSLType, kDefault_GrS
LPrecision, | 1151 kVec2f_GrSLType, kDefault_GrS
LPrecision, |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 str->append(" seed: "); | 1397 str->append(" seed: "); |
1398 str->appendScalar(fSeed); | 1398 str->appendScalar(fSeed); |
1399 str->append(" stitch tiles: "); | 1399 str->append(" stitch tiles: "); |
1400 str->append(fStitchTiles ? "true " : "false "); | 1400 str->append(fStitchTiles ? "true " : "false "); |
1401 | 1401 |
1402 this->INHERITED::toString(str); | 1402 this->INHERITED::toString(str); |
1403 | 1403 |
1404 str->append(")"); | 1404 str->append(")"); |
1405 } | 1405 } |
1406 #endif | 1406 #endif |
OLD | NEW |