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 "SkPerlinNoiseShader.h" | 9 #include "SkPerlinNoiseShader.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 0.99f); | 601 0.99f); |
602 SkScalar baseFrequencyY = d->fRandom->nextRangeScalar(0.01f, | 602 SkScalar baseFrequencyY = d->fRandom->nextRangeScalar(0.01f, |
603 0.99f); | 603 0.99f); |
604 | 604 |
605 SkAutoTUnref<SkShader> shader(d->fRandom->nextBool() ? | 605 SkAutoTUnref<SkShader> shader(d->fRandom->nextBool() ? |
606 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY,
numOctaves, seed, | 606 SkPerlinNoiseShader::CreateFractalNoise(baseFrequencyX, baseFrequencyY,
numOctaves, seed, |
607 stitchTiles ? &tileSize : nullpt
r) : | 607 stitchTiles ? &tileSize : nullpt
r) : |
608 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, nu
mOctaves, seed, | 608 SkPerlinNoiseShader::CreateTurbulence(baseFrequencyX, baseFrequencyY, nu
mOctaves, seed, |
609 stitchTiles ? &tileSize : nullptr))
; | 609 stitchTiles ? &tileSize : nullptr))
; |
610 | 610 |
611 GrPaint grPaint; | |
612 return shader->asFragmentProcessor(d->fContext, | 611 return shader->asFragmentProcessor(d->fContext, |
613 GrTest::TestMatrix(d->fRandom), nullptr, | 612 GrTest::TestMatrix(d->fRandom), nullptr, |
614 kNone_SkFilterQuality); | 613 kNone_SkFilterQuality); |
615 } | 614 } |
616 | 615 |
617 GrGLPerlinNoise::GrGLPerlinNoise(const GrProcessor& processor) | 616 GrGLPerlinNoise::GrGLPerlinNoise(const GrProcessor& processor) |
618 : fType(processor.cast<GrPerlinNoiseEffect>().type()) | 617 : fType(processor.cast<GrPerlinNoiseEffect>().type()) |
619 , fStitchTiles(processor.cast<GrPerlinNoiseEffect>().stitchTiles()) | 618 , fStitchTiles(processor.cast<GrPerlinNoiseEffect>().stitchTiles()) |
620 , fNumOctaves(processor.cast<GrPerlinNoiseEffect>().numOctaves()) { | 619 , fNumOctaves(processor.cast<GrPerlinNoiseEffect>().numOctaves()) { |
621 } | 620 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 str->append(" seed: "); | 995 str->append(" seed: "); |
997 str->appendScalar(fSeed); | 996 str->appendScalar(fSeed); |
998 str->append(" stitch tiles: "); | 997 str->append(" stitch tiles: "); |
999 str->append(fStitchTiles ? "true " : "false "); | 998 str->append(fStitchTiles ? "true " : "false "); |
1000 | 999 |
1001 this->INHERITED::toString(str); | 1000 this->INHERITED::toString(str); |
1002 | 1001 |
1003 str->append(")"); | 1002 str->append(")"); |
1004 } | 1003 } |
1005 #endif | 1004 #endif |
OLD | NEW |