in image forEach, use Ox.nonblockingForEach

This commit is contained in:
rolux 2012-05-23 17:44:02 +02:00
parent 9137607045
commit de30af0656

View file

@ -525,13 +525,15 @@ Ox.load.Image = function(options, callback) {
i <n> Pixel index i <n> Pixel index
callback <f> Callback function (if present, forEach is async) callback <f> Callback function (if present, forEach is async)
@*/ @*/
that.forEach = function(fn, callback) { that.forEach = function(iterator, callback) {
var data = self.data; var data = self.data,
Ox._loop(0, data.length, 4, function(i) { forEach = callback ? Ox.nonblockingForEach : Ox.forEach;
return fn([ forEach(Ox.range(0, data.length, 4), function(i) {
data[i], data[i + 1], data[i + 2], data[i + 3] return iterator([
], getXY(i), i); data[i], data[i + 1], data[i + 2], data[i + 3]
}, 10000, callback); ], getXY(i), i);
}, callback);
}
return that; return that;
}; };