Changeset 196211 in webkit


Ignore:
Timestamp:
Feb 5, 2016 10:21:37 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Add a new graphics test for CanvasRenderingContext2D functions: getImageData and putImageData
https://bugs.webkit.org/show_bug.cgi?id=151716

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2016-02-05
Reviewed by Darin Adler.

The purpose of this test is to measure the performance of getImageData
and putImageData functions. This test draws a background on the canvas
and then gets some random tiles from this background and draw them in
destinations different from their original sources.

  • Animometer/resources/debug-runner/tests.js: Adding the new test to the canvas simple tests suite.
  • Animometer/resources/extensions.js:

(Array.prototype.shuffle): Shuffles the elements of an array.

(Point.zero): Returns a new Point object whose x and y are equal zero.
(Point.prototype.str): Used for debugging the Point object.

  • Animometer/tests/simple/resources/tiled-canvas-image.js: Added.

(CanvasImageTile):
(CanvasImageTile.prototype.getImageData):
(CanvasImageTile.prototype.putImageData):
(Stage.call.initialize):
(Stage.call._createTiles):
(Stage.call._nextTilePosition):
(Stage.call.tune):
(Stage.call._drawBackground):
(Stage.call.animate):
(Stage.call.complexity):
(Stage.call):

  • Animometer/tests/simple/tiled-canvas-image.html: Added.
Location:
trunk/PerformanceTests
Files:
2 added
3 edited

Legend:

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

    r194520 r196211  
    236236            url: "simple/simple-canvas-paths.html?pathType=rectFill",
    237237            name: "Canvas rects, fill"
    238         }
     238        },
     239        {
     240            url: "simple/tiled-canvas-image.html",
     241            name: "Canvas put/get image data"
     242        },
    239243    ]
    240244));
  • trunk/PerformanceTests/Animometer/resources/extensions.js

    r194755 r196211  
    4949}
    5050
     51Array.prototype.shuffle = function()
     52{
     53    for (var index = this.length - 1; index >= 0; --index) {
     54        var randomIndex = Math.floor(Math.random() * (index + 1));
     55        this.swap(index, randomIndex);
     56    }
     57    return this;
     58}
     59
    5160function Point(x, y)
    5261{
     
    5564}
    5665
     66Point.zero = function()
     67{
     68    return new Point(0, 0);
     69}
     70
    5771Point.pointOnCircle = function(angle, radius)
    5872{
     
    91105    },
    92106
     107    str: function()
     108    {
     109        return "x = " + this.x + ", y = " + this.y;
     110    },
     111   
    93112    add: function(other)
    94113    {
  • trunk/PerformanceTests/ChangeLog

    r194756 r196211  
     12016-02-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Add a new graphics test for CanvasRenderingContext2D functions: getImageData and putImageData
     4        https://bugs.webkit.org/show_bug.cgi?id=151716
     5
     6        Reviewed by Darin Adler.
     7
     8        The purpose of this test is to measure the performance of getImageData
     9        and putImageData functions. This test draws a background on the canvas
     10        and then gets some random tiles from this background and draw them in
     11        destinations different from their original sources.
     12       
     13        * Animometer/resources/debug-runner/tests.js: Adding the new test to the canvas simple tests suite.
     14       
     15        * Animometer/resources/extensions.js:
     16        (Array.prototype.shuffle): Shuffles the elements of an array.
     17       
     18        (Point.zero): Returns a new Point object whose x and y are equal zero.
     19        (Point.prototype.str): Used for debugging the Point object.
     20       
     21        * Animometer/tests/simple/resources/tiled-canvas-image.js: Added.
     22        (CanvasImageTile):
     23        (CanvasImageTile.prototype.getImageData):
     24        (CanvasImageTile.prototype.putImageData):
     25        (Stage.call.initialize):
     26        (Stage.call._createTiles):
     27        (Stage.call._nextTilePosition):
     28        (Stage.call.tune):
     29        (Stage.call._drawBackground):
     30        (Stage.call.animate):
     31        (Stage.call.complexity):
     32        (Stage.call):
     33        * Animometer/tests/simple/tiled-canvas-image.html: Added.
     34
    1352016-01-07  Jon Lee  <jonlee@apple.com>
    236
Note: See TracChangeset for help on using the changeset viewer.