SkRasterPipeline: simplify impl and remove need to rewire stages

This builds the stages correctly wired from the get-go.  With a little clever
setup, we can also design around the previous error cases like having no stages
or pipelines that call st->next() off the end.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2149443002

Review-Url: https://codereview.chromium.org/2149443002
diff --git a/tests/SkRasterPipelineTest.cpp b/tests/SkRasterPipelineTest.cpp
index 1db0206..beb517b 100644
--- a/tests/SkRasterPipelineTest.cpp
+++ b/tests/SkRasterPipelineTest.cpp
@@ -85,3 +85,17 @@
     REPORTER_ASSERT(r, dst_vals[3] == 16);
     REPORTER_ASSERT(r, dst_vals[4] == 25);
 }
+
+DEF_TEST(SkRasterPipeline_empty, r) {
+    // No asserts... just a test that this is safe to run.
+    SkRasterPipeline p;
+    p.run(20);
+}
+
+DEF_TEST(SkRasterPipeline_nonsense, r) {
+    // No asserts... just a test that this is safe to run and terminates.
+    // square() always calls st->next(); this makes sure we've always got something there to call.
+    SkRasterPipeline p;
+    p.append(square);
+    p.run(20);
+}