aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkColorFilterShader.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2017-02-07 14:25:11 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-07 20:01:20 +0000
commit83e939bcb79790f5ae3b28c398fbcf034675a6e5 (patch)
tree40b52134dece685757f7a1c1c69aa575a82f5100 /src/core/SkColorFilterShader.cpp
parent77a7a1b57c16c97f056c1e50c03bdc954947778c (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 'src/core/SkColorFilterShader.cpp')
-rw-r--r--src/core/SkColorFilterShader.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/core/SkColorFilterShader.cpp b/src/core/SkColorFilterShader.cpp
index 4090a18b45..5e96b24b41 100644
--- a/src/core/SkColorFilterShader.cpp
+++ b/src/core/SkColorFilterShader.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkArenaAlloc.h"
#include "SkColorFilterShader.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
@@ -52,19 +53,15 @@ uint32_t SkColorFilterShader::FilterShaderContext::getFlags() const {
return shaderF;
}
-SkShader::Context* SkColorFilterShader::onCreateContext(const ContextRec& rec,
- void* storage) const {
- char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext);
- SkShader::Context* shaderContext = fShader->createContext(rec, shaderContextStorage);
+SkShader::Context* SkColorFilterShader::onMakeContext(const ContextRec& rec,
+ SkArenaAlloc* alloc) const {
+ SkShader::Context* shaderContext = fShader->makeContext(rec, alloc);
if (nullptr == shaderContext) {
return nullptr;
}
- return new (storage) FilterShaderContext(*this, shaderContext, rec);
+ return alloc->make<FilterShaderContext>(*this, shaderContext, rec);
}
-size_t SkColorFilterShader::onContextSize(const ContextRec& rec) const {
- return sizeof(FilterShaderContext) + fShader->contextSize(rec);
-}
SkColorFilterShader::FilterShaderContext::FilterShaderContext(
const SkColorFilterShader& filterShader,
@@ -74,10 +71,6 @@ SkColorFilterShader::FilterShaderContext::FilterShaderContext(
, fShaderContext(shaderContext)
{}
-SkColorFilterShader::FilterShaderContext::~FilterShaderContext() {
- fShaderContext->~Context();
-}
-
void SkColorFilterShader::FilterShaderContext::shadeSpan(int x, int y, SkPMColor result[],
int count) {
const SkColorFilterShader& filterShader = static_cast<const SkColorFilterShader&>(fShader);