Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: ui/file_manager/gallery/js/image_editor/image_editor.js

Issue 1608143002: support animated GIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add assert to pass closure compiler Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * ImageEditor is the top level object that holds together and connects 6 * ImageEditor is the top level object that holds together and connects
7 * everything needed for image editing. 7 * everything needed for image editing.
8 * 8 *
9 * @param {!Viewport} viewport The viewport. 9 * @param {!Viewport} viewport The viewport.
10 * @param {!ImageView} imageView The ImageView containing the images to edit. 10 * @param {!ImageView} imageView The ImageView containing the images to edit.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 var self = this; 219 var self = this;
220 this.imageView_.load( 220 this.imageView_.load(
221 item, effect, displayCallback, function(loadType, delay, error) { 221 item, effect, displayCallback, function(loadType, delay, error) {
222 self.lockUI(false); 222 self.lockUI(false);
223 223
224 // Always handle an item as original for new session. 224 // Always handle an item as original for new session.
225 item.setAsOriginal(); 225 item.setAsOriginal();
226 226
227 self.commandQueue_ = new CommandQueue( 227 self.commandQueue_ = new CommandQueue(
228 self.container_.ownerDocument, assert(self.imageView_.getCanvas()), 228 self.container_.ownerDocument, assert(self.imageView_.getImage()),
229 saveFunction); 229 saveFunction);
230 self.commandQueue_.attachUI( 230 self.commandQueue_.attachUI(
231 self.getImageView(), self.getPrompt(), self.filesToast_, 231 self.getImageView(), self.getPrompt(), self.filesToast_,
232 self.updateUndoRedo.bind(self), self.lockUI.bind(self)); 232 self.updateUndoRedo.bind(self), self.lockUI.bind(self));
233 self.updateUndoRedo(); 233 self.updateUndoRedo();
234 loadCallback(loadType, delay, error); 234 loadCallback(loadType, delay, error);
235 }); 235 });
236 }; 236 };
237 237
238 /** 238 /**
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 * Update Undo/Redo buttons state. 320 * Update Undo/Redo buttons state.
321 */ 321 */
322 ImageEditor.prototype.updateUndoRedo = function() { 322 ImageEditor.prototype.updateUndoRedo = function() {
323 var canUndo = this.commandQueue_ && this.commandQueue_.canUndo(); 323 var canUndo = this.commandQueue_ && this.commandQueue_.canUndo();
324 var canRedo = this.commandQueue_ && this.commandQueue_.canRedo(); 324 var canRedo = this.commandQueue_ && this.commandQueue_.canRedo();
325 ImageUtil.setAttribute(this.undoButton_, 'disabled', !canUndo); 325 ImageUtil.setAttribute(this.undoButton_, 'disabled', !canUndo);
326 ImageUtil.setAttribute(this.redoButton_, 'disabled', !canRedo); 326 ImageUtil.setAttribute(this.redoButton_, 'disabled', !canRedo);
327 }; 327 };
328 328
329 /** 329 /**
330 * @return {HTMLCanvasElement} The current image canvas. 330 * @return {HTMLCanvasElement|HTMLImageElement} The current image.
331 */ 331 */
332 ImageEditor.prototype.getCanvas = function() { 332 ImageEditor.prototype.getImage = function() {
333 return this.getImageView().getCanvas(); 333 return this.getImageView().getImage();
334 }; 334 };
335 335
336 /** 336 /**
337 * @return {!ImageBuffer} ImageBuffer instance. 337 * @return {!ImageBuffer} ImageBuffer instance.
338 */ 338 */
339 ImageEditor.prototype.getBuffer = function() { return this.buffer_; }; 339 ImageEditor.prototype.getBuffer = function() { return this.buffer_; };
340 340
341 /** 341 /**
342 * @return {!ImageView} ImageView instance. 342 * @return {!ImageView} ImageView instance.
343 */ 343 */
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 1519
1520 /** 1520 /**
1521 * Hide the prompt. 1521 * Hide the prompt.
1522 */ 1522 */
1523 ImageEditor.Prompt.prototype.hide = function() { 1523 ImageEditor.Prompt.prototype.hide = function() {
1524 if (!this.prompt_) return; 1524 if (!this.prompt_) return;
1525 this.prompt_.setAttribute('state', 'fadeout'); 1525 this.prompt_.setAttribute('state', 'fadeout');
1526 // Allow some time for the animation to play out. 1526 // Allow some time for the animation to play out.
1527 this.setTimer(this.reset.bind(this), 500); 1527 this.setTimer(this.reset.bind(this), 500);
1528 }; 1528 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/image_adjust.js ('k') | ui/file_manager/gallery/js/image_editor/image_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698