| OLD | NEW |
| 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 * Loads a thumbnail using provided url. In CANVAS mode, loaded images | 6 * Loads a thumbnail using provided url. In CANVAS mode, loaded images |
| 7 * are attached as <canvas> element, while in IMAGE mode as <img>. | 7 * are attached as <canvas> element, while in IMAGE mode as <img>. |
| 8 * <canvas> renders faster than <img>, however has bigger memory overhead. | 8 * <canvas> renders faster than <img>, however has bigger memory overhead. |
| 9 * | 9 * |
| 10 * @param {Entry} entry File entry. | 10 * @param {Entry} entry File entry. |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 this.metadata_.filesystem && | 460 this.metadata_.filesystem && |
| 461 this.metadata_.filesystem.modificationTime && | 461 this.metadata_.filesystem.modificationTime && |
| 462 this.metadata_.filesystem.modificationTime.getTime(); | 462 this.metadata_.filesystem.modificationTime.getTime(); |
| 463 var loaderOptions = { | 463 var loaderOptions = { |
| 464 maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH, | 464 maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH, |
| 465 maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT, | 465 maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT, |
| 466 cache: true, | 466 cache: true, |
| 467 priority: this.priority_, | 467 priority: this.priority_, |
| 468 timestamp: modificationTime | 468 timestamp: modificationTime |
| 469 }; | 469 }; |
| 470 if (this.metadata_ && this.metadata_.media && | 470 if (this.transform_) { |
| 471 this.metadata_.media.imageTransform) { | 471 loaderOptions.orientation = this.transform_; |
| 472 loaderOptions.orientation = this.metadata_.media.imageTransform; | |
| 473 } | 472 } |
| 474 // Comsume the transform parameter to avoid duplicated transformation in | 473 // Comsume the transform parameter to avoid duplicated transformation in |
| 475 // getImage(). | 474 // getImage(). |
| 476 // TODO(yamaguchi): remove this line when we move the image transformation | 475 // TODO(yamaguchi): remove this line when we move the image transformation |
| 477 // logic out of this class. | 476 // logic out of this class. |
| 478 this.transform_ = undefined; | 477 this.transform_ = undefined; |
| 479 | 478 |
| 480 this.taskId_ = ImageLoaderClient.loadToImage( | 479 this.taskId_ = ImageLoaderClient.loadToImage( |
| 481 this.thumbnailUrl_, | 480 this.thumbnailUrl_, |
| 482 this.image_, | 481 this.image_, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 647 |
| 649 function percent(fraction) { | 648 function percent(fraction) { |
| 650 return (fraction * 100).toFixed(2) + '%'; | 649 return (fraction * 100).toFixed(2) + '%'; |
| 651 } | 650 } |
| 652 | 651 |
| 653 img.style.width = percent(fractionX); | 652 img.style.width = percent(fractionX); |
| 654 img.style.height = percent(fractionY); | 653 img.style.height = percent(fractionY); |
| 655 img.style.left = percent((1 - fractionX) / 2); | 654 img.style.left = percent((1 - fractionX) / 2); |
| 656 img.style.top = percent((1 - fractionY) / 2); | 655 img.style.top = percent((1 - fractionY) / 2); |
| 657 }; | 656 }; |
| OLD | NEW |