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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gm/rects.cpp ('k') | include/utils/SkDumpCanvas.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkCanvas_DEFINED 10 #ifndef SkCanvas_DEFINED
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 const SkPaint& paint); 840 const SkPaint& paint);
841 841
842 /** Send a blob of data to the canvas. 842 /** Send a blob of data to the canvas.
843 For canvases that draw, this call is effectively a no-op, as the data 843 For canvases that draw, this call is effectively a no-op, as the data
844 is not parsed, but just ignored. However, this call exists for 844 is not parsed, but just ignored. However, this call exists for
845 subclasses like SkPicture's recording canvas, that can store the data 845 subclasses like SkPicture's recording canvas, that can store the data
846 and then play it back later (via another call to drawData). 846 and then play it back later (via another call to drawData).
847 */ 847 */
848 virtual void drawData(const void* data, size_t length); 848 virtual void drawData(const void* data, size_t length);
849 849
850 /** Add comments. beginGroup/endGroup open/close a new group. Each
851 comment added via addComment is notionally attached to its enclosing
852 group. Top-level comments simply belong to no group.
853 */
854 virtual void beginGroup(const char* description);
855 virtual void addComment(const char* kywd, const char* value);
856 virtual void endGroup();
djsollen 2013/04/24 13:01:55 Perhaps beginCommentGroup and endCommentGroup woul
857
850 ////////////////////////////////////////////////////////////////////////// 858 //////////////////////////////////////////////////////////////////////////
851 859
852 /** Get the current bounder object. 860 /** Get the current bounder object.
853 The bounder's reference count is unchaged. 861 The bounder's reference count is unchaged.
854 @return the canva's bounder (or NULL). 862 @return the canva's bounder (or NULL).
855 */ 863 */
856 SkBounder* getBounder() const { return fBounder; } 864 SkBounder* getBounder() const { return fBounder; }
857 865
858 /** Set a new bounder (or NULL). 866 /** Set a new bounder (or NULL).
859 Pass NULL to clear any previous bounder. 867 Pass NULL to clear any previous bounder.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 fCanvas->restoreToCount(fSaveCount); 1130 fCanvas->restoreToCount(fSaveCount);
1123 fCanvas = NULL; 1131 fCanvas = NULL;
1124 } 1132 }
1125 } 1133 }
1126 1134
1127 private: 1135 private:
1128 SkCanvas* fCanvas; 1136 SkCanvas* fCanvas;
1129 int fSaveCount; 1137 int fSaveCount;
1130 }; 1138 };
1131 1139
1140 /** Stack helper class to automatically open and close a comment block
1141 */
1142 class SkAutoCommentBlock : SkNoncopyable {
1143 public:
1144 SkAutoCommentBlock(SkCanvas* canvas, const char* description) {
1145 this->init(canvas, description);
1146 }
1147
1148 ~SkAutoCommentBlock() {
1149 if (NULL != fCanvas) {
1150 fCanvas->endGroup();
1151 }
1152 }
1153
1154 private:
1155 SkCanvas* fCanvas;
1156
1157 void init(SkCanvas* canvas, const char* description) {
1158 fCanvas = canvas;
1159 if (NULL != fCanvas) {
1160 fCanvas->beginGroup(description);
1161 }
1162 }
1163 };
1164
1132 #endif 1165 #endif
OLDNEW
« 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