Fix a crash on stroking empty paths with nv_path_rendering enabled
Fix the crash by defining that GrPathRenderer::drawPath and
GrPathRenderer::stencilPath are called only with non-empty paths.
Adds a new test "GpuDrawPath" and tests the condition.
BUG=1477
R=bsalomon@google.com
Author: kkinnunen@nvidia.com
Review URL: https://chromiumcodereview.appspot.com/22173002
git-svn-id: http://skia.googlecode.com/svn/trunk@10528 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/gl/GrGLPath.cpp b/src/gpu/gl/GrGLPath.cpp
index 63c2fa1..d46fa03 100644
--- a/src/gpu/gl/GrGLPath.cpp
+++ b/src/gpu/gl/GrGLPath.cpp
@@ -59,13 +59,14 @@
static const bool kIsWrapped = false; // The constructor creates the GL path object.
GrGLPath::GrGLPath(GrGpuGL* gpu, const SkPath& path) : INHERITED(gpu, kIsWrapped) {
- GL_CALL_RET(fPathID, GenPaths(1));
- SkPath::Iter iter(path, true);
-
- SkSTArray<16, GrGLubyte, true> pathCommands;
#ifndef SK_SCALAR_IS_FLOAT
GrCrash("Assumes scalar is float.");
#endif
+ SkASSERT(!path.isEmpty());
+
+ GL_CALL_RET(fPathID, GenPaths(1));
+
+ SkSTArray<16, GrGLubyte, true> pathCommands;
SkSTArray<16, SkPoint, true> pathPoints;
int verbCnt = path.countVerbs();