OLD | NEW |
---|---|
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 Loading... | |
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. beginCommentGroup/endCommentGroup open/close a new group. | |
851 Each comment added via addComment is notionally attached to its | |
852 enclosing group. Top-level comments simply belong to no group. | |
853 */ | |
854 virtual void beginCommentGroup(const char* description); | |
855 virtual void addComment(const char* kywd, const char* value); | |
856 virtual void endCommentGroup(); | |
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 Loading... | |
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->endCommentGroup(); | |
1151 } | |
1152 } | |
1153 | |
1154 private: | |
1155 SkCanvas* fCanvas; | |
1156 | |
1157 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.
| |
1158 fCanvas = canvas; | |
1159 if (NULL != fCanvas) { | |
1160 fCanvas->beginCommentGroup(description); | |
1161 } | |
1162 } | |
1163 }; | |
1164 | |
1132 #endif | 1165 #endif |
OLD | NEW |