OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |