From 6d9c92b2f6e5be64dd5dd98e44d672877e4c9fbc Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Thu, 23 May 2013 13:21:18 +0000 Subject: Remove offsetcanvas from debugger https://codereview.chromium.org/15746003/ git-svn-id: http://skia.googlecode.com/svn/trunk@9253 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPicturePlayback.cpp | 26 ++++++++++++++++---------- src/core/SkPicturePlayback.h | 4 ++-- 2 files changed, 18 insertions(+), 12 deletions(-) (limited to 'src/core') diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index e1c9a3a65f..e4f041f3bb 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -625,11 +625,11 @@ struct SkipClipRec { #endif #ifdef SK_DEVELOPER -size_t SkPicturePlayback::preDraw(size_t offset, int type) { - return 0; +bool SkPicturePlayback::preDraw(int opIndex, int type) { + return false; } -void SkPicturePlayback::postDraw(size_t offset) { +void SkPicturePlayback::postDraw(int opIndex) { } #endif @@ -712,6 +712,10 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) fAbortCurrentPlayback = false; #endif +#ifdef SK_DEVELOPER + int opIndex = -1; +#endif + while (!reader.eof()) { if (callback && callback->abortDrawing()) { canvas.restoreToCount(originalSaveCount); @@ -727,14 +731,16 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) uint32_t size; DrawType op = read_op_and_size(&reader, &size); size_t skipTo = 0; -#ifdef SK_DEVELOPER - // TODO: once chunk sizes are in all .skps just use - // "curOffset + size" - skipTo = this->preDraw(curOffset, op); -#endif - if (0 == skipTo && NOOP == op) { + if (NOOP == op) { // NOOPs are to be ignored - do not propagate them any further skipTo = curOffset + size; +#ifdef SK_DEVELOPER + } else { + opIndex++; + if (this->preDraw(opIndex, op)) { + skipTo = curOffset + size; + } +#endif } if (0 != skipTo) { @@ -1023,7 +1029,7 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) } #ifdef SK_DEVELOPER - this->postDraw(curOffset); + this->postDraw(opIndex); #endif if (it.isValid()) { diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 801900124a..06d180fb44 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -80,8 +80,8 @@ public: protected: #ifdef SK_DEVELOPER - virtual size_t preDraw(size_t offset, int type); - virtual void postDraw(size_t offset); + virtual bool preDraw(int opIndex, int type); + virtual void postDraw(int opIndex); #endif private: -- cgit v1.2.3