Index: ui/file_manager/gallery/js/image_editor/commands.js |
diff --git a/ui/file_manager/gallery/js/image_editor/commands.js b/ui/file_manager/gallery/js/image_editor/commands.js |
index a67d0f9df2ff419cf85c2f7dd7e714b42079636f..703489af416ab9a04b0be1d7d0ce8049d04b305e 100644 |
--- a/ui/file_manager/gallery/js/image_editor/commands.js |
+++ b/ui/file_manager/gallery/js/image_editor/commands.js |
@@ -8,17 +8,18 @@ |
* Command execution is asynchronous (callback-based). |
* |
* @param {!Document} document Document to create canvases in. |
- * @param {!HTMLCanvasElement} canvas The canvas with the original image. |
+ * @param {!HTMLCanvasElement|!HTMLImageElement} image |
+ * The canvas with the original image. |
yawano
2016/01/20 06:23:09
small nit: please use the line until the end. i.e.
ryoh
2016/01/21 03:19:55
Done.
|
* @param {function(function())} saveFunction Function to save the image. |
* @constructor |
* @struct |
*/ |
-function CommandQueue(document, canvas, saveFunction) { |
+function CommandQueue(document, image, saveFunction) { |
this.document_ = document; |
this.undo_ = []; |
this.redo_ = []; |
this.subscribers_ = []; |
- this.currentImage_ = canvas; |
+ this.currentImage_ = image; |
// Current image may be null or not-null but with width = height = 0. |
// Copying an image with zero dimensions causes js errors. |
@@ -296,12 +297,12 @@ Command.prototype.toString = function() { |
* to be able to show partial results for slower operations. |
* |
* @param {!Document} document Document on which to execute command. |
- * @param {!HTMLCanvasElement} srcCanvas Canvas to execute on. |
+ * @param {!HTMLCanvasElement|!HTMLImageElement} srcImage Image to execute on. |
* @param {function(HTMLCanvasElement, number=)} callback Callback to call on |
* completion. |
* @param {!Object} uiContext Context to work in. |
*/ |
-Command.prototype.execute = function(document, srcCanvas, callback, uiContext) { |
+Command.prototype.execute = function(document, srcImage, callback, uiContext) { |
console.error('Command.prototype.execute not implemented'); |
}; |
@@ -321,18 +322,19 @@ Command.prototype.revertView = function(canvas, imageView) { |
* Creates canvas to render on. |
* |
* @param {!Document} document Document to create canvas in. |
- * @param {!HTMLCanvasElement} srcCanvas to copy optional dimensions from. |
+ * @param {!HTMLCanvasElement|!HTMLImageElement} srcImage |
+ * to copy optional dimensions from. |
* @param {number=} opt_width new canvas width. |
* @param {number=} opt_height new canvas height. |
* @return {!HTMLCanvasElement} Newly created canvas. |
* @private |
*/ |
Command.prototype.createCanvas_ = function( |
- document, srcCanvas, opt_width, opt_height) { |
+ document, srcImage, opt_width, opt_height) { |
var result = assertInstanceof(document.createElement('canvas'), |
HTMLCanvasElement); |
- result.width = opt_width || srcCanvas.width; |
- result.height = opt_height || srcCanvas.height; |
+ result.width = opt_width || srcImage.width; |
+ result.height = opt_height || srcImage.height; |
return result; |
}; |
@@ -353,14 +355,14 @@ Command.Rotate.prototype = { __proto__: Command.prototype }; |
/** @override */ |
Command.Rotate.prototype.execute = function( |
- document, srcCanvas, callback, uiContext) { |
+ document, srcImage, callback, uiContext) { |
var result = this.createCanvas_( |
document, |
- srcCanvas, |
- (this.rotate90_ & 1) ? srcCanvas.height : srcCanvas.width, |
- (this.rotate90_ & 1) ? srcCanvas.width : srcCanvas.height); |
+ srcImage, |
+ (this.rotate90_ & 1) ? srcImage.height : srcImage.width, |
+ (this.rotate90_ & 1) ? srcImage.width : srcImage.height); |
ImageUtil.drawImageTransformed( |
- result, srcCanvas, 1, 1, this.rotate90_ * Math.PI / 2); |
+ result, srcImage, 1, 1, this.rotate90_ * Math.PI / 2); |
var delay; |
if (uiContext.imageView) { |
delay = uiContext.imageView.replaceAndAnimate(result, null, this.rotate90_); |
@@ -430,8 +432,8 @@ Command.Filter.prototype = { __proto__: Command.prototype }; |
/** @override */ |
Command.Filter.prototype.execute = function( |
- document, srcCanvas, callback, uiContext) { |
- var result = this.createCanvas_(document, srcCanvas); |
+ document, srcImage, callback, uiContext) { |
+ var result = this.createCanvas_(document, srcImage); |
var self = this; |
var previousRow = 0; |
@@ -465,6 +467,6 @@ Command.Filter.prototype.execute = function( |
} |
} |
- filter.applyByStrips(result, srcCanvas, this.filter_, |
+ filter.applyByStrips(result, srcImage, this.filter_, |
uiContext.imageView ? onProgressVisible : onProgressInvisible); |
}; |