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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 const SkColor colors[], SkXfermode* xmode, | 845 const SkColor colors[], SkXfermode* xmode, |
846 const uint16_t indices[], int indexCount, | 846 const uint16_t indices[], int indexCount, |
847 const SkPaint& paint); | 847 const SkPaint& paint); |
848 | 848 |
849 /** Send a blob of data to the canvas. | 849 /** Send a blob of data to the canvas. |
850 For canvases that draw, this call is effectively a no-op, as the data | 850 For canvases that draw, this call is effectively a no-op, as the data |
851 is not parsed, but just ignored. However, this call exists for | 851 is not parsed, but just ignored. However, this call exists for |
852 subclasses like SkPicture's recording canvas, that can store the data | 852 subclasses like SkPicture's recording canvas, that can store the data |
853 and then play it back later (via another call to drawData). | 853 and then play it back later (via another call to drawData). |
854 */ | 854 */ |
855 virtual void drawData(const void* data, size_t length); | 855 virtual void drawData(const void* data, size_t length) { |
| 856 // do nothing. Subclasses may do something with the data |
| 857 } |
| 858 |
| 859 /** Add comments. beginCommentGroup/endCommentGroup open/close a new group. |
| 860 Each comment added via addComment is notionally attached to its |
| 861 enclosing group. Top-level comments simply belong to no group. |
| 862 */ |
| 863 virtual void beginCommentGroup(const char* description) { |
| 864 // do nothing. Subclasses may do something |
| 865 } |
| 866 virtual void addComment(const char* kywd, const char* value) { |
| 867 // do nothing. Subclasses may do something |
| 868 } |
| 869 virtual void endCommentGroup() { |
| 870 // do nothing. Subclasses may do something |
| 871 } |
| 872 |
856 | 873 |
857 ////////////////////////////////////////////////////////////////////////// | 874 ////////////////////////////////////////////////////////////////////////// |
858 | 875 |
859 /** Get the current bounder object. | 876 /** Get the current bounder object. |
860 The bounder's reference count is unchaged. | 877 The bounder's reference count is unchaged. |
861 @return the canva's bounder (or NULL). | 878 @return the canva's bounder (or NULL). |
862 */ | 879 */ |
863 SkBounder* getBounder() const { return fBounder; } | 880 SkBounder* getBounder() const { return fBounder; } |
864 | 881 |
865 /** Set a new bounder (or NULL). | 882 /** Set a new bounder (or NULL). |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 fCanvas->restoreToCount(fSaveCount); | 1148 fCanvas->restoreToCount(fSaveCount); |
1132 fCanvas = NULL; | 1149 fCanvas = NULL; |
1133 } | 1150 } |
1134 } | 1151 } |
1135 | 1152 |
1136 private: | 1153 private: |
1137 SkCanvas* fCanvas; | 1154 SkCanvas* fCanvas; |
1138 int fSaveCount; | 1155 int fSaveCount; |
1139 }; | 1156 }; |
1140 | 1157 |
| 1158 /** Stack helper class to automatically open and close a comment block |
| 1159 */ |
| 1160 class SkAutoCommentBlock : SkNoncopyable { |
| 1161 public: |
| 1162 SkAutoCommentBlock(SkCanvas* canvas, const char* description) { |
| 1163 fCanvas = canvas; |
| 1164 if (NULL != fCanvas) { |
| 1165 fCanvas->beginCommentGroup(description); |
| 1166 } |
| 1167 } |
| 1168 |
| 1169 ~SkAutoCommentBlock() { |
| 1170 if (NULL != fCanvas) { |
| 1171 fCanvas->endCommentGroup(); |
| 1172 } |
| 1173 } |
| 1174 |
| 1175 private: |
| 1176 SkCanvas* fCanvas; |
| 1177 }; |
| 1178 |
1141 #endif | 1179 #endif |
OLD | NEW |