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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 if (fCanvas) { | 1151 if (fCanvas) { |
1152 fCanvas->restoreToCount(fSaveCount); | 1152 fCanvas->restoreToCount(fSaveCount); |
1153 fCanvas = NULL; | 1153 fCanvas = NULL; |
1154 } | 1154 } |
1155 } | 1155 } |
1156 | 1156 |
1157 private: | 1157 private: |
1158 SkCanvas* fCanvas; | 1158 SkCanvas* fCanvas; |
1159 int fSaveCount; | 1159 int fSaveCount; |
1160 }; | 1160 }; |
| 1161 #define SkAutoCanvasRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoCanvasRestore) |
1161 | 1162 |
1162 /** Stack helper class to automatically open and close a comment block | 1163 /** Stack helper class to automatically open and close a comment block |
1163 */ | 1164 */ |
1164 class SkAutoCommentBlock : SkNoncopyable { | 1165 class SkAutoCommentBlock : SkNoncopyable { |
1165 public: | 1166 public: |
1166 SkAutoCommentBlock(SkCanvas* canvas, const char* description) { | 1167 SkAutoCommentBlock(SkCanvas* canvas, const char* description) { |
1167 fCanvas = canvas; | 1168 fCanvas = canvas; |
1168 if (NULL != fCanvas) { | 1169 if (NULL != fCanvas) { |
1169 fCanvas->beginCommentGroup(description); | 1170 fCanvas->beginCommentGroup(description); |
1170 } | 1171 } |
1171 } | 1172 } |
1172 | 1173 |
1173 ~SkAutoCommentBlock() { | 1174 ~SkAutoCommentBlock() { |
1174 if (NULL != fCanvas) { | 1175 if (NULL != fCanvas) { |
1175 fCanvas->endCommentGroup(); | 1176 fCanvas->endCommentGroup(); |
1176 } | 1177 } |
1177 } | 1178 } |
1178 | 1179 |
1179 private: | 1180 private: |
1180 SkCanvas* fCanvas; | 1181 SkCanvas* fCanvas; |
1181 }; | 1182 }; |
| 1183 #define SkAutoCommentBlock(...) SK_REQUIRE_LOCAL_VAR(SkAutoCommentBlock) |
1182 | 1184 |
1183 #endif | 1185 #endif |
OLD | NEW |