Commit 4c2c6e8c authored by Yi Xu's avatar Yi Xu Committed by Commit Bot

Fixing nits in canvas-perf

Since Math.random() in python generates a random number in range [0,1),
we need to use rand(256) to generate number [0, 255]. Update all calls
in canvas perftest to call rand(256).

Bug:1087019

Change-Id: I75ded3269cf652d7d352e32eefbfeddb999583b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216736
Commit-Queue: Yi Xu <yiyix@chromium.org>
Reviewed-by: default avatarJuanmi Huertas <juanmihd@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772294}
parent 55e52ff5
...@@ -26,7 +26,7 @@ function rand(range) { ...@@ -26,7 +26,7 @@ function rand(range) {
} }
function randomColor() { function randomColor() {
return "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")"; return "rgba(" + rand(256) + "," + rand(256) + "," + rand(256) + "," + rand(256) + ")";
} }
function makeAndFillCanvasWithRandomColor(i) { function makeAndFillCanvasWithRandomColor(i) {
......
...@@ -25,7 +25,7 @@ function rand(range) { ...@@ -25,7 +25,7 @@ function rand(range) {
} }
function fillCanvas(ctx2d, canvas2d) { function fillCanvas(ctx2d, canvas2d) {
ctx2d.fillStyle = "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")"; ctx2d.fillStyle = "rgba(" + rand(256) + "," + rand(256) + "," + rand(256) + "," + rand(256) + ")";
ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height); ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height);
} }
......
...@@ -25,7 +25,7 @@ function rand(range) { ...@@ -25,7 +25,7 @@ function rand(range) {
} }
function fillCanvas(ctx2d, canvas2d) { function fillCanvas(ctx2d, canvas2d) {
ctx2d.fillStyle = "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")"; ctx2d.fillStyle = "rgba(" + rand(256) + "," + rand(256) + "," + rand(256) + "," + rand(256) + ")";
ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height); ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height);
} }
......
...@@ -25,7 +25,7 @@ function rand(range) { ...@@ -25,7 +25,7 @@ function rand(range) {
} }
function fillCanvas(ctx2d, canvas2d) { function fillCanvas(ctx2d, canvas2d) {
ctx2d.fillStyle = "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")"; ctx2d.fillStyle = "rgba(" + rand(256) + "," + rand(256) + "," + rand(256) + "," + rand(256) + ")";
ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height); ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height);
} }
......
...@@ -17,7 +17,7 @@ function rand(range) { ...@@ -17,7 +17,7 @@ function rand(range) {
} }
function fillCanvas(ctx2d, canvas2d) { function fillCanvas(ctx2d, canvas2d) {
ctx2d.fillStyle = "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")"; ctx2d.fillStyle = "rgba(" + rand(256) + "," + rand(256) + "," + rand(256) + "," + rand(256) + ")";
ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height); ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height);
} }
......
...@@ -25,7 +25,7 @@ function rand(range) { ...@@ -25,7 +25,7 @@ function rand(range) {
} }
function fillCanvas(ctx2d, canvas2d) { function fillCanvas(ctx2d, canvas2d) {
ctx2d.fillStyle = "rgba(" + rand(255) + "," + rand(255) + "," + rand(255) + "," + rand(255) + ")"; ctx2d.fillStyle = "rgba(" + rand(256) + "," + rand(256) + "," + rand(256) + "," + rand(256) + ")";
ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height); ctx2d.fillRect(0, 0, canvas2d.width, canvas2d.height);
} }
......
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