Chromium Code Reviews

Unified Diff: include/core/SkEmptyShader.h

Issue 207683004: 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: clean up Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: include/core/SkEmptyShader.h
diff --git a/include/core/SkEmptyShader.h b/include/core/SkEmptyShader.h
index 3f7dae41a9f4911490c191d4c56463902a4ec4fb..ad7703d5e6f10cfc46e63cd14529c666c5009a38 100644
--- a/include/core/SkEmptyShader.h
+++ b/include/core/SkEmptyShader.h
@@ -15,20 +15,19 @@
/**
* \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 createContext always returns NULL.
*/
class SK_API SkEmptyShader : public SkShader {
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 contextSize() const SK_OVERRIDE { return sizeof(SkShader::Context); }
scroggo 2014/03/24 21:24:46 It seems misleading to me that this returns a non-
Dominik Grewe 2014/03/26 17:22:22 I agree it's misleading but the problem is that we
scroggo 2014/03/26 23:13:09 Ah, that makes sense. I'll see if I can find it,
Dominik Grewe 2014/03/27 14:27:20 Only for SkGradientShader which isn't implement ye
+
+ virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&,
+ const SkMatrix&, void*) const SK_OVERRIDE {
+ // validContext returns false.
+ return NULL;
+ }
SK_DEVELOPER_TO_STRING()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
@@ -36,6 +35,8 @@ public:
protected:
SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
+ virtual bool validContext(const SkBitmap&, const SkPaint&,
+ const SkMatrix&) SK_OVERRIDE { return false; }
private:
typedef SkShader INHERITED;
};
« no previous file with comments | « include/core/SkComposeShader.h ('k') | include/core/SkShader.h » ('j') | include/core/SkShader.h » ('J')

Powered by Google App Engine