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

Side by Side Diff: chrome/test/data/third_party/kraken/tests/kraken-1.1/imaging-desaturate.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 /*
2 * Pixastic Lib - Desaturation filter - v0.1.1
3 * Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilo gic.dk/
4 * License: [http://www.pixastic.com/lib/license.txt] (MPL 1.1)
5 */
6
7 var Pixastic = {};
8 Pixastic.Actions = {};
9 Pixastic.Actions.desaturate = {
10 process : function(params) {
11 var useAverage = !!(params.options.average && params.options.average != "false");
12 var data = params.data;
13 var rect = params.options.rect;
14 var w = rect.width;
15 var h = rect.height;
16
17 var p = w*h;
18 var pix = p*4, pix1, pix2;
19
20 if (useAverage) {
21 while (p--)
22 data[pix-=4] = data[pix1=pix+1] = data[pix2=pix+2] = (data[pix]+ data[pix1]+data[pix2])/3
23 } else {
24 while (p--)
25 data[pix-=4] = data[pix1=pix+1] = data[pix2=pix+2] = (data[pix]* 0.3 + data[pix1]*0.59 + data[pix2]*0.11);
26 }
27 return true;
28 }
29 }
30
31 var params = {
32 options: {
33 rect: { width: width, height: height},
34 },
35 data: squidImageData
36 }
37
38 //XXX improve dataset rather than loop
39 for (var pixcounter = 0; pixcounter < 200; pixcounter++)
40 Pixastic.Actions.desaturate.process(params);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698