image-filter-core
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -43,3 +43,2 @@ var istanbul = require('istanbul'); | ||
debug: true, | ||
plugin: ['proxyquire-universal'], | ||
transform: [ | ||
@@ -46,0 +45,0 @@ bistanbul({ |
{ | ||
"name": "image-filter-core", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Core module for image-filter", | ||
@@ -9,2 +9,3 @@ "main": "src/index.js", | ||
"test": "karma start", | ||
"build": "npm run eslint && browserify sandbox/sandbox.js > sandbox/bundle.js", | ||
"codecov": "cat coverage/*/lcov.info | codecov", | ||
@@ -47,7 +48,3 @@ "serve": "http-server sandbox" | ||
"phantomjs-prebuilt": "^2.1.5", | ||
"proxyquire": "^1.7.10", | ||
"proxyquire-universal": "^1.0.8", | ||
"proxyquireify": "^3.2.1", | ||
"sinon": "^1.17.3", | ||
"watchify": "^3.7.0" | ||
"sinon": "^1.17.3" | ||
}, | ||
@@ -54,0 +51,0 @@ "dependencies": { |
![build status](https://travis-ci.org/canastro/image-filter-threshold.svg?branch=master) | ||
[![Dependency Status](https://dependencyci.com/github/canastro/image-filter-core/badge)](https://dependencyci.com/github/canastro/image-filter-core) | ||
[![npm version](https://badge.fury.io/js/image-filter-threshold.svg)](https://badge.fury.io/js/image-filter-threshold) | ||
@@ -3,0 +4,0 @@ [![codecov](https://codecov.io/gh/canastro/image-filter-core/branch/master/graph/badge.svg)](https://codecov.io/gh/canastro/image-filter-core) |
@@ -88,4 +88,2 @@ require('es6-promise/auto'); | ||
var finished = 0; | ||
var len = canvas.width * canvas.height * 4; | ||
var segmentLength; | ||
var blockSize; | ||
@@ -101,8 +99,12 @@ | ||
segmentLength = len / nWorkers; // This is the length of array sent to the worker | ||
blockSize = canvas.height / nWorkers; // Height of the picture chunck for every worker | ||
// Height of the picture chunck for every worker | ||
blockSize = Math.floor(canvas.height / nWorkers); | ||
return new Promise(function (resolve) { | ||
var w; | ||
var height; | ||
var canvasData; | ||
for (var index = 0; index < nWorkers; index++) { | ||
var w = new Worker(workerURL); | ||
w = new Worker(workerURL); | ||
@@ -125,4 +127,10 @@ w.addEventListener('message', function (e) { | ||
// In the last worker we have to make sure we process whatever is missing | ||
height = blockSize; | ||
if ((index + 1) === nWorkers) { | ||
height = canvas.height - (blockSize * index); | ||
} | ||
// Getting the picture | ||
var canvasData = context.getImageData(0, blockSize * index, canvas.width, blockSize); | ||
canvasData = context.getImageData(0, blockSize * index, canvas.width, height); | ||
@@ -133,3 +141,3 @@ // Sending canvas data to the worker using a copy memory operation | ||
index: index, | ||
length: segmentLength, | ||
length: height * canvas.width * 4, | ||
options: options, | ||
@@ -136,0 +144,0 @@ transformationURL: transformationURL |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72990
15
18
438
67