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

Side by Side Diff: src/gpu/GrTemplates.h

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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
« no previous file with comments | « src/gpu/GrStrokeInfo.h ('k') | src/gpu/GrTextStrike.cpp » ('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 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrTemplates_DEFINED 8 #ifndef GrTemplates_DEFINED
9 #define GrTemplates_DEFINED 9 #define GrTemplates_DEFINED
10 10
(...skipping 23 matching lines...) Expand all
34 * } 34 * }
35 * ... 35 * ...
36 * } // fCount is restored 36 * } // fCount is restored
37 */ 37 */
38 template <typename T> class GrAutoTRestore : SkNoncopyable { 38 template <typename T> class GrAutoTRestore : SkNoncopyable {
39 public: 39 public:
40 GrAutoTRestore() : fPtr(NULL), fVal() {} 40 GrAutoTRestore() : fPtr(NULL), fVal() {}
41 41
42 GrAutoTRestore(T* ptr) { 42 GrAutoTRestore(T* ptr) {
43 fPtr = ptr; 43 fPtr = ptr;
44 if (NULL != ptr) { 44 if (ptr) {
45 fVal = *ptr; 45 fVal = *ptr;
46 } 46 }
47 } 47 }
48 48
49 ~GrAutoTRestore() { 49 ~GrAutoTRestore() {
50 if (NULL != fPtr) { 50 if (fPtr) {
51 *fPtr = fVal; 51 *fPtr = fVal;
52 } 52 }
53 } 53 }
54 54
55 // restores previously saved value (if any) and saves value for passed T* 55 // restores previously saved value (if any) and saves value for passed T*
56 void reset(T* ptr) { 56 void reset(T* ptr) {
57 if (NULL != fPtr) { 57 if (fPtr) {
58 *fPtr = fVal; 58 *fPtr = fVal;
59 } 59 }
60 fPtr = ptr; 60 fPtr = ptr;
61 fVal = *ptr; 61 fVal = *ptr;
62 } 62 }
63 private: 63 private:
64 T* fPtr; 64 T* fPtr;
65 T fVal; 65 T fVal;
66 }; 66 };
67 67
68 #endif 68 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrStrokeInfo.h ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698