OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 #include "SkAtomics.h" | 8 #include "SkAtomics.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // setPixels. | 65 // setPixels. |
66 // Just leave the memcpy'ed one but they'll get out of sync | 66 // Just leave the memcpy'ed one but they'll get out of sync |
67 // as soon either is modified. | 67 // as soon either is modified. |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 SkDEBUGCODE(this->validate();) | 71 SkDEBUGCODE(this->validate();) |
72 return *this; | 72 return *this; |
73 } | 73 } |
74 | 74 |
| 75 SkBitmap& SkBitmap::operator=(SkBitmap&& other) { |
| 76 if (this != &other) { |
| 77 this->swap(other); |
| 78 other.reset(); |
| 79 } |
| 80 return *this; |
| 81 } |
| 82 |
| 83 SkBitmap::SkBitmap(SkBitmap&& other) : SkBitmap() { this->swap(other); } |
| 84 |
75 void SkBitmap::swap(SkBitmap& other) { | 85 void SkBitmap::swap(SkBitmap& other) { |
76 SkTSwap(fColorTable, other.fColorTable); | 86 SkTSwap(fColorTable, other.fColorTable); |
77 SkTSwap(fPixelRef, other.fPixelRef); | 87 SkTSwap(fPixelRef, other.fPixelRef); |
78 SkTSwap(fPixelRefOrigin, other.fPixelRefOrigin); | 88 SkTSwap(fPixelRefOrigin, other.fPixelRefOrigin); |
79 SkTSwap(fPixelLockCount, other.fPixelLockCount); | 89 SkTSwap(fPixelLockCount, other.fPixelLockCount); |
80 SkTSwap(fPixels, other.fPixels); | 90 SkTSwap(fPixels, other.fPixels); |
81 SkTSwap(fInfo, other.fInfo); | 91 SkTSwap(fInfo, other.fInfo); |
82 SkTSwap(fRowBytes, other.fRowBytes); | 92 SkTSwap(fRowBytes, other.fRowBytes); |
83 SkTSwap(fFlags, other.fFlags); | 93 SkTSwap(fFlags, other.fFlags); |
84 | 94 |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 /////////////////////////////////////////////////////////////////////////////// | 1338 /////////////////////////////////////////////////////////////////////////////// |
1329 | 1339 |
1330 #ifdef SK_DEBUG | 1340 #ifdef SK_DEBUG |
1331 void SkImageInfo::validate() const { | 1341 void SkImageInfo::validate() const { |
1332 SkASSERT(fWidth >= 0); | 1342 SkASSERT(fWidth >= 0); |
1333 SkASSERT(fHeight >= 0); | 1343 SkASSERT(fHeight >= 0); |
1334 SkASSERT(SkColorTypeIsValid(fColorType)); | 1344 SkASSERT(SkColorTypeIsValid(fColorType)); |
1335 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); | 1345 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); |
1336 } | 1346 } |
1337 #endif | 1347 #endif |
OLD | NEW |