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

Unified Diff: include/effects/SkPerlinNoiseShader.h

Issue 241283003: Revert of Extract most of the mutable state of SkShader into a separate Context object. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkShader.h ('k') | include/effects/SkTransparentShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkPerlinNoiseShader.h
diff --git a/include/effects/SkPerlinNoiseShader.h b/include/effects/SkPerlinNoiseShader.h
index 5b270293b16a19b70db7878e67ceb1242772e01e..dfd5a8c1e72da46d4332369e98e81c7983695ca6 100644
--- a/include/effects/SkPerlinNoiseShader.h
+++ b/include/effects/SkPerlinNoiseShader.h
@@ -72,32 +72,10 @@
}
- virtual SkShader::Context* createContext(
- const SkBitmap& device, const SkPaint& paint,
- const SkMatrix& matrix, void* storage) const SK_OVERRIDE;
- virtual size_t contextSize() const SK_OVERRIDE;
-
- class PerlinNoiseShaderContext : public SkShader::Context {
- public:
- PerlinNoiseShaderContext(const SkPerlinNoiseShader& shader, const SkBitmap& device,
- const SkPaint& paint, const SkMatrix& matrix);
- virtual ~PerlinNoiseShaderContext() {}
-
- virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
- virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRIDE;
-
- private:
- SkPMColor shade(const SkPoint& point, StitchData& stitchData) const;
- SkScalar calculateTurbulenceValueForPoint(
- int channel, const PaintingData& paintingData,
- StitchData& stitchData, const SkPoint& point) const;
- SkScalar noise2D(int channel, const PaintingData& paintingData,
- const StitchData& stitchData, const SkPoint& noiseVector) const;
-
- SkMatrix fMatrix;
-
- typedef SkShader::Context INHERITED;
- };
+ virtual bool setContext(const SkBitmap& device, const SkPaint& paint,
+ const SkMatrix& matrix);
+ virtual void shadeSpan(int x, int y, SkPMColor[], int count) SK_OVERRIDE;
+ virtual void shadeSpan16(int x, int y, uint16_t[], int count) SK_OVERRIDE;
virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE;
@@ -114,6 +92,14 @@
const SkISize* tileSize);
virtual ~SkPerlinNoiseShader();
+ SkScalar noise2D(int channel, const PaintingData& paintingData,
+ const StitchData& stitchData, const SkPoint& noiseVector) const;
+
+ SkScalar calculateTurbulenceValueForPoint(int channel, const PaintingData& paintingData,
+ StitchData& stitchData, const SkPoint& point) const;
+
+ SkPMColor shade(const SkPoint& point, StitchData& stitchData) const;
+
// TODO (scroggo): Once all SkShaders are created from a factory, and we have removed the
// constructor that creates SkPerlinNoiseShader from an SkReadBuffer, several fields can
// be made constant.
@@ -124,6 +110,8 @@
/*const*/ SkScalar fSeed;
/*const*/ SkISize fTileSize;
/*const*/ bool fStitchTiles;
+ // TODO (scroggo): Once setContext creates a new object, place this on that object.
+ SkMatrix fMatrix;
PaintingData* fPaintingData;
« no previous file with comments | « include/core/SkShader.h ('k') | include/effects/SkTransparentShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698