| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 paintingData, permutationsTextur
e, noiseTexture, | 520 paintingData, permutationsTextur
e, noiseTexture, |
| 521 matrix, alpha)); | 521 matrix, alpha)); |
| 522 } | 522 } |
| 523 | 523 |
| 524 virtual ~GrPerlinNoiseEffect() { | 524 virtual ~GrPerlinNoiseEffect() { |
| 525 SkDELETE(fPaintingData); | 525 SkDELETE(fPaintingData); |
| 526 } | 526 } |
| 527 | 527 |
| 528 const char* name() const override { return "PerlinNoise"; } | 528 const char* name() const override { return "PerlinNoise"; } |
| 529 | 529 |
| 530 virtual void getGLProcessorKey(const GrGLSLCaps& caps, | |
| 531 GrProcessorKeyBuilder* b) const override { | |
| 532 GrGLPerlinNoise::GenKey(*this, caps, b); | |
| 533 } | |
| 534 | |
| 535 GrGLFragmentProcessor* createGLInstance() const override { | 530 GrGLFragmentProcessor* createGLInstance() const override { |
| 536 return SkNEW_ARGS(GrGLPerlinNoise, (*this)); | 531 return SkNEW_ARGS(GrGLPerlinNoise, (*this)); |
| 537 } | 532 } |
| 538 | 533 |
| 539 const SkPerlinNoiseShader::StitchData& stitchData() const { return fPainting
Data->fStitchDataInit; } | 534 const SkPerlinNoiseShader::StitchData& stitchData() const { return fPainting
Data->fStitchDataInit; } |
| 540 | 535 |
| 541 SkPerlinNoiseShader::Type type() const { return fType; } | 536 SkPerlinNoiseShader::Type type() const { return fType; } |
| 542 bool stitchTiles() const { return fStitchTiles; } | 537 bool stitchTiles() const { return fStitchTiles; } |
| 543 const SkVector& baseFrequency() const { return fPaintingData->fBaseFrequency
; } | 538 const SkVector& baseFrequency() const { return fPaintingData->fBaseFrequency
; } |
| 544 int numOctaves() const { return fNumOctaves; } | 539 int numOctaves() const { return fNumOctaves; } |
| 545 const SkMatrix& matrix() const { return fCoordTransform.getMatrix(); } | 540 const SkMatrix& matrix() const { return fCoordTransform.getMatrix(); } |
| 546 uint8_t alpha() const { return fAlpha; } | 541 uint8_t alpha() const { return fAlpha; } |
| 547 | 542 |
| 548 private: | 543 private: |
| 544 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, |
| 545 GrProcessorKeyBuilder* b) const override { |
| 546 GrGLPerlinNoise::GenKey(*this, caps, b); |
| 547 } |
| 548 |
| 549 bool onIsEqual(const GrFragmentProcessor& sBase) const override { | 549 bool onIsEqual(const GrFragmentProcessor& sBase) const override { |
| 550 const GrPerlinNoiseEffect& s = sBase.cast<GrPerlinNoiseEffect>(); | 550 const GrPerlinNoiseEffect& s = sBase.cast<GrPerlinNoiseEffect>(); |
| 551 return fType == s.fType && | 551 return fType == s.fType && |
| 552 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& | 552 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& |
| 553 fNumOctaves == s.fNumOctaves && | 553 fNumOctaves == s.fNumOctaves && |
| 554 fStitchTiles == s.fStitchTiles && | 554 fStitchTiles == s.fStitchTiles && |
| 555 fAlpha == s.fAlpha && | 555 fAlpha == s.fAlpha && |
| 556 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; | 556 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; |
| 557 } | 557 } |
| 558 | 558 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 str->append(" seed: "); | 1027 str->append(" seed: "); |
| 1028 str->appendScalar(fSeed); | 1028 str->appendScalar(fSeed); |
| 1029 str->append(" stitch tiles: "); | 1029 str->append(" stitch tiles: "); |
| 1030 str->append(fStitchTiles ? "true " : "false "); | 1030 str->append(fStitchTiles ? "true " : "false "); |
| 1031 | 1031 |
| 1032 this->INHERITED::toString(str); | 1032 this->INHERITED::toString(str); |
| 1033 | 1033 |
| 1034 str->append(")"); | 1034 str->append(")"); |
| 1035 } | 1035 } |
| 1036 #endif | 1036 #endif |
| OLD | NEW |