in image forEach, use Ox.nonblockingForEach
This commit is contained in:
parent
9137607045
commit
de30af0656
1 changed files with 9 additions and 7 deletions
|
@ -525,13 +525,15 @@ Ox.load.Image = function(options, callback) {
|
|||
i <n> Pixel index
|
||||
callback <f> Callback function (if present, forEach is async)
|
||||
@*/
|
||||
that.forEach = function(fn, callback) {
|
||||
var data = self.data;
|
||||
Ox._loop(0, data.length, 4, function(i) {
|
||||
return fn([
|
||||
data[i], data[i + 1], data[i + 2], data[i + 3]
|
||||
], getXY(i), i);
|
||||
}, 10000, callback);
|
||||
that.forEach = function(iterator, callback) {
|
||||
var data = self.data,
|
||||
forEach = callback ? Ox.nonblockingForEach : Ox.forEach;
|
||||
forEach(Ox.range(0, data.length, 4), function(i) {
|
||||
return iterator([
|
||||
data[i], data[i + 1], data[i + 2], data[i + 3]
|
||||
], getXY(i), i);
|
||||
}, callback);
|
||||
}
|
||||
return that;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue