diff options
author | 2013-10-24 11:12:47 +0000 | |
---|---|---|
committer | 2013-10-24 11:12:47 +0000 | |
commit | 381010e5501a8d681f8f059486da74f4924f81e5 (patch) | |
tree | c9b6f751e45257d91db0fba13ea8dc3c1f7ffa63 /src | |
parent | 583b18a20959c9ac360316a366f4ddd9598bdf52 (diff) |
Expose SkPicture::willPlayBackBitmaps()
This returns true if (1) the picture has finished recording and
(2) this picture or any picture drawn into it refers to any bitmaps.
It allows clients doing complicated manipulations of the picture to
early-out when there are no bitmaps present.
BUG=303281
R=reed@google.com
git-svn-id: http://skia.googlecode.com/svn/trunk@11935 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPicture.cpp | 5 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 12 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.h | 2 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index 1df56a52d7..4acc549377 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -354,6 +354,11 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { } } +bool SkPicture::willPlayBackBitmaps() const { + if (!fPlayback) return false; + return fPlayback->containsBitmaps(); +} + #ifdef SK_BUILD_FOR_ANDROID void SkPicture::abortPlayback() { if (NULL == fPlayback) { diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index f95c44343d..4ce29c8dbb 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -300,6 +300,18 @@ void SkPicturePlayback::dumpSize() const { SafeCount(fRegions)); } +bool SkPicturePlayback::containsBitmaps() const { + if (fBitmaps && fBitmaps->count() > 0) { + return true; + } + for (int i = 0; i < fPictureCount; ++i) { + if (fPictureRefs[i]->willPlayBackBitmaps()) { + return true; + } + } + return false; +} + /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 86c976c37a..6eb9ac3425 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -73,6 +73,8 @@ public: void dumpSize() const; + bool containsBitmaps() const; + #ifdef SK_BUILD_FOR_ANDROID // Can be called in the middle of playback (the draw() call). WIll abort the // drawing and return from draw() after the "current" op code is done |