| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 template <typename T> | 144 template <typename T> |
| 145 class PODArray : SkNoncopyable { | 145 class PODArray : SkNoncopyable { |
| 146 public: | 146 public: |
| 147 PODArray(T* ptr) : fPtr(ptr) {} | 147 PODArray(T* ptr) : fPtr(ptr) {} |
| 148 | 148 |
| 149 ACT_AS_PTR(fPtr); | 149 ACT_AS_PTR(fPtr); |
| 150 private: | 150 private: |
| 151 T* fPtr; | 151 T* fPtr; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 #undef ACT_AS_PTR |
| 155 |
| 154 // Like SkBitmap, but deep copies pixels if they're not immutable. | 156 // Like SkBitmap, but deep copies pixels if they're not immutable. |
| 155 // Using this, we guarantee the immutability of all bitmaps we record. | 157 // Using this, we guarantee the immutability of all bitmaps we record. |
| 156 class ImmutableBitmap { | 158 class ImmutableBitmap { |
| 157 public: | 159 public: |
| 158 explicit ImmutableBitmap(const SkBitmap& bitmap) { | 160 explicit ImmutableBitmap(const SkBitmap& bitmap) { |
| 159 if (bitmap.isImmutable()) { | 161 if (bitmap.isImmutable()) { |
| 160 fBitmap = bitmap; | 162 fBitmap = bitmap; |
| 161 } else { | 163 } else { |
| 162 bitmap.copyTo(&fBitmap); | 164 bitmap.copyTo(&fBitmap); |
| 163 } | 165 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 #undef RECORD0 | 273 #undef RECORD0 |
| 272 #undef RECORD1 | 274 #undef RECORD1 |
| 273 #undef RECORD2 | 275 #undef RECORD2 |
| 274 #undef RECORD3 | 276 #undef RECORD3 |
| 275 #undef RECORD4 | 277 #undef RECORD4 |
| 276 #undef RECORD5 | 278 #undef RECORD5 |
| 277 | 279 |
| 278 } // namespace SkRecords | 280 } // namespace SkRecords |
| 279 | 281 |
| 280 #endif//SkRecords_DEFINED | 282 #endif//SkRecords_DEFINED |
| OLD | NEW |