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

Side by Side Diff: include/core/SkCanvas.h

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo autoasciitolc Created 7 years, 1 month 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 | « include/core/SkBitmap.h ('k') | include/core/SkMask.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 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « include/core/SkBitmap.h ('k') | include/core/SkMask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698