Changeset 190918 in webkit
- Timestamp:
- Oct 12, 2015 7:10:42 PM (9 years ago)
- Location:
- trunk/PerformanceTests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PerformanceTests/Animometer/runner/resources/tests.js
r190917 r190918 140 140 [ 141 141 { 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 { 142 154 url: "simple/simple-canvas-paths.html?pathType=quadratic", 143 155 name: "Canvas quadratic segments" -
trunk/PerformanceTests/Animometer/tests/simple/resources/simple-canvas-paths.js
r190917 r190918 1 1 // === PAINT OBJECTS === 2 3 function 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 } 13 CanvasLineSegment.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 }; 2 21 3 22 function CanvasLinePoint(stage, coordinateMaximum) { … … 166 185 } 167 186 187 function CanvasLineSegmentStage(element, options) 188 { 189 SimpleCanvasStage.call(this, element, options, CanvasLineSegment); 190 this.context.lineCap = options["lineCap"] || "butt"; 191 } 192 CanvasLineSegmentStage.prototype = Object.create(SimpleCanvasStage.prototype); 193 CanvasLineSegmentStage.prototype.constructor = CanvasLineSegmentStage; 194 168 195 // === BENCHMARK === 169 196 … … 176 203 { 177 204 switch (this._options["pathType"]) { 205 case "line": 206 return new CanvasLineSegmentStage(element, this._options); 178 207 case "quadratic": 179 208 return new SimpleCanvasStage(element, this._options, CanvasQuadraticSegment); -
trunk/PerformanceTests/ChangeLog
r190917 r190918 1 2015-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 1 15 2015-10-12 Jon Lee <jonlee@apple.com> 2 16
Note: See TracChangeset
for help on using the changeset viewer.