improved current colors sort algorithm

This commit is contained in:
jdescottes 2014-09-24 07:43:04 +02:00
parent 6ef99bba15
commit e3e6730b45
2 changed files with 5 additions and 12 deletions

View File

@ -1,9 +1,9 @@
(function () {
var ns = $.namespace('pskl.worker');
var worker = function () {
var imageProcessorWorker = function () {
var currentStep, currentProgress, currentTotal;
var initStepCounter_ = function (total) {
currentStep = 0;
currentProgress = 0;
@ -88,15 +88,6 @@
};
};
try {
// create worker from blob
var typedArray = [(worker+"").replace(/function \(\) \{/,"").replace(/\}[^}]*$/, "")];
var blob = new Blob(typedArray, {type: "application/javascript"}); // pass a useful mime type here
var blobUrl = window.URL.createObjectURL(blob);
} catch (e) {
console.error("Could not create worker", e.message);
}
ns.ImageProcessor = function (image, onSuccess, onStep, onError) {
this.image = image;
@ -104,7 +95,8 @@
this.onSuccess = onSuccess;
this.onError = onError;
this.worker = new Worker(blobUrl);
// var worker = pskl.utils.WorkerUtils.addPartialWorker(imageProcessorWorker, 'step-counter');
this.worker = pskl.utils.WorkerUtils.createWorker(worker, 'image-colors-processor');
this.worker.onmessage = this.onWorkerMessage.bind(this);
};

View File

@ -26,6 +26,7 @@
"js/utils/Template.js",
"js/utils/UserSettings.js",
"js/utils/Uuid.js",
"js/utils/WorkerUtils.js",
"js/utils/Xhr.js",
"js/utils/serialization/Serializer.js",
"js/utils/serialization/Deserializer.js",