Index: include/core/SkCanvas.h |
=================================================================== |
--- include/core/SkCanvas.h (revision 8806) |
+++ include/core/SkCanvas.h (working copy) |
@@ -847,6 +847,14 @@ |
*/ |
virtual void drawData(const void* data, size_t length); |
+ /** 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); |
+ virtual void addComment(const char* kywd, const char* value); |
+ virtual void endCommentGroup(); |
+ |
////////////////////////////////////////////////////////////////////////// |
/** Get the current bounder object. |
@@ -1129,4 +1137,29 @@ |
int fSaveCount; |
}; |
+/** Stack helper class to automatically open and close a comment block |
+ */ |
+class SkAutoCommentBlock : SkNoncopyable { |
+public: |
+ SkAutoCommentBlock(SkCanvas* canvas, const char* description) { |
+ this->init(canvas, description); |
+ } |
+ |
+ ~SkAutoCommentBlock() { |
+ if (NULL != fCanvas) { |
+ fCanvas->endCommentGroup(); |
+ } |
+ } |
+ |
+private: |
+ SkCanvas* fCanvas; |
+ |
+ void init(SkCanvas* canvas, const char* description) { |
djsollen
2013/05/28 14:19:11
why have an additional method for the setup?
robertphillips
2013/05/28 15:45:31
Done.
|
+ fCanvas = canvas; |
+ if (NULL != fCanvas) { |
+ fCanvas->beginCommentGroup(description); |
+ } |
+ } |
+}; |
+ |
#endif |