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

Unified Diff: src/utils/SkBitSet.cpp

Issue 2253283004: SkPDF: in-place font subsetting (Closed) Base URL: https://skia.googlesource.com/skia.git@SkPdfCacheMetrics
Patch Set: 2016-08-18 (Thursday) 16:02:16 EDT Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkBitSet.h ('k') | tests/BitSetTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkBitSet.cpp
diff --git a/src/utils/SkBitSet.cpp b/src/utils/SkBitSet.cpp
index 0a1ecacf8ab2583074d1fe72afaafcd60a51572e..4323ffb6d35e5f1b5cc58d89c6f2b13db63fe979 100755
--- a/src/utils/SkBitSet.cpp
+++ b/src/utils/SkBitSet.cpp
@@ -16,11 +16,6 @@ SkBitSet::SkBitSet(int numberOfBits)
fBitData.set(sk_calloc_throw(fDwordCount * sizeof(uint32_t)));
}
-SkBitSet::SkBitSet(const SkBitSet& source)
- : fBitData(nullptr), fDwordCount(0), fBitCount(0) {
- *this = source;
-}
-
SkBitSet::SkBitSet(SkBitSet&& source)
: fBitData(source.fBitData.release())
, fDwordCount(source.fDwordCount)
@@ -29,15 +24,15 @@ SkBitSet::SkBitSet(SkBitSet&& source)
source.fBitCount = 0;
}
-SkBitSet& SkBitSet::operator=(const SkBitSet& rhs) {
- if (this == &rhs) {
- return *this;
+SkBitSet& SkBitSet::operator=(SkBitSet&& rhs) {
+ if (this != &rhs) {
+ fBitCount = rhs.fBitCount;
+ fDwordCount = rhs.fDwordCount;
+ fBitData.reset(); // Free old pointer.
+ fBitData.set(rhs.fBitData.release());
+ rhs.fBitCount = 0;
+ rhs.fDwordCount = 0;
}
- fBitCount = rhs.fBitCount;
- fBitData.reset();
- fDwordCount = rhs.fDwordCount;
- fBitData.set(sk_malloc_throw(fDwordCount * sizeof(uint32_t)));
- memcpy(fBitData.get(), rhs.fBitData.get(), fDwordCount * sizeof(uint32_t));
return *this;
}
« no previous file with comments | « src/utils/SkBitSet.h ('k') | tests/BitSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698