Index: include/core/SkCanvas.h |
=================================================================== |
--- include/core/SkCanvas.h (revision 9288) |
+++ include/core/SkCanvas.h (working copy) |
@@ -852,8 +852,25 @@ |
subclasses like SkPicture's recording canvas, that can store the data |
and then play it back later (via another call to drawData). |
*/ |
- virtual void drawData(const void* data, size_t length); |
+ virtual void drawData(const void* data, size_t length) { |
+ // do nothing. Subclasses may do something with the data |
+ } |
+ /** Add comments. beginCommentGroup/endCommentGroup open/close a new group. |
+ Each comment added via addComment is notionally attached to its |
+ enclosing group. Top-level comments simply belong to no group. |
+ */ |
+ virtual void beginCommentGroup(const char* description) { |
+ // do nothing. Subclasses may do something |
+ } |
+ virtual void addComment(const char* kywd, const char* value) { |
+ // do nothing. Subclasses may do something |
+ } |
+ virtual void endCommentGroup() { |
+ // do nothing. Subclasses may do something |
+ } |
+ |
+ |
////////////////////////////////////////////////////////////////////////// |
/** Get the current bounder object. |
@@ -1138,4 +1155,25 @@ |
int fSaveCount; |
}; |
+/** Stack helper class to automatically open and close a comment block |
+ */ |
+class SkAutoCommentBlock : SkNoncopyable { |
+public: |
+ SkAutoCommentBlock(SkCanvas* canvas, const char* description) { |
+ fCanvas = canvas; |
+ if (NULL != fCanvas) { |
+ fCanvas->beginCommentGroup(description); |
+ } |
+ } |
+ |
+ ~SkAutoCommentBlock() { |
+ if (NULL != fCanvas) { |
+ fCanvas->endCommentGroup(); |
+ } |
+ } |
+ |
+private: |
+ SkCanvas* fCanvas; |
+}; |
+ |
#endif |