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

Side by Side Diff: ui/file_manager/image_loader/request.js

Issue 1137993007: Crop image at image_loader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 7 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
« no previous file with comments | « ui/file_manager/image_loader/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 * @typedef {{ 6 * @typedef {{
7 * cache: (boolean|undefined), 7 * cache: (boolean|undefined),
8 * priority: (number|undefined), 8 * priority: (number|undefined),
9 * taskId: number, 9 * taskId: number,
10 * timestamp: (number|undefined), 10 * timestamp: (number|undefined),
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 * and finalizes the request process. 480 * and finalizes the request process.
481 * @private 481 * @private
482 */ 482 */
483 Request.prototype.onImageLoad_ = function() { 483 Request.prototype.onImageLoad_ = function() {
484 // Perform processing if the url is not a data url, or if there are some 484 // Perform processing if the url is not a data url, or if there are some
485 // operations requested. 485 // operations requested.
486 if (!this.request_.url.match(/^data/) || 486 if (!this.request_.url.match(/^data/) ||
487 ImageLoader.shouldProcess(this.image_.width, 487 ImageLoader.shouldProcess(this.image_.width,
488 this.image_.height, 488 this.image_.height,
489 this.request_)) { 489 this.request_)) {
490 ImageLoader.resize(this.image_, this.canvas_, this.request_); 490 ImageLoader.resizeAndCrop(this.image_, this.canvas_, this.request_);
491 ImageLoader.convertColorSpace( 491 ImageLoader.convertColorSpace(
492 this.canvas_, this.request_.colorSpace || ColorSpace.SRGB); 492 this.canvas_, this.request_.colorSpace || ColorSpace.SRGB);
493 this.sendImage_(true); // Image changed. 493 this.sendImage_(true); // Image changed.
494 } else { 494 } else {
495 this.sendImage_(false); // Image not changed. 495 this.sendImage_(false); // Image not changed.
496 } 496 }
497 this.cleanup_(); 497 this.cleanup_();
498 this.downloadCallback_(); 498 this.downloadCallback_();
499 }; 499 };
500 500
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + 533 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' +
534 'ABAAEAAAICTAEAOw=='; 534 'ABAAEAAAICTAEAOw==';
535 535
536 this.xhr_.onload = function() {}; 536 this.xhr_.onload = function() {};
537 this.xhr_.abort(); 537 this.xhr_.abort();
538 538
539 // Dispose memory allocated by Canvas. 539 // Dispose memory allocated by Canvas.
540 this.canvas_.width = 0; 540 this.canvas_.width = 0;
541 this.canvas_.height = 0; 541 this.canvas_.height = 0;
542 }; 542 };
OLDNEW
« no previous file with comments | « ui/file_manager/image_loader/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698