Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(523)

Side by Side Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency && 579 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency &&
580 fNumOctaves == s.fNumOctaves && 580 fNumOctaves == s.fNumOctaves &&
581 fStitchTiles == s.fStitchTiles && 581 fStitchTiles == s.fStitchTiles &&
582 fCoordTransform.getMatrix() == s.fCoordTransform.getMatrix() && 582 fCoordTransform.getMatrix() == s.fCoordTransform.getMatrix() &&
583 fAlpha == s.fAlpha && 583 fAlpha == s.fAlpha &&
584 fPermutationsAccess.getTexture() == s.fPermutationsAccess.getText ure() && 584 fPermutationsAccess.getTexture() == s.fPermutationsAccess.getText ure() &&
585 fNoiseAccess.getTexture() == s.fNoiseAccess.getTexture() && 585 fNoiseAccess.getTexture() == s.fNoiseAccess.getTexture() &&
586 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni t; 586 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni t;
587 } 587 }
588 588
589 void onGetConstantColorComponents(GrColor*, uint32_t* validFlags, bool*)cons t SK_OVERRIDE {
590 *validFlags = 0; // This is noise. Nothing is constant.
591 }
592
589 GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, 593 GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type,
590 int numOctaves, bool stitchTiles, 594 int numOctaves, bool stitchTiles,
591 SkPerlinNoiseShader::PaintingData* paintingData, 595 SkPerlinNoiseShader::PaintingData* paintingData,
592 GrTexture* permutationsTexture, GrTexture* noiseTexture, 596 GrTexture* permutationsTexture, GrTexture* noiseTexture,
593 const SkMatrix& matrix, uint8_t alpha) 597 const SkMatrix& matrix, uint8_t alpha)
594 : fType(type) 598 : fType(type)
595 , fNumOctaves(numOctaves) 599 , fNumOctaves(numOctaves)
596 , fStitchTiles(stitchTiles) 600 , fStitchTiles(stitchTiles)
597 , fAlpha(alpha) 601 , fAlpha(alpha)
598 , fPermutationsAccess(permutationsTexture) 602 , fPermutationsAccess(permutationsTexture)
(...skipping 10 matching lines...) Expand all
609 613
610 SkPerlinNoiseShader::Type fType; 614 SkPerlinNoiseShader::Type fType;
611 GrCoordTransform fCoordTransform; 615 GrCoordTransform fCoordTransform;
612 int fNumOctaves; 616 int fNumOctaves;
613 bool fStitchTiles; 617 bool fStitchTiles;
614 uint8_t fAlpha; 618 uint8_t fAlpha;
615 GrTextureAccess fPermutationsAccess; 619 GrTextureAccess fPermutationsAccess;
616 GrTextureAccess fNoiseAccess; 620 GrTextureAccess fNoiseAccess;
617 SkPerlinNoiseShader::PaintingData *fPaintingData; 621 SkPerlinNoiseShader::PaintingData *fPaintingData;
618 622
619 void getConstantColorComponents(GrColor*, uint32_t* validFlags) const SK_OVE RRIDE {
620 *validFlags = 0; // This is noise. Nothing is constant.
621 }
622
623 private: 623 private:
624 typedef GrFragmentProcessor INHERITED; 624 typedef GrFragmentProcessor INHERITED;
625 }; 625 };
626 626
627 ///////////////////////////////////////////////////////////////////// 627 /////////////////////////////////////////////////////////////////////
628 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoiseEffect); 628 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoiseEffect);
629 629
630 GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(SkRandom* random, 630 GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(SkRandom* random,
631 GrContext* context, 631 GrContext* context,
632 const GrDrawTargetCaps&, 632 const GrDrawTargetCaps&,
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 str->append(" seed: "); 1064 str->append(" seed: ");
1065 str->appendScalar(fSeed); 1065 str->appendScalar(fSeed);
1066 str->append(" stitch tiles: "); 1066 str->append(" stitch tiles: ");
1067 str->append(fStitchTiles ? "true " : "false "); 1067 str->append(fStitchTiles ? "true " : "false ");
1068 1068
1069 this->INHERITED::toString(str); 1069 this->INHERITED::toString(str);
1070 1070
1071 str->append(")"); 1071 str->append(")");
1072 } 1072 }
1073 #endif 1073 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698