diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-30 23:29:02 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-04-30 23:29:02 +0000 |
commit | 3fb4cc8c3b7c3f77245eefef9691f207615938e1 (patch) | |
tree | 9e771907e9ca1e5c2d19e8fdc92769ef83b601b3 | |
parent | 2177bb3c2fe49955b7ada85acb94968dc19c4391 (diff) | |
download | include-3fb4cc8c3b7c3f77245eefef9691f207615938e1.tar.gz |
add default impl for context methods on shader
These are reasonable return values, since both of these methods can return a known value (0)
which means that no context can be created. This also makes it easier for chrome's subclasses
which already do not want to create a context, but having them actually overridden makes
changing the virtual signatures much harder.
BUG=skia:
R=scroggo@google.com, dominikg@google.com, reed@chromium.org
Author: reed@google.com
Review URL: https://codereview.chromium.org/262703002
git-svn-id: http://skia.googlecode.com/svn/trunk/include@14491 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | core/SkShader.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/SkShader.h b/core/SkShader.h index 4af8f78..b0a7fd9 100644 --- a/core/SkShader.h +++ b/core/SkShader.h @@ -207,16 +207,22 @@ public: * Create the actual object that does the shading. * Returns NULL if validContext() returns false. * Size of storage must be >= contextSize. + * Your subclass must also override contextSize() if it overrides createContext(). + * + * Base class implementation returns NULL. */ virtual Context* createContext(const SkBitmap& device, const SkPaint& paint, const SkMatrix& matrix, - void* storage) const = 0; + void* storage) const; /** * Return the size of a Context returned by createContext. + * + * Override this if your subclass overrides createContext, to return the correct size of + * your subclass' context. */ - virtual size_t contextSize() const = 0; + virtual size_t contextSize() const; /** * Helper to check the flags to know if it is legal to call shadeSpan16() |