diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 28 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.h | 2 |
2 files changed, 21 insertions, 9 deletions
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index d0a29d3c9d..a337264d55 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -577,7 +577,8 @@ struct SkipClipRec { #endif #ifdef SK_PICTURE_PROFILING_STUBS -void SkPicturePlayback::preDraw(size_t offset, int type) { +size_t SkPicturePlayback::preDraw(size_t offset, int type) { + return 0; } void SkPicturePlayback::postDraw(size_t offset) { @@ -597,6 +598,10 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { SkAutoMutexAcquire autoMutex(fDrawMutex); #endif + // kDrawComplete will be the signal that we have reached the end of + // the command stream + static const int kDrawComplete = SK_MaxU32; + SkReader32 reader(fOpData->bytes(), fOpData->size()); TextContainer text; SkTDArray<void*> results; @@ -621,11 +626,11 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { fStateTree->getIterator(results, &canvas); if (it.isValid()) { - uint32_t off = it.draw(); - if (off == SK_MaxU32) { + uint32_t skipTo = it.draw(); + if (kDrawComplete == skipTo) { return; } - reader.setOffset(off); + reader.setOffset(skipTo); } // Record this, so we can concat w/ it if we encounter a setMatrix() @@ -637,7 +642,14 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { #endif int type = reader.readInt(); #ifdef SK_PICTURE_PROFILING_STUBS - this->preDraw(curOffset, type); + size_t skipTo = this->preDraw(curOffset, type); + if (0 != skipTo) { + if (kDrawComplete == skipTo) { + break; + } + reader.setOffset(skipTo); + continue; + } #endif switch (type) { case CLIP_PATH: { @@ -887,11 +899,11 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { #endif if (it.isValid()) { - uint32_t off = it.draw(); - if (off == SK_MaxU32) { + uint32_t skipTo = it.draw(); + if (kDrawComplete == skipTo) { break; } - reader.setOffset(off); + reader.setOffset(skipTo); } } diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 9e495fa6cf..8f52b19314 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -79,7 +79,7 @@ public: protected: #ifdef SK_PICTURE_PROFILING_STUBS - virtual void preDraw(size_t offset, int type); + virtual size_t preDraw(size_t offset, int type); virtual void postDraw(size_t offset); #endif |