Add xps device to skia.
http://codereview.appspot.com/5076041/
git-svn-id: http://skia.googlecode.com/svn/trunk@2437 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/pdf/SkBitSet.h b/include/pdf/SkBitSet.h
index fd564a5..484fc2a 100755
--- a/include/pdf/SkBitSet.h
+++ b/include/pdf/SkBitSet.h
@@ -41,9 +41,24 @@
*/
bool orBits(const SkBitSet& source);
- /** Export set bits to unsigned int array. (used in font subsetting)
+ /** Export indices of set bits to T array.
*/
- void exportTo(SkTDArray<uint32_t>* array) const;
+ template<typename T>
+ void exportTo(SkTDArray<T>* array) const {
+ SkASSERT(array);
+ uint32_t* data = reinterpret_cast<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);
+ }
+ }
+ }
+ }
+ }
private:
SkAutoFree fBitData;