aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-07 20:48:56 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-07 20:48:56 +0000
commit5f97114fd28e03e8c4c1c22c924d383b45cdced1 (patch)
tree7a6287e1cb446c4b454512e753b458161077f97d /src/core
parentc6b3e48cb3a22d83ba3f4b9a614a5a35b05958a0 (diff)
Make debugger profiling honor deleted commands
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkPicturePlayback.cpp28
-rw-r--r--src/core/SkPicturePlayback.h2
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