Fix drawVertices() on GPU when texs=colors=shaders=indices=null
R=reed@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/449433003
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7c4f451..48ae845 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1622,7 +1622,7 @@
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 @@
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;
}