Changeset 190918 in webkit


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

Add canvas line segment tests
https://bugs.webkit.org/show_bug.cgi?id=150073
<rdar://problem/23082138>

Reviewed by Dean Jackson.

  • Animometer/runner/resources/tests.js: Add new line segment tests, with different

line caps.

  • Animometer/tests/simple/resources/simple-canvas-paths.js:

(CanvasLineSegment): Add new line segment paint object.
(CanvasLineSegmentStage): Create a new stage that sets the lineCap.

Location:
trunk/PerformanceTests
Files:
3 edited

Legend:

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

    r190917 r190918  
    140140    [
    141141        {
     142            url: "simple/simple-canvas-paths.html?pathType=line&lineCap=butt",
     143            name: "Canvas line segments, butt caps"
     144        },
     145        {
     146            url: "simple/simple-canvas-paths.html?pathType=line&lineCap=round",
     147            name: "Canvas line segments, round caps"
     148        },
     149        {
     150            url: "simple/simple-canvas-paths.html?pathType=line&lineCap=square",
     151            name: "Canvas line segments, square caps"
     152        },
     153        {
    142154            url: "simple/simple-canvas-paths.html?pathType=quadratic",
    143155            name: "Canvas quadratic segments"
  • trunk/PerformanceTests/Animometer/tests/simple/resources/simple-canvas-paths.js

    r190917 r190918  
    11// === PAINT OBJECTS ===
     2
     3function CanvasLineSegment(stage) {
     4    var radius = stage.randomInt(10, 100);
     5    var center = stage.randomPosition(stage.size);
     6    var delta = Point.pointOnCircle(stage.randomAngle(), radius/2);
     7
     8    this._point1 = center.add(delta);
     9    this._point2 = center.subtract(delta);
     10    this._color = stage.randomColor();
     11    this._lineWidth = stage.randomInt(1, 100);
     12}
     13CanvasLineSegment.prototype.draw = function(context) {
     14    context.strokeStyle = this._color;
     15    context.lineWidth = this._lineWidth;
     16    context.beginPath();
     17    context.moveTo(this._point1.x, this._point1.y);
     18    context.lineTo(this._point2.x, this._point2.y);
     19    context.stroke();
     20};
    221
    322function CanvasLinePoint(stage, coordinateMaximum) {
     
    166185}
    167186
     187function CanvasLineSegmentStage(element, options)
     188{
     189    SimpleCanvasStage.call(this, element, options, CanvasLineSegment);
     190    this.context.lineCap = options["lineCap"] || "butt";
     191}
     192CanvasLineSegmentStage.prototype = Object.create(SimpleCanvasStage.prototype);
     193CanvasLineSegmentStage.prototype.constructor = CanvasLineSegmentStage;
     194
    168195// === BENCHMARK ===
    169196
     
    176203{
    177204    switch (this._options["pathType"]) {
     205    case "line":
     206        return new CanvasLineSegmentStage(element, this._options);
    178207    case "quadratic":
    179208        return new SimpleCanvasStage(element, this._options, CanvasQuadraticSegment);
  • trunk/PerformanceTests/ChangeLog

    r190917 r190918  
     12015-10-12  Jon Lee  <jonlee@apple.com>
     2
     3        Add canvas line segment tests
     4        https://bugs.webkit.org/show_bug.cgi?id=150073
     5        <rdar://problem/23082138>
     6
     7        Reviewed by Dean Jackson.
     8
     9        * Animometer/runner/resources/tests.js: Add new line segment tests, with different
     10        line caps.
     11        * Animometer/tests/simple/resources/simple-canvas-paths.js:
     12        (CanvasLineSegment): Add new line segment paint object.
     13        (CanvasLineSegmentStage): Create a new stage that sets the lineCap.
     14
    1152015-10-12  Jon Lee  <jonlee@apple.com>
    216
Note: See TracChangeset for help on using the changeset viewer.