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

Side by Side Diff: src/core/SkRecords.h

Issue 510953002: Can't hurt to make this SkNoncopyable. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | no next file » | 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 2014 Google Inc. 2 * Copyright 2014 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 SkRecords_DEFINED 8 #ifndef SkRecords_DEFINED
9 #define SkRecords_DEFINED 9 #define SkRecords_DEFINED
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 ACT_AS_PTR(fPtr); 174 ACT_AS_PTR(fPtr);
175 private: 175 private:
176 T* fPtr; 176 T* fPtr;
177 }; 177 };
178 178
179 #undef ACT_AS_PTR 179 #undef ACT_AS_PTR
180 180
181 // Like SkBitmap, but deep copies pixels if they're not immutable. 181 // Like SkBitmap, but deep copies pixels if they're not immutable.
182 // Using this, we guarantee the immutability of all bitmaps we record. 182 // Using this, we guarantee the immutability of all bitmaps we record.
183 class ImmutableBitmap { 183 class ImmutableBitmap : SkNoncopyable {
184 public: 184 public:
185 explicit ImmutableBitmap(const SkBitmap& bitmap) { 185 explicit ImmutableBitmap(const SkBitmap& bitmap) {
186 if (bitmap.isImmutable()) { 186 if (bitmap.isImmutable()) {
187 fBitmap = bitmap; 187 fBitmap = bitmap;
188 } else { 188 } else {
189 bitmap.copyTo(&fBitmap); 189 bitmap.copyTo(&fBitmap);
190 } 190 }
191 fBitmap.setImmutable(); 191 fBitmap.setImmutable();
192 } 192 }
193 193
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 #undef RECORD0 325 #undef RECORD0
326 #undef RECORD1 326 #undef RECORD1
327 #undef RECORD2 327 #undef RECORD2
328 #undef RECORD3 328 #undef RECORD3
329 #undef RECORD4 329 #undef RECORD4
330 #undef RECORD5 330 #undef RECORD5
331 331
332 } // namespace SkRecords 332 } // namespace SkRecords
333 333
334 #endif//SkRecords_DEFINED 334 #endif//SkRecords_DEFINED
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698