Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: chrome/test/data/third_party/kraken/tests/kraken-1.1/imaging-gaussian-blur.js

Issue 11348021: Automate Kraken benchmark with Chrome Remote Control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 //print("i: " + i + "j: " + j);
2
3 function gaussianBlur() {
4 for (var y = 0; y < height; ++y) {
5 for (var x = 0; x < width; ++x) {
6 var r = 0, g = 0, b = 0, a = 0;
7 for (var j = 1 - kernelSize; j < kernelSize; ++j) {
8 if (y + j < 0 || y + j >= height) continue;
9 for (var i = 1 - kernelSize; i < kernelSize; ++i) {
10 if (x + i < 0 || x + i >= width) continue;
11 r += squidImageData[4 * ((y + j) * width + (x + i)) + 0] * k ernel[Math.abs(j)][Math.abs(i)];
12 g += squidImageData[4 * ((y + j) * width + (x + i)) + 1] * k ernel[Math.abs(j)][Math.abs(i)];
13 b += squidImageData[4 * ((y + j) * width + (x + i)) + 2] * k ernel[Math.abs(j)][Math.abs(i)];
14 a += squidImageData[4 * ((y + j) * width + (x + i)) + 3] * k ernel[Math.abs(j)][Math.abs(i)];
15 }
16 }
17 squidImageData[4 * (y * width + x) + 0] = r / kernelSum;
18 squidImageData[4 * (y * width + x) + 1] = g / kernelSum;
19 squidImageData[4 * (y * width + x) + 2] = b / kernelSum;
20 squidImageData[4 * (y * width + x) + 3] = a / kernelSum;
21 }
22 }
23 return squidImageData;
24 }
25 gaussianBlur();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698