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

Unified Diff: src/gpu/GrContext.cpp

Issue 699733002: removing setVertexArraySource from drawtarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: a bit more cleanup 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/GrBufferAllocPool.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 9d684aa1357a8ce86e227e8cee9262d69e8df321..f42844f0642eadb2dda5d6270a427d9a8b9ea54f 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -910,35 +910,32 @@ void GrContext::drawVertices(const GrPaint& paint,
set_vertex_attributes(drawState, texCoords, colors, &colorOffset, &texOffset);
size_t VertexStride = drawState->getVertexStride();
- if (sizeof(SkPoint) != VertexStride) {
- if (!geo.set(target, vertexCount, 0)) {
- SkDebugf("Failed to get space for vertices!\n");
- return;
- }
- void* curVertex = geo.vertices();
+ if (!geo.set(target, vertexCount, indexCount)) {
+ SkDebugf("Failed to get space for vertices!\n");
+ return;
+ }
+ void* curVertex = geo.vertices();
- for (int i = 0; i < vertexCount; ++i) {
- *((SkPoint*)curVertex) = positions[i];
+ for (int i = 0; i < vertexCount; ++i) {
+ *((SkPoint*)curVertex) = positions[i];
- if (texOffset >= 0) {
- *(SkPoint*)((intptr_t)curVertex + texOffset) = texCoords[i];
- }
- if (colorOffset >= 0) {
- *(GrColor*)((intptr_t)curVertex + colorOffset) = colors[i];
- }
- curVertex = (void*)((intptr_t)curVertex + VertexStride);
+ if (texOffset >= 0) {
+ *(SkPoint*)((intptr_t)curVertex + texOffset) = texCoords[i];
}
- } else {
- target->setVertexSourceToArray(positions, vertexCount);
+ if (colorOffset >= 0) {
+ *(GrColor*)((intptr_t)curVertex + colorOffset) = colors[i];
+ }
+ curVertex = (void*)((intptr_t)curVertex + VertexStride);
}
// we don't currently apply offscreen AA to this path. Need improved
// management of GrDrawTarget's geometry to avoid copying points per-tile.
-
if (indices) {
- target->setIndexSourceToArray(indices, indexCount);
+ uint16_t* curIndex = (uint16_t*)geo.indices();
+ for (int i = 0; i < indexCount; ++i) {
+ curIndex[i] = indices[i];
+ }
target->drawIndexed(primitiveType, 0, 0, vertexCount, indexCount);
- target->resetIndexSource();
} else {
target->drawNonIndexed(primitiveType, 0, vertexCount);
}
« no previous file with comments | « src/gpu/GrBufferAllocPool.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698