aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-02-07 17:28:15 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 17:28:21 +0000
commitdd8b72ae7319598cfc1024901e860c52f06e6ae1 (patch)
treeb6e94e11c082c691512f8989ae55794fa2e6b756 /include
parent1f2fff2544a9dc6a0f169a017d374eca9f04c6b5 (diff)
Revert "Use SkArenaAlloc instead of SkSmallAllocator in the SkAutoBlitterChoose code."
This reverts commit 2b57b7f7a7fc97db57f190b5a8ebcf68e177ee2d. Reason for revert: Android compile failing Original change's description: > 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> > TBR=mtklein@chromium.org,mtklein@google.com,herb@google.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: Id09c35377dddae0811d998b7d0c34c422325a5bc Reviewed-on: https://skia-review.googlesource.com/8129 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkShader.h26
-rw-r--r--include/effects/SkPerlinNoiseShader.h3
2 files changed, 20 insertions, 9 deletions
diff --git a/include/core/SkShader.h b/include/core/SkShader.h
index 97cad6e04e..30a10dcc9f 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,11 +229,15 @@ public:
};
/**
- * Make a context using the memory provided by the arena.
- *
- * @return pointer to context or nullptr if can't be created
+ * Create the actual object that does the shading.
+ * Size of storage must be >= contextSize.
*/
- Context* makeContext(const ContextRec&, SkArenaAlloc*) const;
+ Context* createContext(const ContextRec&, void* storage) const;
+
+ /**
+ * Return the size of a Context returned by createContext.
+ */
+ size_t contextSize(const ContextRec&) const;
#ifdef SK_SUPPORT_LEGACY_SHADER_ISABITMAP
/**
@@ -472,10 +476,16 @@ protected:
bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const;
/**
- * Specialize creating a SkShader context using the supplied allocator.
- * @return pointer to context owned by the arena allocator.
+ * 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.
*/
- virtual Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const = 0;
+ virtual size_t onContextSize(const ContextRec&) const;
virtual bool onAsLuminanceColor(SkColor*) const {
return false;
diff --git a/include/effects/SkPerlinNoiseShader.h b/include/effects/SkPerlinNoiseShader.h
index 4e648f31b1..45d4367adb 100644
--- a/include/effects/SkPerlinNoiseShader.h
+++ b/include/effects/SkPerlinNoiseShader.h
@@ -92,7 +92,8 @@ public:
protected:
void flatten(SkWriteBuffer&) const override;
- Context* onMakeContext(const ContextRec&, SkArenaAlloc* storage) const override;
+ Context* onCreateContext(const ContextRec&, void* storage) const override;
+ size_t onContextSize(const ContextRec&) const override;
private:
SkPerlinNoiseShader(SkPerlinNoiseShader::Type type, SkScalar baseFrequencyX,