[PDF] Improve efficiency of glyph id collection during font subsetting.
Patch from Arthur Hsu, original CL: http://codereview.appspot.com/4828044/
Review URL: http://codereview.appspot.com/4798057
git-svn-id: http://skia.googlecode.com/svn/trunk@1978 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkBitSet.cpp b/src/pdf/SkBitSet.cpp
index c7af832..4f2b335 100755
--- a/src/pdf/SkBitSet.cpp
+++ b/src/pdf/SkBitSet.cpp
@@ -89,3 +89,19 @@
}
return true;
}
+
+void SkBitSet::exportTo(SkTDArray<uint32_t>* array) const {
+ SkASSERT(array);
+ uint32_t* data = (uint32_t*)fBitData.get();
+ for (unsigned int i = 0; i < fDwordCount; ++i) {
+ uint32_t value = data[i];
+ if (value) { // There are set bits
+ unsigned int index = i * 32;
+ for (unsigned int j = 0; j < 32; ++j) {
+ if (0x1 & (value >> j)) {
+ array->push(index + j);
+ }
+ }
+ }
+ }
+}