mirror of
https://github.com/piskelapp/piskel.git
synced 2023-08-10 21:12:52 +03:00
improved current colors sort algorithm
This commit is contained in:
parent
6ef99bba15
commit
e3e6730b45
@ -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);
|
||||
};
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user