diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-13 18:28:06 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-13 18:28:06 +0000 |
commit | 6f6dfb4e8c0e71ff75c63b27c1a3ca71d1e36bbb (patch) | |
tree | fbb8cf6192ed136b9fd3e6911411dd9863a96a42 | |
parent | 3959a76ab086a4adbdb9d48977fa276ce0213cb1 (diff) |
Added profiling stubs to SkPicturePlayback
https://codereview.appspot.com/6851044/
git-svn-id: http://skia.googlecode.com/svn/trunk@6397 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 21 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.h | 6 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index 5d4098a872..b1b51122cf 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -574,6 +574,14 @@ struct SkipClipRec { }; #endif +#ifdef SK_PICTURE_PROFILING_STUBS +void SkPicturePlayback::preDraw(size_t offset, int type) { +} + +void SkPicturePlayback::postDraw(size_t offset) { +} +#endif + void SkPicturePlayback::draw(SkCanvas& canvas) { #ifdef ENABLE_TIME_DRAW SkAutoTime at("SkPicture::draw", 50); @@ -622,7 +630,14 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { SkMatrix initialMatrix = canvas.getTotalMatrix(); while (!reader.eof()) { - switch (reader.readInt()) { +#ifdef SK_PICTURE_PROFILING_STUBS + size_t curOffset = reader.offset(); +#endif + int type = reader.readInt(); +#ifdef SK_PICTURE_PROFILING_STUBS + this->preDraw(curOffset, type); +#endif + switch (type) { case CLIP_PATH: { const SkPath& path = getPath(reader); uint32_t packed = reader.readInt(); @@ -865,6 +880,10 @@ void SkPicturePlayback::draw(SkCanvas& canvas) { SkASSERT(0); } +#ifdef SK_PICTURE_PROFILING_STUBS + this->postDraw(curOffset); +#endif + if (it.isValid()) { uint32_t off = it.draw(); if (off == SK_MaxU32) { diff --git a/src/core/SkPicturePlayback.h b/src/core/SkPicturePlayback.h index 24bce4e7eb..8a7ee0af32 100644 --- a/src/core/SkPicturePlayback.h +++ b/src/core/SkPicturePlayback.h @@ -77,6 +77,12 @@ public: // drawing and return from draw() after the "current" op code is done void abort(); +protected: +#ifdef SK_PICTURE_PROFILING_STUBS + virtual void preDraw(size_t offset, int type); + virtual void postDraw(size_t offset); +#endif + private: class TextContainer { public: |