Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 206853003: Add new experimental API to SkPicture to get "id" of current op (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicturePlayback.cpp
===================================================================
--- src/core/SkPicturePlayback.cpp (revision 13910)
+++ src/core/SkPicturePlayback.cpp (working copy)
@@ -261,6 +261,7 @@
fBoundingHierarchy = NULL;
fStateTree = NULL;
fCachedActiveOps = NULL;
+ fCurOffset = 0;
}
SkPicturePlayback::~SkPicturePlayback() {
@@ -838,7 +839,23 @@
return *fCachedActiveOps;
}
+class SkAutoResetOpID {
+public:
+ SkAutoResetOpID(SkPicturePlayback* playback) : fPlayback(playback) { }
+ ~SkAutoResetOpID() {
+ if (NULL != fPlayback) {
+ fPlayback->resetOpID();
+ }
+ }
+
+private:
+ SkPicturePlayback* fPlayback;
+};
+
void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) {
+ SkAutoResetOpID aroi(this);
+ SkASSERT(0 == fCurOffset);
+
#ifdef ENABLE_TIME_DRAW
SkAutoTime at("SkPicture::draw", 50);
#endif
@@ -919,18 +936,18 @@
opCount++;
#endif
- size_t curOffset = reader.offset();
+ fCurOffset = reader.offset();
uint32_t size;
DrawType op = read_op_and_size(&reader, &size);
size_t skipTo = 0;
if (NOOP == op) {
// NOOPs are to be ignored - do not propagate them any further
- skipTo = curOffset + size;
+ skipTo = fCurOffset + size;
#ifdef SK_DEVELOPER
} else {
opIndex++;
if (this->preDraw(opIndex, op)) {
- skipTo = curOffset + size;
+ skipTo = fCurOffset + size;
}
#endif
}
« no previous file with comments | « src/core/SkPicturePlayback.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698