Index: src/gpu/GrPathRange.cpp |
diff --git a/src/gpu/GrPathRange.cpp b/src/gpu/GrPathRange.cpp |
index 3d0f7cf27e3f09c968797080b98a20dff66e9e6f..cfe89feaf660bcb1d1677bd7141adb61b26556ad 100644 |
--- a/src/gpu/GrPathRange.cpp |
+++ b/src/gpu/GrPathRange.cpp |
@@ -32,17 +32,29 @@ GrPathRange::GrPathRange(GrGpu* gpu, |
fStroke(stroke) { |
} |
-void GrPathRange::willDrawPaths(const uint32_t indices[], int count) const { |
- if (NULL == fPathGenerator.get()) { |
+void GrPathRange::willDrawPaths(const void* indices, PathIndexType indexType, int count) const { |
+ if (!fPathGenerator) { |
return; |
} |
+ switch (indexType) { |
+ case kU8_PathIndexType: return this->willDrawPaths<uint8_t>(indices, count); |
+ case kU16_PathIndexType: return this->willDrawPaths<uint16_t>(indices, count); |
+ case kU32_PathIndexType: return this->willDrawPaths<uint32_t>(indices, count); |
+ default: SkFAIL("Unknown path index type"); |
+ } |
+} |
+ |
+template<typename IndexType> void GrPathRange::willDrawPaths(const void* indices, int count) const { |
+ SkASSERT(fPathGenerator); |
+ |
+ const IndexType* indexArray = reinterpret_cast<const IndexType*>(indices); |
bool didLoadPaths = false; |
for (int i = 0; i < count; ++i) { |
- SkASSERT(indices[i] < static_cast<uint32_t>(fNumPaths)); |
+ SkASSERT(indexArray[i] < static_cast<uint32_t>(fNumPaths)); |
- const int groupIndex = indices[i] / kPathsPerGroup; |
+ const int groupIndex = indexArray[i] / kPathsPerGroup; |
const int groupByte = groupIndex / 8; |
const uint8_t groupBit = 1 << (groupIndex % 8); |