Index: src/gpu/SkGpuDevice.cpp |
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
index 7c4f4519d1b9496917c2ecadf84d096539e0627a..48ae845e3bb36afcc8f5d520c34d0e4bae717d1d 100644 |
--- a/src/gpu/SkGpuDevice.cpp |
+++ b/src/gpu/SkGpuDevice.cpp |
@@ -1622,7 +1622,7 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, |
SkAutoTDeleteArray<uint16_t> outAlloc(NULL); |
GrPrimitiveType primType; |
GrPaint grPaint; |
- |
+ |
// If both textures and vertex-colors are NULL, strokes hairlines with the paint's color. |
if ((NULL == texs || NULL == paint.getShader()) && NULL == colors) { |
@@ -1638,13 +1638,14 @@ void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, |
primType = kLines_GrPrimitiveType; |
int triangleCount = 0; |
+ int n = (NULL == indices) ? vertexCount : indexCount; |
switch (vmode) { |
case SkCanvas::kTriangles_VertexMode: |
- triangleCount = indexCount / 3; |
+ triangleCount = n / 3; |
break; |
case SkCanvas::kTriangleStrip_VertexMode: |
case SkCanvas::kTriangleFan_VertexMode: |
- triangleCount = indexCount - 2; |
+ triangleCount = n - 2; |
break; |
} |