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

Side by Side Diff: src/core/SkBitmap.cpp

Issue 1514503004: SkBitmap move (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-12-14 (Monday) 12:27:36 EST Created 5 years 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
« include/core/SkBitmap.h ('K') | « include/core/SkBitmap.h ('k') | 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 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
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
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
OLDNEW
« include/core/SkBitmap.h ('K') | « include/core/SkBitmap.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698