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

Unified Diff: src/utils/SkBitSet.h

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/pdf/SkPDFTypes.cpp ('k') | src/utils/SkBitSet.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkBitSet.h
diff --git a/src/utils/SkBitSet.h b/src/utils/SkBitSet.h
index 6882752bc0640e91ff7b7d8502c4c150ce7d2e23..1e35c9120f47f3862efa56a9490747ab1907379b 100644
--- a/src/utils/SkBitSet.h
+++ b/src/utils/SkBitSet.h
@@ -17,10 +17,11 @@ public:
/** NumberOfBits must be greater than zero.
*/
explicit SkBitSet(int numberOfBits);
- explicit SkBitSet(const SkBitSet& source);
- explicit SkBitSet(SkBitSet&&);
+ SkBitSet(const SkBitSet&) = delete;
+ SkBitSet(SkBitSet&&);
+ SkBitSet& operator=(const SkBitSet&) = delete;
+ SkBitSet& operator=(SkBitSet&& rhs);
- SkBitSet& operator=(const SkBitSet& rhs);
bool operator==(const SkBitSet& rhs);
bool operator!=(const SkBitSet& rhs);
@@ -39,6 +40,15 @@ public:
*chunk &= ~mask;
}
}
+ void set(int index) { this->setBit(index, true); }
+
+ template<typename T>
+ void setAll(T* array, int len) {
+ static_assert(std::is_integral<T>::value, "T is integral");
+ for (int i = 0; i < len; ++i) {
+ this->set(static_cast<int>(array[i]));
+ }
+ }
/** Test if bit index is set.
*/
@@ -46,6 +56,7 @@ public:
uint32_t mask = 1 << (index & 31);
return SkToBool(*this->internalGet(index) & mask);
}
+ bool has(int index) const { return this->isBitSet(index); }
/** Or bits from source. false is returned if this doesn't have the same
* bit count as source.
@@ -56,6 +67,7 @@ public:
*/
template<typename T>
void exportTo(SkTDArray<T>* array) const {
+ static_assert(std::is_integral<T>::value, "T is integral");
SkASSERT(array);
uint32_t* data = reinterpret_cast<uint32_t*>(fBitData.get());
for (unsigned int i = 0; i < fDwordCount; ++i) {
« no previous file with comments | « src/pdf/SkPDFTypes.cpp ('k') | src/utils/SkBitSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698