| 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 * Object representing an image item (a photo). | 6 * Object representing an image item (a photo). |
| 7 * | 7 * |
| 8 * @param {!FileEntry} entry Image entry. | 8 * @param {!FileEntry} entry Image entry. |
| 9 * @param {!EntryLocation} locationInfo Entry location information. | 9 * @param {!EntryLocation} locationInfo Entry location information. |
| 10 * @param {MetadataItem} metadataItem | 10 * @param {MetadataItem} metadataItem |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 return Promise.reject(str('GALLERY_FILE_EXISTS')); | 433 return Promise.reject(str('GALLERY_FILE_EXISTS')); |
| 434 }, function() { | 434 }, function() { |
| 435 return new Promise( | 435 return new Promise( |
| 436 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); | 436 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); |
| 437 }.bind(this)); | 437 }.bind(this)); |
| 438 }.bind(this)); | 438 }.bind(this)); |
| 439 }.bind(this)).then(function(entry) { | 439 }.bind(this)).then(function(entry) { |
| 440 this.entry_ = entry; | 440 this.entry_ = entry; |
| 441 }.bind(this)); | 441 }.bind(this)); |
| 442 }; | 442 }; |
| 443 |
| 444 /** |
| 445 * The threshold size of an image in pixels, which we always use thumbnail |
| 446 * image for slide-in animation above this. This is a hack to avoid an UI |
| 447 * unresponsiveness when switching between images. |
| 448 * @type {number} |
| 449 * @const |
| 450 */ |
| 451 GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS = 4000 * 3000; |
| 452 |
| 453 /** |
| 454 * Whether the image requires long rendering time. |
| 455 * |
| 456 * @return {boolean} |
| 457 */ |
| 458 GalleryItem.prototype.requireLongRenderingTime = function() { |
| 459 // Check for undefined values. |
| 460 if (!this.metadataItem_ || |
| 461 !this.metadataItem_.imageHeight || !this.metadataItem_.imageWidth) |
| 462 return false; |
| 463 var numPixels = this.metadataItem_.imageHeight * |
| 464 this.metadataItem_.imageWidth; |
| 465 return numPixels > GalleryItem.HEAVY_RENDERING_THRESHOLD_PIXELS; |
| 466 }; |
| OLD | NEW |