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

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: rebase 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/SkComposeShader.h ('k') | include/core/SkShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkEmptyShader.h
diff --git a/include/core/SkEmptyShader.h b/include/core/SkEmptyShader.h
index d2ebb61221fed2f5425ad7168953a8b8a10d3cc3..7494eff3d079e0eee6d3c50f4adb300cbfcf663c 100644
--- a/include/core/SkEmptyShader.h
+++ b/include/core/SkEmptyShader.h
@@ -15,20 +15,28 @@
/**
* \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 {
+ // Even though createContext returns NULL we have to return a value of at least
+ // sizeof(SkShader::Context) to satisfy SkSmallAllocator.
+ return sizeof(SkShader::Context);
+ }
+
+ virtual bool validContext(const SkBitmap&, const SkPaint&,
+ const SkMatrix&, SkMatrix* totalInverse = NULL) const SK_OVERRIDE {
+ return false;
+ }
+
+ virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&,
+ const SkMatrix&, void*) const SK_OVERRIDE {
+ // validContext returns false.
+ return NULL;
+ }
SK_TO_STRING_OVERRIDE()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
« no previous file with comments | « include/core/SkComposeShader.h ('k') | include/core/SkShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698