| 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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 | 526 |
| 527 /** | 527 /** |
| 528 * Handler, when contents are loaded into the image element. Performs resizing | 528 * Handler, when contents are loaded into the image element. Performs resizing |
| 529 * and finalizes the request process. | 529 * and finalizes the request process. |
| 530 * @private | 530 * @private |
| 531 */ | 531 */ |
| 532 ImageRequest.prototype.onImageLoad_ = function() { | 532 ImageRequest.prototype.onImageLoad_ = function() { |
| 533 // Perform processing if the url is not a data url, or if there are some | 533 // Perform processing if the url is not a data url, or if there are some |
| 534 // operations requested. | 534 // operations requested. |
| 535 if (!this.request_.url.match(/^data/) || | 535 if (!this.request_.url.match(/^data/) || |
| 536 ImageLoader.shouldProcess(this.image_.width, | 536 ImageLoaderUtil.shouldProcess(this.image_.width, |
| 537 this.image_.height, | 537 this.image_.height, |
| 538 this.request_)) { | 538 this.request_)) { |
| 539 ImageLoader.resizeAndCrop(this.image_, this.canvas_, this.request_); | 539 ImageLoaderUtil.resizeAndCrop(this.image_, this.canvas_, this.request_); |
| 540 ImageLoader.convertColorSpace( | 540 ImageLoaderUtil.convertColorSpace( |
| 541 this.canvas_, this.request_.colorSpace || ColorSpace.SRGB); | 541 this.canvas_, this.request_.colorSpace || ColorSpace.SRGB); |
| 542 this.sendImage_(true); // Image changed. | 542 this.sendImage_(true); // Image changed. |
| 543 } else { | 543 } else { |
| 544 this.sendImage_(false); // Image not changed. | 544 this.sendImage_(false); // Image not changed. |
| 545 } | 545 } |
| 546 this.cleanup_(); | 546 this.cleanup_(); |
| 547 this.downloadCallback_(); | 547 this.downloadCallback_(); |
| 548 }; | 548 }; |
| 549 | 549 |
| 550 /** | 550 /** |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + | 582 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + |
| 583 'ABAAEAAAICTAEAOw=='; | 583 'ABAAEAAAICTAEAOw=='; |
| 584 | 584 |
| 585 this.xhr_.onload = function() {}; | 585 this.xhr_.onload = function() {}; |
| 586 this.xhr_.abort(); | 586 this.xhr_.abort(); |
| 587 | 587 |
| 588 // Dispose memory allocated by Canvas. | 588 // Dispose memory allocated by Canvas. |
| 589 this.canvas_.width = 0; | 589 this.canvas_.width = 0; |
| 590 this.canvas_.height = 0; | 590 this.canvas_.height = 0; |
| 591 }; | 591 }; |
| OLD | NEW |