Add canvas line path tests
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Oct 2015 02:11:44 +0000 (02:11 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Oct 2015 02:11:44 +0000 (02:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150076
<rdar://problem/23082285>

Reviewed by Dean Jackson.

* Animometer/runner/resources/tests.js: Add new line path tests, with different
line joins.
* Animometer/tests/simple/resources/simple-canvas-paths.js:
(CanvasLinePathStage): The stage is the same as the SimpleCanvasPathStrokeStage
but sets the lineJoin on the context.
(CanvasPathBenchmark.prototype.createStage): Add the tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190920 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/Animometer/runner/resources/tests.js
PerformanceTests/Animometer/tests/simple/resources/simple-canvas-paths.js
PerformanceTests/ChangeLog

index 741b160..085b903 100644 (file)
@@ -151,6 +151,18 @@ Suites.push(new Suite("Basic canvas path suite",
             name: "Canvas line segments, square caps"
         },
         {
+            url: "simple/simple-canvas-paths.html?pathType=linePath&lineJoin=bevel",
+            name: "Canvas line path, bevel join"
+        },
+        {
+            url: "simple/simple-canvas-paths.html?pathType=linePath&lineJoin=round",
+            name: "Canvas line path, round join"
+        },
+        {
+            url: "simple/simple-canvas-paths.html?pathType=linePath&lineJoin=miter",
+            name: "Canvas line path, miter join"
+        },
+        {
             url: "simple/simple-canvas-paths.html?pathType=quadratic",
             name: "Canvas quadratic segments"
         },
index 25caec5..5b5f755 100644 (file)
@@ -213,6 +213,14 @@ function CanvasLineSegmentStage(element, options)
 CanvasLineSegmentStage.prototype = Object.create(SimpleCanvasStage.prototype);
 CanvasLineSegmentStage.prototype.constructor = CanvasLineSegmentStage;
 
+function CanvasLinePathStage(element, options)
+{
+    SimpleCanvasPathStrokeStage.call(this, element, options, CanvasLinePoint);
+    this.context.lineJoin = options["lineJoin"] || "bevel";
+}
+CanvasLinePathStage.prototype = Object.create(SimpleCanvasPathStrokeStage.prototype);
+CanvasLinePathStage.prototype.constructor = CanvasLinePathStage;
+
 // === BENCHMARK ===
 
 function CanvasPathBenchmark(suite, test, options, recordTable, progressBar) {
@@ -225,6 +233,11 @@ CanvasPathBenchmark.prototype.createStage = function(element)
     switch (this._options["pathType"]) {
     case "line":
         return new CanvasLineSegmentStage(element, this._options);
+    case "linePath": {
+        if ("lineJoin" in this._options)
+            return new CanvasLinePathStage(element, this._options);
+        break;
+    }
     case "quadratic":
         return new SimpleCanvasStage(element, this._options, CanvasQuadraticSegment);
     case "quadraticPath":
index d74559f..286e6d0 100644 (file)
@@ -1,5 +1,20 @@
 2015-10-12  Jon Lee  <jonlee@apple.com>
 
+        Add canvas line path tests
+        https://bugs.webkit.org/show_bug.cgi?id=150076
+        <rdar://problem/23082285>
+
+        Reviewed by Dean Jackson.
+
+        * Animometer/runner/resources/tests.js: Add new line path tests, with different
+        line joins.
+        * Animometer/tests/simple/resources/simple-canvas-paths.js:
+        (CanvasLinePathStage): The stage is the same as the SimpleCanvasPathStrokeStage
+        but sets the lineJoin on the context.
+        (CanvasPathBenchmark.prototype.createStage): Add the tests.
+
+2015-10-12  Jon Lee  <jonlee@apple.com>
+
         Add missing paint objects for arc and arcTo fills
         https://bugs.webkit.org/show_bug.cgi?id=150075
         <rdar://problem/23082233>