aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkShader.cpp
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 /src/core/SkShader.cpp
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 'src/core/SkShader.cpp')
-rw-r--r--src/core/SkShader.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index 9da760f843..9f97a7a74a 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -90,11 +90,23 @@ bool SkShader::asLuminanceColor(SkColor* colorPtr) const {
return false;
}
-SkShader::Context* SkShader::makeContext(const ContextRec& rec, SkArenaAlloc* alloc) const {
+SkShader::Context* SkShader::createContext(const ContextRec& rec, void* storage) const {
if (!this->computeTotalInverse(rec, nullptr)) {
return nullptr;
}
- return this->onMakeContext(rec, alloc);
+ return this->onCreateContext(rec, storage);
+}
+
+SkShader::Context* SkShader::onCreateContext(const ContextRec& rec, void*) const {
+ return nullptr;
+}
+
+size_t SkShader::contextSize(const ContextRec& rec) const {
+ return this->onContextSize(rec);
+}
+
+size_t SkShader::onContextSize(const ContextRec&) const {
+ return 0;
}
SkShader::Context::Context(const SkShader& shader, const ContextRec& rec)
@@ -274,7 +286,16 @@ bool SkShader::onAppendStages(SkRasterPipeline* p,
}
ContextRec rec(*opaquePaint, ctm, localM, ContextRec::kPM4f_DstType, cs);
- if (auto* ctx = this->makeContext(rec, alloc)) {
+ if (auto* ctx = this->createContext(rec,
+ alloc->makeArrayDefault<char>(this->contextSize(rec)))) {
+ struct ContextDestroyer {
+ ContextDestroyer(Context* ctx) : fContext(ctx) {}
+ ~ContextDestroyer() { fContext->~Context(); }
+
+ Context* fContext;
+ };
+
+ alloc->make<ContextDestroyer>(ctx);
p->append(SkRasterPipeline::shader_adapter, ctx);
// Legacy shaders aren't aware of color spaces. We can pretty