| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Command queue is the only way to modify images. | 6 * Command queue is the only way to modify images. |
| 7 * Supports undo/redo. | 7 * Supports undo/redo. |
| 8 * Command execution is asynchronous (callback-based). | 8 * Command execution is asynchronous (callback-based). |
| 9 * | 9 * |
| 10 * @param {!Document} document Document to create canvases in. | 10 * @param {!Document} document Document to create canvases in. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 this.saveFunction_ = saveFunction; | 41 this.saveFunction_ = saveFunction; |
| 42 this.busy_ = false; | 42 this.busy_ = false; |
| 43 this.UIContext_ = {}; | 43 this.UIContext_ = {}; |
| 44 } | 44 } |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Attach the UI elements to the command queue. | 47 * Attach the UI elements to the command queue. |
| 48 * Once the UI is attached the results of image manipulations are displayed. | 48 * Once the UI is attached the results of image manipulations are displayed. |
| 49 * | 49 * |
| 50 * @param {!ImageView} imageView The ImageView object to display the results. | 50 * @param {!ImageView} imageView The ImageView object to display the results. |
| 51 * @param {!ImageEditor.Prompt} prompt Prompt to use with this CommandQueue. | 51 * @param {!ImageEditorPrompt} prompt Prompt to use with this CommandQueue. |
| 52 * @param {!FilesToast} toast Toast. | 52 * @param {!FilesToast} toast Toast. |
| 53 * @param {function()} updateUndoRedo Function to update undo and redo buttons | 53 * @param {function()} updateUndoRedo Function to update undo and redo buttons |
| 54 * state. | 54 * state. |
| 55 * @param {function(boolean)} lock Function to enable/disable buttons etc. | 55 * @param {function(boolean)} lock Function to enable/disable buttons etc. |
| 56 */ | 56 */ |
| 57 CommandQueue.prototype.attachUI = function( | 57 CommandQueue.prototype.attachUI = function( |
| 58 imageView, prompt, toast, updateUndoRedo, lock) { | 58 imageView, prompt, toast, updateUndoRedo, lock) { |
| 59 this.UIContext_ = { | 59 this.UIContext_ = { |
| 60 imageView: imageView, | 60 imageView: imageView, |
| 61 prompt: prompt, | 61 prompt: prompt, |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 document, srcImage, this.newWidth_, this.newHeight_); | 474 document, srcImage, this.newWidth_, this.newHeight_); |
| 475 | 475 |
| 476 var scaleX = this.newWidth_ / srcImage.width; | 476 var scaleX = this.newWidth_ / srcImage.width; |
| 477 var scaleY = this.newHeight_ / srcImage.height; | 477 var scaleY = this.newHeight_ / srcImage.height; |
| 478 ImageUtil.drawImageTransformed(result, srcImage, scaleX, scaleY, 0); | 478 ImageUtil.drawImageTransformed(result, srcImage, scaleX, scaleY, 0); |
| 479 | 479 |
| 480 if(uiContext.imageView) | 480 if(uiContext.imageView) |
| 481 uiContext.imageView.replace(result); | 481 uiContext.imageView.replace(result); |
| 482 callback(result); | 482 callback(result); |
| 483 }; | 483 }; |
| OLD | NEW |