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

Side by Side Diff: experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.h

Issue 1759653004: enforce 16byte alignment in shader contexts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef SkPerlinNoiseShader2_DEFINED 8 #ifndef SkPerlinNoiseShader2_DEFINED
9 #define SkPerlinNoiseShader2_DEFINED 9 #define SkPerlinNoiseShader2_DEFINED
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 */ 73 */
74 static SkShader* CreateImprovedNoise(SkScalar baseFrequencyX, SkScalar baseF requencyY, 74 static SkShader* CreateImprovedNoise(SkScalar baseFrequencyX, SkScalar baseF requencyY,
75 int numOctaves, SkScalar z); 75 int numOctaves, SkScalar z);
76 /** 76 /**
77 * Create alias for CreateTurbulunce until all Skia users changed 77 * Create alias for CreateTurbulunce until all Skia users changed
78 * its code to use the new naming 78 * its code to use the new naming
79 */ 79 */
80 static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequ encyY, 80 static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequ encyY,
81 int numOctaves, SkScalar seed, 81 int numOctaves, SkScalar seed,
82 const SkISize* tileSize = NULL) { 82 const SkISize* tileSize = NULL) {
83 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, ti leSize); 83 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed , tileSize);
84 } 84 }
85 85
86
87 size_t contextSize(const ContextRec&) const override;
88
89 class PerlinNoiseShaderContext : public SkShader::Context { 86 class PerlinNoiseShaderContext : public SkShader::Context {
90 public: 87 public:
91 PerlinNoiseShaderContext(const SkPerlinNoiseShader2& shader, const Conte xtRec&); 88 PerlinNoiseShaderContext(const SkPerlinNoiseShader2& shader, const Conte xtRec&);
92 virtual ~PerlinNoiseShaderContext(); 89 virtual ~PerlinNoiseShaderContext();
93 90
94 void shadeSpan(int x, int y, SkPMColor[], int count) override; 91 void shadeSpan(int x, int y, SkPMColor[], int count) override;
95 92
96 private: 93 private:
97 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const; 94 SkPMColor shade(const SkPoint& point, StitchData& stitchData) const;
98 SkScalar calculateTurbulenceValueForPoint( 95 SkScalar calculateTurbulenceValueForPoint(
(...skipping 12 matching lines...) Expand all
111 #if SK_SUPPORT_GPU 108 #if SK_SUPPORT_GPU
112 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM atrix& viewM, 109 const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkM atrix& viewM,
113 const SkMatrix*, SkFilterQual ity) const override; 110 const SkMatrix*, SkFilterQual ity) const override;
114 #endif 111 #endif
115 112
116 SK_TO_STRING_OVERRIDE() 113 SK_TO_STRING_OVERRIDE()
117 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader2) 114 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPerlinNoiseShader2)
118 115
119 protected: 116 protected:
120 void flatten(SkWriteBuffer&) const override; 117 void flatten(SkWriteBuffer&) const override;
118 size_t onContextSize(const ContextRec&) const override;
121 Context* onCreateContext(const ContextRec&, void* storage) const override; 119 Context* onCreateContext(const ContextRec&, void* storage) const override;
122 120
123 private: 121 private:
124 SkPerlinNoiseShader2(SkPerlinNoiseShader2::Type type, SkScalar baseFrequency X, 122 SkPerlinNoiseShader2(SkPerlinNoiseShader2::Type type, SkScalar baseFrequency X,
125 SkScalar baseFrequencyY, int numOctaves, SkScalar seed, 123 SkScalar baseFrequencyY, int numOctaves, SkScalar seed,
126 const SkISize* tileSize); 124 const SkISize* tileSize);
127 virtual ~SkPerlinNoiseShader2(); 125 virtual ~SkPerlinNoiseShader2();
128 126
129 const SkPerlinNoiseShader2::Type fType; 127 const SkPerlinNoiseShader2::Type fType;
130 const SkScalar fBaseFrequencyX; 128 const SkScalar fBaseFrequencyX;
131 const SkScalar fBaseFrequencyY; 129 const SkScalar fBaseFrequencyY;
132 const int fNumOctaves; 130 const int fNumOctaves;
133 const SkScalar fSeed; 131 const SkScalar fSeed;
134 const SkISize fTileSize; 132 const SkISize fTileSize;
135 const bool fStitchTiles; 133 const bool fStitchTiles;
136 134
137 typedef SkShader INHERITED; 135 typedef SkShader INHERITED;
138 }; 136 };
139 137
140 #endif 138 #endif
OLDNEW
« no previous file with comments | « no previous file | experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698