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

Unified Diff: src/gpu/GrPathRange.cpp

Issue 746253003: Add IndexType parameter to GrDrawTarget::drawPaths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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/gpu/GrPathRange.h ('k') | src/gpu/GrPathRendering.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/gpu/GrPathRange.h ('k') | src/gpu/GrPathRendering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698