aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkShader.h
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2017-02-06 15:26:09 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 15:43:45 +0000
commit2b57b7f7a7fc97db57f190b5a8ebcf68e177ee2d (patch)
tree9b50da8887f7826d7f7f83ecab7f30eaddb7d7cf /include/core/SkShader.h
parente970d5965d041a9f67de7f49a0e27b9f1f6554a6 (diff)
Use SkArenaAlloc instead of SkSmallAllocator in the SkAutoBlitterChoose code.
TBR=reed@google.com Change-Id: Iefb044bf7657fbf982f23aa91a3f4d013ce2c626 Reviewed-on: https://skia-review.googlesource.com/7786 Reviewed-by: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Herb Derby <herb@google.com>
Diffstat (limited to 'include/core/SkShader.h')
-rw-r--r--include/core/SkShader.h26
1 files changed, 8 insertions, 18 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 30a10dcc9f..97cad6e04e 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,10 @@ protected:
bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const;
/**
- * Your subclass must also override contextSize() if it overrides onCreateContext().
- * Base class impl returns NULL.
- */
- virtual Context* onCreateContext(const ContextRec&, void* storage) const;
-
- /**
- * Override this if your subclass overrides createContext, to return the correct size of
- * your subclass' context.
+ * Specialize creating a SkShader context using the supplied allocator.
+ * @return pointer to context owned by the arena allocator.
*/
- virtual size_t onContextSize(const ContextRec&) const;
+ virtual Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const = 0;
virtual bool onAsLuminanceColor(SkColor*) const {
return false;