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

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

Issue 398263002: Gallery: Random fixes for the Viewport class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/image_editor/image_editor.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * Command queue is the only way to modify images. 8 * Command queue is the only way to modify images.
9 * Supports undo/redo. 9 * Supports undo/redo.
10 * Command execution is asynchronous (callback-based). 10 * Command execution is asynchronous (callback-based).
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 this.filter_ = filter; 408 this.filter_ = filter;
409 this.message_ = message; 409 this.message_ = message;
410 }; 410 };
411 411
412 Command.Filter.prototype = { __proto__: Command.prototype }; 412 Command.Filter.prototype = { __proto__: Command.prototype };
413 413
414 /** @override */ 414 /** @override */
415 Command.Filter.prototype.execute = function( 415 Command.Filter.prototype.execute = function(
416 document, srcCanvas, callback, uiContext) { 416 document, srcCanvas, callback, uiContext) {
417 var result = this.createCanvas_(document, srcCanvas); 417 var result = this.createCanvas_(document, srcCanvas);
418
419 var self = this; 418 var self = this;
420
421 var previousRow = 0; 419 var previousRow = 0;
422 420
423 function onProgressVisible(updatedRow, rowCount) { 421 function onProgressVisible(updatedRow, rowCount) {
424 if (updatedRow == rowCount) { 422 if (updatedRow == rowCount) {
425 uiContext.imageView.replace(result); 423 uiContext.imageView.replace(result);
426 if (self.message_) 424 if (self.message_)
427 uiContext.prompt.show(self.message_, 2000); 425 uiContext.prompt.show(self.message_, 2000);
428 callback(result); 426 callback(result);
429 } else { 427 } else {
430 var viewport = uiContext.imageView.viewport_; 428 var viewport = uiContext.imageView.viewport_;
431 429
432 var imageStrip = new Rect(viewport.getImageBounds()); 430 var imageStrip = new Rect(viewport.getImageBounds());
433 imageStrip.top = previousRow; 431 imageStrip.top = previousRow;
434 imageStrip.height = updatedRow - previousRow; 432 imageStrip.height = updatedRow - previousRow;
435 433
436 var screenStrip = new Rect(viewport.getImageBoundsOnScreen()); 434 var screenStrip = new Rect(viewport.getImageBoundsOnScreen());
437 screenStrip.top = Math.round(viewport.imageToScreenY(previousRow)); 435 screenStrip.top = Math.round(viewport.imageToScreenY(previousRow));
438 screenStrip.height = 436 screenStrip.height =
439 Math.round(viewport.imageToScreenY(updatedRow)) - screenStrip.top; 437 Math.round(viewport.imageToScreenY(updatedRow)) - screenStrip.top;
440 438
441 uiContext.imageView.paintDeviceRect( 439 uiContext.imageView.paintDeviceRect(result, imageStrip);
442 viewport.screenToDeviceRect(screenStrip), result, imageStrip);
443 previousRow = updatedRow; 440 previousRow = updatedRow;
444 } 441 }
445 } 442 }
446 443
447 function onProgressInvisible(updatedRow, rowCount) { 444 function onProgressInvisible(updatedRow, rowCount) {
448 if (updatedRow == rowCount) { 445 if (updatedRow == rowCount) {
449 callback(result); 446 callback(result);
450 } 447 }
451 } 448 }
452 449
453 filter.applyByStrips(result, srcCanvas, this.filter_, 450 filter.applyByStrips(result, srcCanvas, this.filter_,
454 uiContext.imageView ? onProgressVisible : onProgressInvisible); 451 uiContext.imageView ? onProgressVisible : onProgressInvisible);
455 }; 452 };
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/gallery/js/image_editor/image_editor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698