Chromium Code Reviews| 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. beginGroup/endGroup 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 beginGroup(const char* description); |
| + virtual void addComment(const char* kywd, const char* value); |
| + virtual void endGroup(); |
|
djsollen
2013/04/24 13:01:55
Perhaps beginCommentGroup and endCommentGroup woul
|
| + |
| ////////////////////////////////////////////////////////////////////////// |
| /** 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->endGroup(); |
| + } |
| + } |
| + |
| +private: |
| + SkCanvas* fCanvas; |
| + |
| + void init(SkCanvas* canvas, const char* description) { |
| + fCanvas = canvas; |
| + if (NULL != fCanvas) { |
| + fCanvas->beginGroup(description); |
| + } |
| + } |
| +}; |
| + |
| #endif |