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

Unified Diff: include/core/SkEmptyShader.h

Issue 198193005: Work (in progress) to make SkShader immutable. (Closed) Base URL: https://skia.googlesource.com/skia.git@shaderGenerator
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: include/core/SkEmptyShader.h
diff --git a/include/core/SkEmptyShader.h b/include/core/SkEmptyShader.h
index 3f7dae41a9f4911490c191d4c56463902a4ec4fb..5f145e557489c94611200802d77b23a12f202b25 100644
--- a/include/core/SkEmptyShader.h
+++ b/include/core/SkEmptyShader.h
@@ -15,20 +15,23 @@
/**
* \class SkEmptyShader
- * A Shader that always draws nothing. Its setContext always returns false,
- * so it never expects that its shadeSpan() methods will get called.
+ * A Shader that always draws nothing. Its validContext always returns false,
+ * and it never creates a ShaderImpl.
*/
-class SK_API SkEmptyShader : public SkShader {
+class SK_API SkEmptyShader : public SkShaderGenerator {
public:
SkEmptyShader() {}
- virtual uint32_t getFlags() SK_OVERRIDE;
- virtual uint8_t getSpan16Alpha() const SK_OVERRIDE;
- virtual bool setContext(const SkBitmap&, const SkPaint&,
- const SkMatrix&) SK_OVERRIDE;
- virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRIDE;
- virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRIDE;
- virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVERRIDE;
+ virtual size_t shaderImplSize() const SK_OVERRIDE { return 0; }
+
+ virtual bool validContext(const SkBitmap&, const SkPaint&,
+ const SkMatrix&) SK_OVERRIDE { return false; }
+ virtual ShaderImpl* createShaderImpl(const SkBitmap&, const SkPaint&,
+ const SkMatrix&, void*) const SK_OVERRIDE {
+ // Should never be called, since validContext returns false.
+ SkASSERT(false);
+ return NULL;
+ }
SK_DEVELOPER_TO_STRING()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
@@ -37,7 +40,7 @@ protected:
SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
private:
- typedef SkShader INHERITED;
+ typedef SkShaderGenerator INHERITED;
};
#endif
« no previous file with comments | « include/core/SkComposeShader.h ('k') | include/core/SkShader.h » ('j') | src/core/SkShader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698