OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * The overlay displaying the image. | 6 * The overlay displaying the image. |
| 7 * @constructor |
7 * @param {HTMLElement} container The container element. | 8 * @param {HTMLElement} container The container element. |
8 * @param {Viewport} viewport The viewport. | 9 * @param {Viewport} viewport The viewport. |
9 * @param {MetadataCache} metadataCache The metadataCache. | 10 * @param {MetadataCache} metadataCache The metadataCache. |
10 */ | 11 */ |
11 function ImageView(container, viewport, metadataCache) { | 12 function ImageView(container, viewport, metadataCache) { |
12 this.container_ = container; | 13 this.container_ = container; |
13 this.viewport_ = viewport; | 14 this.viewport_ = viewport; |
14 this.document_ = container.ownerDocument; | 15 this.document_ = container.ownerDocument; |
15 this.contentGeneration_ = 0; | 16 this.contentGeneration_ = 0; |
16 this.displayedContentGeneration_ = 0; | 17 this.displayedContentGeneration_ = 0; |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 oldScreenImage.parentNode.removeChild(oldScreenImage); | 763 oldScreenImage.parentNode.removeChild(oldScreenImage); |
763 }, effect.getSafeInterval()); | 764 }, effect.getSafeInterval()); |
764 | 765 |
765 return effect.getSafeInterval(); | 766 return effect.getSafeInterval(); |
766 }; | 767 }; |
767 | 768 |
768 | 769 |
769 /** | 770 /** |
770 * Generic cache with a limited capacity and LRU eviction. | 771 * Generic cache with a limited capacity and LRU eviction. |
771 * | 772 * |
| 773 * @constructor |
772 * @param {number} capacity Maximum number of cached item. | 774 * @param {number} capacity Maximum number of cached item. |
773 */ | 775 */ |
774 ImageView.Cache = function(capacity) { | 776 ImageView.Cache = function(capacity) { |
775 this.capacity_ = capacity; | 777 this.capacity_ = capacity; |
776 this.map_ = {}; | 778 this.map_ = {}; |
777 this.order_ = []; | 779 this.order_ = []; |
778 }; | 780 }; |
779 | 781 |
780 /** | 782 /** |
781 * Fetch the item from the cache. | 783 * Fetch the item from the cache. |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 | 1045 |
1044 /** | 1046 /** |
1045 * @param {HTMLCanvasElement|HTMLVideoElement} element Element. | 1047 * @param {HTMLCanvasElement|HTMLVideoElement} element Element. |
1046 * @return {string} Transform string. | 1048 * @return {string} Transform string. |
1047 */ | 1049 */ |
1048 ImageView.Effect.Rotate.prototype.transform = function(element) { | 1050 ImageView.Effect.Rotate.prototype.transform = function(element) { |
1049 var ratio = ImageView.Effect.getPixelRatio_(element); | 1051 var ratio = ImageView.Effect.getPixelRatio_(element); |
1050 return 'rotate(' + (this.rotate90_ * 90) + 'deg) ' + | 1052 return 'rotate(' + (this.rotate90_ * 90) + 'deg) ' + |
1051 'scale(' + (this.scale_ / ratio) + ')'; | 1053 'scale(' + (this.scale_ / ratio) + ')'; |
1052 }; | 1054 }; |
OLD | NEW |