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

Unified Diff: include/core/SkCanvas.h

Issue 13957009: First pass at Comment API (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Addressed code review issues Created 7 years, 7 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 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
« 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