Particles: Use list of lines for multi-line string serialization

Change-Id: Ic81b3433b485ca9ce0e60bd10ec12706e673ee89
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229917
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/resources/particles/warp.json b/resources/particles/warp.json
index bf597d5..f495d19 100644
--- a/resources/particles/warp.json
+++ b/resources/particles/warp.json
@@ -6,7 +6,63 @@
       "Type": "SkCircleDrawable",
       "Radius": 2
    },
-   "Spawn": "\n// float rand; Every read returns a random float [0 .. 1)\nlayout(ctype=float) in uniform float dt;\nlayout(ctype=float) in uniform float effectAge;\n\nstruct Particle {\n  float  age;\n  float  lifetime;\n  float2 pos;\n  float2 dir;\n  float  scale;\n  float2 vel;\n  float  spin;\n  float4 color;\n  float  frame;\n};\n\nfloat2 circle() {\n  float x;\n  float y;\n  do {\n    x = rand * 2 - 1;\n    y = rand * 2 - 1;\n  } while (x*x + y*y > 1);\n  return float2(x, y);\n}\n\nvoid main(inout Particle p) {\n  p.lifetime = 30;\n  p.pos = circle() * 40;\n}\n",
-   "Update": "\n// float rand; Every read returns a random float [0 .. 1)\nlayout(ctype=float) in uniform float dt;\nlayout(ctype=float) in uniform float effectAge;\n\nstruct Particle {\n  float  age;\n  float  lifetime;\n  float2 pos;\n  float2 dir;\n  float  scale;\n  float2 vel;\n  float  spin;\n  float4 color;\n  float  frame;\n};\n\nvoid main(inout Particle p) {\n  p.vel += normalize(p.pos) * dt * 10;\n  p.scale = mix(0.25, 3, p.age);\n}\n",
+   "Spawn": [
+      "",
+      "// float rand; Every read returns a random float [0 .. 1)",
+      "layout(ctype=float) in uniform float dt;",
+      "layout(ctype=float) in uniform float effectAge;",
+      "",
+      "struct Particle {",
+      "  float  age;",
+      "  float  lifetime;",
+      "  float2 pos;",
+      "  float2 dir;",
+      "  float  scale;",
+      "  float2 vel;",
+      "  float  spin;",
+      "  float4 color;",
+      "  float  frame;",
+      "};",
+      "",
+      "float2 circle() {",
+      "  float x;",
+      "  float y;",
+      "  do {",
+      "    x = rand * 2 - 1;",
+      "    y = rand * 2 - 1;",
+      "  } while (x*x + y*y > 1);",
+      "  return float2(x, y);",
+      "}",
+      "",
+      "void main(inout Particle p) {",
+      "  p.lifetime = 30;",
+      "  p.pos = circle() * 40;",
+      "}",
+      ""
+   ],
+   "Update": [
+      "",
+      "// float rand; Every read returns a random float [0 .. 1)",
+      "layout(ctype=float) in uniform float dt;",
+      "layout(ctype=float) in uniform float effectAge;",
+      "",
+      "struct Particle {",
+      "  float  age;",
+      "  float  lifetime;",
+      "  float2 pos;",
+      "  float2 dir;",
+      "  float  scale;",
+      "  float2 vel;",
+      "  float  spin;",
+      "  float4 color;",
+      "  float  frame;",
+      "};",
+      "",
+      "void main(inout Particle p) {",
+      "  p.vel += normalize(p.pos) * dt * 10;",
+      "  p.scale = mix(0.25, 3, p.age);",
+      "}",
+      ""
+   ],
    "Bindings": []
 }
\ No newline at end of file