From 3e02037b58b970ff9eb1ec9614e4cad82f5dc346 Mon Sep 17 00:00:00 2001 From: juliandescottes Date: Mon, 3 Sep 2012 22:31:56 +0200 Subject: [PATCH] Removed all references to normalizeCOlor --- js/drawingtools/BaseTool.js | 2 +- js/drawingtools/PaintBucket.js | 2 +- js/drawingtools/SimplePen.js | 3 --- js/piskel.js | 13 ++----------- js/utils.js | 8 -------- 5 files changed, 4 insertions(+), 24 deletions(-) diff --git a/js/drawingtools/BaseTool.js b/js/drawingtools/BaseTool.js index d1a99eef..103e1052 100644 --- a/js/drawingtools/BaseTool.js +++ b/js/drawingtools/BaseTool.js @@ -35,7 +35,7 @@ var color; for(var col = 0, num_col = frame.length; col < num_col; col++) { for(var row = 0, num_row = frame[col].length; row < num_row; row++) { - color = pskl.utils.normalizeColor(frame[col][row]); + color = frame[col][row]; this.drawPixelInCanvas(col, row,canvas, color, dpi); } } diff --git a/js/drawingtools/PaintBucket.js b/js/drawingtools/PaintBucket.js index 8ec5f3bc..9f27fbbe 100644 --- a/js/drawingtools/PaintBucket.js +++ b/js/drawingtools/PaintBucket.js @@ -18,7 +18,7 @@ ns.PaintBucket.prototype.applyToolAt = function(col, row, frame, color, canvas, dpi) { // Change model: - var targetColor = pskl.utils.normalizeColor(frame[col][row]); + var targetColor = frame[col][row]; //this.recursiveFloodFill_(frame, col, row, targetColor, color); this.queueLinearFloodFill_(frame, col, row, targetColor, color); diff --git a/js/drawingtools/SimplePen.js b/js/drawingtools/SimplePen.js index a7d4f45c..309df10a 100644 --- a/js/drawingtools/SimplePen.js +++ b/js/drawingtools/SimplePen.js @@ -22,9 +22,6 @@ this.previousCol = col; this.previousRow = row; - - // Change model: - var color = pskl.utils.normalizeColor(color); if (color != frame[col][row]) { frame[col][row] = color; } diff --git a/js/piskel.js b/js/piskel.js index fabb0bfc..f7aba6f2 100644 --- a/js/piskel.js +++ b/js/piskel.js @@ -42,16 +42,7 @@ $.namespace("pskl"); penColor = Constants.DEFAULT_PEN_COLOR, currentFrame = null; currentToolBehavior = null, - previousMousemoveTime = 0, - - //utility - _normalizeColor = function (color) { - if(color == undefined || color == Constants.TRANSPARENT_COLOR || color.indexOf("#") == 0) { - return color; - } else { - return "#" + color; - } - }; + previousMousemoveTime = 0; /** * Main application controller @@ -391,7 +382,7 @@ $.namespace("pskl"); var color; for(var col = 0, num_col = frame.length; col < num_col; col++) { for(var row = 0, num_row = frame[col].length; row < num_row; row++) { - color = _normalizeColor(frame[col][row]); + color = frame[col][row]; this.drawPixelInCanvas(row, col, color, canvasElement, dpi); } } diff --git a/js/utils.js b/js/utils.js index d5e6fba6..2b475b1a 100644 --- a/js/utils.js +++ b/js/utils.js @@ -26,14 +26,6 @@ jQuery.namespace = function() { return ((r << 16) | (g << 8) | b).toString(16); }; - ns.normalizeColor = function (color) { - if(color == undefined || color == Constants.TRANSPARENT_COLOR || color.indexOf("#") == 0) { - return color; - } else { - return "#" + color; - } - }; - ns.inherit = function(extendedObject, inheritFrom) { extendedObject.prototype = Object.create(inheritFrom.prototype); extendedObject.prototype.constructor = extendedObject;