From 712262b82a70366424ed3e460440917597757a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Szab=C3=B3?= Date: Wed, 24 Aug 2016 23:10:59 +0200 Subject: [PATCH] Format some code and remove unnecessary logging --- src/js/model/Frame.js | 5 ----- src/js/model/frame/AsyncCachedFrameProcessor.js | 16 ++++++++++------ src/js/model/frame/CachedFrameProcessor.js | 7 +++++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/js/model/Frame.js b/src/js/model/Frame.js index bc327ba9..13c50487 100644 --- a/src/js/model/Frame.js +++ b/src/js/model/Frame.js @@ -41,7 +41,6 @@ frame.setPixels(buffer); return frame; } else { - console.error(pixels); throw 'Bad arguments in pskl.model.Frame.fromPixelGrid'; } }; @@ -95,7 +94,6 @@ ns.Frame.prototype.clear = function () { this.pixels = ns.Frame.createEmptyPixelGrid_(this.getWidth(), this.getHeight()); this.version++; - // this.setPixels(pixels); }; /** @@ -103,9 +101,6 @@ * @private */ ns.Frame.prototype.clonePixels_ = function (pixels) { - //npixels = new Uint32Array(pixels.length); - //npixels.set(pixels); - return new Uint32Array(pixels); }; diff --git a/src/js/model/frame/AsyncCachedFrameProcessor.js b/src/js/model/frame/AsyncCachedFrameProcessor.js index ab4baf3e..d23f280e 100644 --- a/src/js/model/frame/AsyncCachedFrameProcessor.js +++ b/src/js/model/frame/AsyncCachedFrameProcessor.js @@ -35,16 +35,20 @@ var callbackFirstLvlCacheOnly = this.onProcessorComplete_.bind(this, deferred, cache, key1/*, key1*/); this.frameProcessor(frame, callbackFirstLvlCacheOnly); } else { - // TODO: Remove? - /*var framePixels = new Float64Array(frame.pixels.buffer).toString(); + // TODO: Remove? or offload to worker + /* + var framePixels = new Float64Array(frame.pixels.buffer).toString(); var key2 = pskl.utils.hashCode(framePixels); if (cache[key2]) { processedFrame = this.outputCloner(cache[key2], frame); cache[key1] = processedFrame; - } else {*/ - var callback = this.onProcessorComplete_.bind(this, deferred, cache, key1/*, key1*/); - this.frameProcessor(frame, callback);/* - }*/ + } else { + */ + var callback = this.onProcessorComplete_.bind(this, deferred, cache, key1/*, key1*/); + this.frameProcessor(frame, callback); + /* + } + */ } if (processedFrame) { diff --git a/src/js/model/frame/CachedFrameProcessor.js b/src/js/model/frame/CachedFrameProcessor.js index bc905673..ca9a0087 100644 --- a/src/js/model/frame/CachedFrameProcessor.js +++ b/src/js/model/frame/CachedFrameProcessor.js @@ -80,10 +80,13 @@ this.cacheHitLvl2_++; processedFrame = this.outputCloner(cache[frameAsString], frame); } else { - */processedFrame = this.frameProcessor(frame);/* + */ + processedFrame = this.frameProcessor(frame); + /* cache[frameAsString] = processedFrame; } - cache[cacheKey] = processedFrame;*/ + cache[cacheKey] = processedFrame; + */ } return processedFrame;