diff options
author | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-01 16:18:09 +0000 |
---|---|---|
committer | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-01 16:18:09 +0000 |
commit | d9b0f480be398cb37c447605109c419e8314cf61 (patch) | |
tree | 3f89d0eb20dee4f1664af25a81266492f89e73e1 /src/core | |
parent | 528a556514fddfd1275cda9f2c2af17abc02c693 (diff) |
Only support SkPicture abort for Android due to the fragility of the existing API
Review URL: https://codereview.appspot.com/7225083
git-svn-id: http://skia.googlecode.com/svn/trunk@7515 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPicture.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 15 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.h | 5 |
3 files changed, 16 insertions, 6 deletions
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index 93c996a44a..3e464e0eb7 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -321,9 +321,11 @@ void SkPicture::serialize(SkWStream* stream, SkSerializationHelpers::EncodeBitma } } +#ifdef SK_BUILD_FOR_ANDROID void SkPicture::abortPlayback() { if (NULL == fPlayback) { return; } fPlayback->abort(); } +#endif diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 7cd25cc837..3ca26d4565 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -680,7 +680,17 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { // Record this, so we can concat w/ it if we encounter a setMatrix() SkMatrix initialMatrix = canvas.getTotalMatrix(); +#ifdef SK_BUILD_FOR_ANDROID + fAbortCurrentPlayback = false; +#endif + while (!reader.eof()) { +#ifdef SK_BUILD_FOR_ANDROID + if (fAbortCurrentPlayback) { + return; + } +#endif + #ifdef SK_DEVELOPER size_t curOffset = reader.offset(); #endif @@ -987,11 +997,6 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { // this->dumpSize(); } -void SkPicturePlayback::abort() { - SkASSERT(!"not supported"); -// fReader.skip(fReader.size() - fReader.offset()); -} - /////////////////////////////////////////////////////////////////////////////// #ifdef SK_DEBUG_SIZE diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index e0010fc919..cd3a6a5c7b 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -74,9 +74,11 @@ public: void dumpSize() 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 - void abort(); + void abort() { fAbortCurrentPlayback = true; } +#endif protected: #ifdef SK_DEVELOPER @@ -219,6 +221,7 @@ private: SkFactoryPlayback* fFactoryPlayback; #ifdef SK_BUILD_FOR_ANDROID SkMutex fDrawMutex; + bool fAbortCurrentPlayback; #endif }; |