Commit 39b3649a authored by Yi Xu's avatar Yi Xu Committed by Commit Bot

Add a new canvas perf tests for clearRect

Added some perf tests to measure speed of clearRect.

Bug: 1054666

Change-Id: Id902281ca2c85c2d1ebc89bac05ea4d85d756969
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2240348Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Yi Xu <yiyix@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786133}
parent c628a9c2
...@@ -62,6 +62,11 @@ class DynamicWebglToHWAcceleratedCanvas(SimpleCanvasPage): ...@@ -62,6 +62,11 @@ class DynamicWebglToHWAcceleratedCanvas(SimpleCanvasPage):
URL = 'file://../simple_canvas/dynamic_webgl_to_hw_accelerated_canvas.html' URL = 'file://../simple_canvas/dynamic_webgl_to_hw_accelerated_canvas.html'
class FillClearRect(SimpleCanvasPage):
BASE_NAME = 'fill_clear_rect.html'
URL = 'file://../simple_canvas/fill_clear_rect.html'
class GetImageData(SimpleCanvasPage): class GetImageData(SimpleCanvasPage):
BASE_NAME = 'get_image_data.html' BASE_NAME = 'get_image_data.html'
URL = 'file://../simple_canvas/get_image_data.html' URL = 'file://../simple_canvas/get_image_data.html'
......
<!DOCTYPE html>
<html>
<head>
<script src="gc.js"></script>
</head>
<body>
<script>
var imgHeight = 2048;
var imgWidth = 2048;
var canvas = document.createElement("canvas");
canvas.width = imgWidth;
canvas.height = imgHeight;
var context = canvas.getContext('2d');
document.body.appendChild(canvas);
function fullClearRect() {
// Test how many times fillRect can be flushed in a second.
context.fillRect(50, 50, imgHeight/2, imgWidth/2);
context.clearRect(0, 0, imgHeight, imgWidth);
context.fillRect(500, 500, imgHeight/2, imgWidth/2);
context.drawImage(canvas, 0, 0, 1, 1, 0, 0, 1, 1);
requestAnimationFrame(fullClearRect);
}
window.onload = function () {
fullClearRect();
}
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment