diff options
author | Herb Derby <herb@google.com> | 2017-02-07 14:25:11 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-07 20:01:20 +0000 |
commit | 83e939bcb79790f5ae3b28c398fbcf034675a6e5 (patch) | |
tree | 40b52134dece685757f7a1c1c69aa575a82f5100 /include/core/SkShader.h | |
parent | 77a7a1b57c16c97f056c1e50c03bdc954947778c (diff) |
Use SkArenaAlloc in the SkAutoBlitterChoose code.
- Added default implementation of onMakeContext to support use in android.
Searches for uses:
"public SkShader" package:^chromium$ -file:^src/third_party/skia
package:^aosp.* "public SkShader" -file:external/skia -file:.*third_party/skia
package:^android$ "public SkShader" -file:external/skia -file:.*third_party/skia
... shows that no subclass overrides onCreateContext.
TBR=reed@google.com
TBR=mtklein@google.com
Change-Id: I8bd5f57a79534574e344b165d31dccee41c31767
Reviewed-on: https://skia-review.googlesource.com/8140
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'include/core/SkShader.h')
-rw-r--r-- | include/core/SkShader.h | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h index 30a10dcc9f..4c264e4741 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -17,9 +17,9 @@ #include "SkPaint.h" #include "../gpu/GrColor.h" +class SkArenaAlloc; class SkColorFilter; class SkColorSpace; -class SkArenaAlloc; class SkImage; class SkPath; class SkPicture; @@ -229,15 +229,11 @@ public: }; /** - * Create the actual object that does the shading. - * Size of storage must be >= contextSize. - */ - Context* createContext(const ContextRec&, void* storage) const; - - /** - * Return the size of a Context returned by createContext. + * Make a context using the memory provided by the arena. + * + * @return pointer to context or nullptr if can't be created */ - size_t contextSize(const ContextRec&) const; + Context* makeContext(const ContextRec&, SkArenaAlloc*) const; #ifdef SK_SUPPORT_LEGACY_SHADER_ISABITMAP /** @@ -476,16 +472,12 @@ protected: bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; /** - * Your subclass must also override contextSize() if it overrides onCreateContext(). - * Base class impl returns NULL. + * Specialize creating a SkShader context using the supplied allocator. + * @return pointer to context owned by the arena allocator. */ - virtual Context* onCreateContext(const ContextRec&, void* storage) const; - - /** - * Override this if your subclass overrides createContext, to return the correct size of - * your subclass' context. - */ - virtual size_t onContextSize(const ContextRec&) const; + virtual Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const { + return nullptr; + } virtual bool onAsLuminanceColor(SkColor*) const { return false; |