diff options
author | Mike Klein <mtklein@chromium.org> | 2016-11-12 10:29:26 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-14 15:21:25 +0000 |
commit | b0d10e05f1054a86a00b42d9089b53d779f8d01e (patch) | |
tree | 6526feaaa8fbfe387766e7e3a403535337e3a7c5 /include/core | |
parent | 7f6cd90f0c8f6e8dd658cb1b1c587b833adfc364 (diff) |
Start hooking shaders into SkRasterPipelineBlitter.
Here first just the simplest, constant-color shaders.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4743
Change-Id: I92c6523660e21a1e2aa353524570230282ba5dfe
Reviewed-on: https://skia-review.googlesource.com/4743
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkShader.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h index 5e21c28331..48e84192ab 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -18,9 +18,11 @@ class SkColorFilter; class SkColorSpace; +class SkFallbackAlloc; class SkImage; class SkPath; class SkPicture; +class SkRasterPipeline; class GrContext; class GrFragmentProcessor; @@ -98,6 +100,12 @@ public: virtual bool isOpaque() const { return false; } /** + * Returns true if the shader is guaranteed to produce only a single color. + * Subclasses can override this to allow loop-hoisting optimization. + */ + virtual bool isConstant() const { return false; } + + /** * ContextRec acts as a parameter bundle for creating Contexts. */ struct ContextRec { @@ -399,7 +407,7 @@ public: ////////////////////////////////////////////////////////////////////////// // Factory methods for stock shaders - + /** * Call this to create a new "empty" shader, that will not draw anything. */ @@ -467,6 +475,8 @@ public: SK_DEFINE_FLATTENABLE_TYPE(SkShader) SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() + bool appendStages(SkRasterPipeline*, SkColorSpace*, SkFallbackAlloc*) const; + protected: void flatten(SkWriteBuffer&) const override; @@ -498,6 +508,10 @@ protected: return nullptr; } + virtual bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkFallbackAlloc*) const { + return false; + } + private: // This is essentially const, but not officially so it can be modified in // constructors. |