| 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 * @param {HTMLElement} container The container element. | 7 * @param {HTMLElement} container The container element. |
| 8 * @param {Viewport} viewport The viewport. | 8 * @param {Viewport} viewport The viewport. |
| 9 * @param {MetadataCache} metadataCache The metadataCache. | 9 * @param {MetadataCache} metadataCache The metadataCache. |
| 10 */ | 10 */ |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * The total number of load types. | 91 * The total number of load types. |
| 92 */ | 92 */ |
| 93 ImageView.LOAD_TYPE_TOTAL = 6; | 93 ImageView.LOAD_TYPE_TOTAL = 6; |
| 94 | 94 |
| 95 ImageView.prototype = {__proto__: ImageBuffer.Overlay.prototype}; | 95 ImageView.prototype = {__proto__: ImageBuffer.Overlay.prototype}; |
| 96 | 96 |
| 97 /** | 97 /** |
| 98 * Draw below overlays with the default zIndex. | 98 * Draw below overlays with the default zIndex. |
| 99 * @return {number} Z-index | 99 * @return {number} Z-index. |
| 100 */ | 100 */ |
| 101 ImageView.prototype.getZIndex = function() { return -1 }; | 101 ImageView.prototype.getZIndex = function() { return -1 }; |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * Draw the image on screen. | 104 * Draw the image on screen. |
| 105 */ | 105 */ |
| 106 ImageView.prototype.draw = function() { | 106 ImageView.prototype.draw = function() { |
| 107 if (!this.contentCanvas_) // Do nothing if the image content is not set. | 107 if (!this.contentCanvas_) // Do nothing if the image content is not set. |
| 108 return; | 108 return; |
| 109 | 109 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 imageRect = new Rect(imageRect.left * scaleX, imageRect.top * scaleY, | 223 imageRect = new Rect(imageRect.left * scaleX, imageRect.top * scaleY, |
| 224 imageRect.width * scaleX, imageRect.height * scaleY); | 224 imageRect.width * scaleX, imageRect.height * scaleY); |
| 225 Rect.drawImage( | 225 Rect.drawImage( |
| 226 this.screenImage_.getContext('2d'), canvas, deviceRect, imageRect); | 226 this.screenImage_.getContext('2d'), canvas, deviceRect, imageRect); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 /** | 229 /** |
| 230 * Create an overlay canvas with properties similar to the screen canvas. | 230 * Create an overlay canvas with properties similar to the screen canvas. |
| 231 * Useful for showing quick feedback when editing. | 231 * Useful for showing quick feedback when editing. |
| 232 * | 232 * |
| 233 * @return {HTMLCanvasElement} Overlay canvas | 233 * @return {HTMLCanvasElement} Overlay canvas. |
| 234 */ | 234 */ |
| 235 ImageView.prototype.createOverlayCanvas = function() { | 235 ImageView.prototype.createOverlayCanvas = function() { |
| 236 var canvas = this.document_.createElement('canvas'); | 236 var canvas = this.document_.createElement('canvas'); |
| 237 canvas.className = 'image'; | 237 canvas.className = 'image'; |
| 238 this.container_.appendChild(canvas); | 238 this.container_.appendChild(canvas); |
| 239 return canvas; | 239 return canvas; |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 /** | 242 /** |
| 243 * Sets up the canvas as a buffer in the device resolution. | 243 * Sets up the canvas as a buffer in the device resolution. |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 | 1043 |
| 1044 /** | 1044 /** |
| 1045 * @param {HTMLCanvasElement|HTMLVideoElement} element Element. | 1045 * @param {HTMLCanvasElement|HTMLVideoElement} element Element. |
| 1046 * @return {string} Transform string. | 1046 * @return {string} Transform string. |
| 1047 */ | 1047 */ |
| 1048 ImageView.Effect.Rotate.prototype.transform = function(element) { | 1048 ImageView.Effect.Rotate.prototype.transform = function(element) { |
| 1049 var ratio = ImageView.Effect.getPixelRatio_(element); | 1049 var ratio = ImageView.Effect.getPixelRatio_(element); |
| 1050 return 'rotate(' + (this.rotate90_ * 90) + 'deg) ' + | 1050 return 'rotate(' + (this.rotate90_ * 90) + 'deg) ' + |
| 1051 'scale(' + (this.scale_ / ratio) + ')'; | 1051 'scale(' + (this.scale_ / ratio) + ')'; |
| 1052 }; | 1052 }; |
| OLD | NEW |