Changeset 190917 in webkit


Ignore:
Timestamp:
Oct 12, 2015 7:10:08 PM (9 years ago)
Author:
jonlee@apple.com
Message:

Add canvas path fill tests
https://bugs.webkit.org/show_bug.cgi?id=150071
<rdar://problem/23082001>

Reviewed by Dean Jackson.

  • Animometer/runner/resources/tests.js: Add new pathTypes for path fills.
  • Animometer/tests/simple/resources/simple-canvas-paths.js:

(CanvasLinePoint): Add basic point for a line, and call lineTo.
(SimpleCanvasPathFillStage): Add a new stage similar to SimpleCanvasPathStrokeStage.
(CanvasPathBenchmark.prototype.createStage): Add the tests.

Location:
trunk/PerformanceTests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/PerformanceTests/Animometer/runner/resources/tests.js

    r190913 r190917  
    168168        },
    169169        {
     170            url: "simple/simple-canvas-paths.html?pathType=lineFill",
     171            name: "Canvas line path, fill"
     172        },
     173        {
     174            url: "simple/simple-canvas-paths.html?pathType=quadraticFill",
     175            name: "Canvas quadratic path, fill"
     176        },
     177        {
     178            url: "simple/simple-canvas-paths.html?pathType=bezierFill",
     179            name: "Canvas bezier path, fill"
     180        },
     181        {
    170182            url: "simple/simple-canvas-paths.html?&pathType=arcToFill",
    171183            name: "Canvas arcTo segments, fill"
  • trunk/PerformanceTests/Animometer/tests/simple/resources/simple-canvas-paths.js

    r190913 r190917  
    11// === PAINT OBJECTS ===
     2
     3function CanvasLinePoint(stage, coordinateMaximum) {
     4    this._point = stage.randomPosition(new Point(Math.min(stage.size.x, coordinateMaximum), Math.min(stage.size.y, coordinateMaximum)));
     5}
     6CanvasLinePoint.prototype.draw = function(context) {
     7    context.lineTo(this._point.x, this._point.y);
     8};
    29
    310function CanvasQuadraticSegment(stage) {
     
    141148    });
    142149    context.stroke();
     150}
     151
     152function SimpleCanvasPathFillStage(element, options, canvasObject) {
     153    SimpleCanvasStage.call(this, element, options, canvasObject);
     154}
     155SimpleCanvasPathFillStage.prototype = Object.create(SimpleCanvasStage.prototype);
     156SimpleCanvasPathFillStage.prototype.constructor = SimpleCanvasPathFillStage;
     157SimpleCanvasPathFillStage.prototype.animate = function() {
     158    var context = this.context;
     159    context.fillStyle = this.randomColor();
     160    context.beginPath();
     161    context.moveTo(0,0);
     162    this._objects.forEach(function(object) {
     163        object.draw(context);
     164    });
     165    context.fill();
    143166}
    144167
     
    167190    case "rect":
    168191        return new SimpleCanvasStage(element, this._options, CanvasRect);
     192    case "lineFill":
     193        return new SimpleCanvasPathFillStage(element, this._options, CanvasLinePoint);
     194    case "quadraticFill":
     195        return new SimpleCanvasPathFillStage(element, this._options, CanvasQuadraticPoint);
     196    case "bezierFill":
     197        return new SimpleCanvasPathFillStage(element, this._options, CanvasBezierPoint);
    169198    case "arcToFill":
    170199        return new SimpleCanvasStage(element, this._options, CanvasArcToSegmentFill);
  • trunk/PerformanceTests/ChangeLog

    r190913 r190917  
     12015-10-12  Jon Lee  <jonlee@apple.com>
     2
     3        Add canvas path fill tests
     4        https://bugs.webkit.org/show_bug.cgi?id=150071
     5        <rdar://problem/23082001>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * Animometer/runner/resources/tests.js: Add new pathTypes for path fills.
     10        * Animometer/tests/simple/resources/simple-canvas-paths.js:
     11        (CanvasLinePoint): Add basic point for a line, and call lineTo.
     12        (SimpleCanvasPathFillStage): Add a new stage similar to SimpleCanvasPathStrokeStage.
     13        (CanvasPathBenchmark.prototype.createStage): Add the tests.
     14
    1152015-10-12  Jon Lee  <jonlee@apple.com>
    216
Note: See TracChangeset for help on using the changeset viewer.