OLD | NEW |
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 Loading... |
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 Loading... |
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 }; |
OLD | NEW |