aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-01-30 11:33:46 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-30 17:07:22 +0000
commit8d2fb470729b7a9987aec8c5354ca7a4940ae3be (patch)
treef63fed9fc5695c7df3e3b80f4164490219462846 /src/core
parentefe50eba53490eae4a3fb2d1e5fc76481df4eb49 (diff)
Implement onAppendStages for SkPictureShader
BUG=skia: Change-Id: Ibc525a666f17fed1d987c0316b1963ebed7de343 Reviewed-on: https://skia-review.googlesource.com/7739 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkPictureShader.cpp10
-rw-r--r--src/core/SkPictureShader.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp
index 1f20623592..af66eb2789 100644
--- a/src/core/SkPictureShader.cpp
+++ b/src/core/SkPictureShader.cpp
@@ -7,6 +7,7 @@
#include "SkPictureShader.h"
+#include "SkArenaAlloc.h"
#include "SkBitmap.h"
#include "SkBitmapProcShader.h"
#include "SkCanvas.h"
@@ -255,6 +256,15 @@ SkShader::Context* SkPictureShader::onCreateContext(const ContextRec& rec, void*
return PictureShaderContext::Create(storage, *this, rec, bitmapShader);
}
+bool SkPictureShader::onAppendStages(SkRasterPipeline* p, SkColorSpace* cs, SkArenaAlloc* alloc,
+ const SkMatrix& ctm, const SkPaint& paint,
+ const SkMatrix* localMatrix) const {
+ // Keep bitmapShader alive by using alloc instead of stack memory
+ auto& bitmapShader = *alloc->make<sk_sp<SkShader>>();
+ bitmapShader = this->refBitmapShader(ctm, localMatrix, cs);
+ return bitmapShader && bitmapShader->appendStages(p, cs, alloc, ctm, paint);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
SkShader::Context* SkPictureShader::PictureShaderContext::Create(void* storage,
diff --git a/src/core/SkPictureShader.h b/src/core/SkPictureShader.h
index 6de7e4a249..ff83fa3bb8 100644
--- a/src/core/SkPictureShader.h
+++ b/src/core/SkPictureShader.h
@@ -36,6 +36,8 @@ protected:
void flatten(SkWriteBuffer&) const override;
size_t onContextSize(const ContextRec&) const override;
Context* onCreateContext(const ContextRec&, void* storage) const override;
+ bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
+ const SkMatrix&, const SkPaint&, const SkMatrix*) const override;
private:
SkPictureShader(sk_sp<SkPicture>, TileMode, TileMode, const SkMatrix*, const SkRect*);