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

Unified Diff: include/core/SkCanvas.h

Issue 13957009: First pass at Comment API (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « gm/rects.cpp ('k') | include/utils/SkDumpCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « gm/rects.cpp ('k') | include/utils/SkDumpCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698