mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 20:00:05 +01:00
Benchmarks (#781)
* benchmarks initial try * added test to package.json * Update benchmark.js * Update benchmark.js * Update benchmark.js * Update benchmark.js * bigger image * change load-Image to browser only and fix benchmark Signed-off-by: tech4GT <varun.gupta1798@gmail.com> * run on same image Signed-off-by: tech4GT <varun.gupta1798@gmail.com>
This commit is contained in:
@@ -12,7 +12,7 @@ module.exports = function ImportImageModule(options, UI) {
|
||||
options.imageUrl = options.url || defaults.url;
|
||||
|
||||
var output,
|
||||
imgObj = new Image();
|
||||
imgObj = new Image();
|
||||
|
||||
// we should get UI to return the image thumbnail so we can attach our own UI extensions
|
||||
|
||||
@@ -23,31 +23,36 @@ module.exports = function ImportImageModule(options, UI) {
|
||||
}
|
||||
|
||||
// This function is caled everytime the step has to be redrawn
|
||||
function draw(input,callback) {
|
||||
function draw(input, callback) {
|
||||
|
||||
var step = this;
|
||||
|
||||
step.metadata = step.metadata || {};
|
||||
// TODO: develop a standard API method for saving each input state,
|
||||
// for reference in future steps (for blending, for example)
|
||||
step.metadata.input = input;
|
||||
if (!options.inBrowser) { // This module is only for browser
|
||||
this.output = input;
|
||||
callback();
|
||||
} else {
|
||||
step.metadata = step.metadata || {};
|
||||
// TODO: develop a standard API method for saving each input state,
|
||||
// for reference in future steps (for blending, for example)
|
||||
step.metadata.input = input;
|
||||
|
||||
function onLoad() {
|
||||
function onLoad() {
|
||||
|
||||
// This output is accessible to Image Sequencer
|
||||
step.output = {
|
||||
src: imgObj.src,
|
||||
format: options.format
|
||||
// This output is accessible to Image Sequencer
|
||||
step.output = {
|
||||
src: imgObj.src,
|
||||
format: options.format
|
||||
}
|
||||
|
||||
// Tell Image Sequencer that step has been drawn
|
||||
callback();
|
||||
}
|
||||
|
||||
// Tell Image Sequencer that step has been drawn
|
||||
callback();
|
||||
options.format = require('../../util/GetFormat')(options.imageUrl);
|
||||
imgObj.onload = onLoad;
|
||||
imgObj.src = options.imageUrl;
|
||||
|
||||
}
|
||||
|
||||
options.format = require('../../util/GetFormat')(options.imageUrl);
|
||||
imgObj.onload = onLoad;
|
||||
imgObj.src = options.imageUrl;
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user