diff options
author | Mike Klein <mtklein@chromium.org> | 2018-01-26 09:49:48 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-28 00:18:37 +0000 |
commit | fbe6620284a5df423f00ef5b935a24f0682cba29 (patch) | |
tree | 5446b5d72fdf9aa6d67696d4e4d7f389ae99628b /src/core | |
parent | d3c1b84a6e26d9f6acd09c221048c4f5ddbd9bbb (diff) |
add SkPicture::MakePlaceholder()
Bug: skia:7536
Change-Id: I6ca7c680ef4fd69419254dc7f1af27343dbb8e89
Reviewed-on: https://skia-review.googlesource.com/99664
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPicture.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index a8cb0d7c40..85b22ac20f 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -316,3 +316,19 @@ void SkPicture::flatten(SkWriteBuffer& buffer) const { } } +sk_sp<SkPicture> SkPicture::MakePlaceholder(SkRect cull) { + struct Placeholder : public SkPicture { + explicit Placeholder(SkRect cull) : fCull(cull) {} + + void playback(SkCanvas*, AbortCallback*) const override { } + + // approximateOpCount() needs to be greater than kMaxPictureOpsToUnrollInsteadOfRef + // in SkCanvas.cpp to avoid that unrolling. SK_MaxS32 can't not be big enough! + int approximateOpCount() const override { return SK_MaxS32; } + size_t approximateBytesUsed() const override { return sizeof(*this); } + SkRect cullRect() const override { return fCull; } + + SkRect fCull; + }; + return sk_make_sp<Placeholder>(cull); +} |