// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-'use strict';
-
/**
* The overlay displaying the image.
*
this.displayedContentGeneration_ !== this.contentGeneration_) {
this.displayedContentGeneration_ = this.contentGeneration_;
ImageUtil.trace.resetTimer('paint');
- this.paintDeviceRect(this.contentCanvas_, new Rect(this.contentCanvas_));
+ this.paintDeviceRect(
+ this.contentCanvas_, new ImageRect(this.contentCanvas_));
ImageUtil.trace.reportTimer('paint');
}
};
*
* @param {HTMLCanvasElement} canvas Canvas containing whole image. The canvas
* may not be full resolution (scaled).
- * @param {Rect} imageRect Rectangle region of the canvas to be rendered.
+ * @param {ImageRect} imageRect Rectangle region of the canvas to be rendered.
*/
ImageView.prototype.paintDeviceRect = function(canvas, imageRect) {
// Map the rectangle in full resolution image to the rectangle in the device
var deviceBounds = this.viewport_.getDeviceBounds();
var scaleX = deviceBounds.width / canvas.width;
var scaleY = deviceBounds.height / canvas.height;
- var deviceRect = new Rect(
+ var deviceRect = new ImageRect(
imageRect.left * scaleX,
imageRect.top * scaleY,
imageRect.width * scaleX,
imageRect.height * scaleY);
- Rect.drawImage(
+ ImageRect.drawImage(
this.screenImage_.getContext('2d'), canvas, deviceRect, imageRect);
};
*
* @param {Gallery.Item} item Gallery item to be loaded.
* @param {Object} effect Transition effect object.
- * @param {function(number} displayCallback Called when the image is displayed
- * (possibly as a preview).
- * @param {function(number} loadCallback Called when the image is fully loaded.
- * The parameter is the load type.
+ * @param {function(number)} displayCallback Called when the image is displayed
+ * (possibly as a preview).
+ * @param {function(number, number, *=)} loadCallback Called when the image is
+ * fully loaded. The first parameter is the load type.
*/
ImageView.prototype.load =
function(item, effect, displayCallback, loadCallback) {
/**
* Unloads content.
- * @param {Rect} zoomToRect Target rectangle for zoom-out-effect.
+ * @param {ImageRect} zoomToRect Target rectangle for zoom-out-effect.
*/
ImageView.prototype.unload = function(zoomToRect) {
if (this.unloadTimer_) {
/**
* Adds a listener for content changes.
- * @param {function} callback Callback.
+ * @param {function()} callback Callback.
*/
ImageView.prototype.addContentCallback = function(callback) {
this.contentCallbacks_.push(callback);
this.thumbnailCanvas_ = canvas.ownerDocument.createElement('canvas');
this.thumbnailCanvas_.width = Math.round(canvas.width / downScale);
this.thumbnailCanvas_.height = Math.round(canvas.height / downScale);
- Rect.drawImage(this.thumbnailCanvas_.getContext('2d'), canvas);
+ ImageRect.drawImage(this.thumbnailCanvas_.getContext('2d'), canvas);
ImageUtil.trace.reportTimer('thumb');
};
};
/**
- * @param {Rect} screenRect Target rectangle in screen coordinates.
+ * @param {ImageRect} screenRect Target rectangle in screen coordinates.
* @return {ImageView.Effect.Zoom} Zoom effect object.
*/
ImageView.prototype.createZoomEffect = function(screenRect) {
* the new image to visualize the operation.
*
* @param {HTMLCanvasElement} canvas New content canvas.
- * @param {Rect} imageCropRect The crop rectangle in image coordinates.
+ * @param {ImageRect} imageCropRect The crop rectangle in image coordinates.
* Null for rotation operations.
* @param {number} rotate90 Rotation angle in 90 degree increments.
* @return {number} Animation duration.
* while fading in the new image.
*
* @param {HTMLCanvasElement} canvas New content canvas.
- * @param {Rect} imageCropRect The crop rectangle in image coordinates.
+ * @param {ImageRect} imageCropRect The crop rectangle in image coordinates.
* @return {number} Animation duration.
*/
ImageView.prototype.animateAndReplace = function(canvas, imageCropRect) {
/**
* Obtains the CSS transformation string of the effect.
- * @param {DOMCanvas} element Canvas element to be applied the transformation.
+ * @param {HTMLCanvasElement} element Canvas element to be applied the
+ * transformation.
* @param {Viewport} viewport Current viewport.
* @return {string} CSS transformation description.
*/
*
* @param {number} previousImageWidth Width of the full resolution image.
* @param {number} previousImageHeight Height of the full resolution image.
- * @param {Rect} imageCropRect Crop rectangle in the full resolution image.
+ * @param {ImageRect} imageCropRect Crop rectangle in the full resolution image.
* @param {number=} opt_duration Duration of the effect.
* @constructor
* @extends {ImageView.Effect}
/**
* Effect to zoom to a screen rectangle.
*
- * @param {Rect} screenRect Rectangle in the application window's coordinate.
+ * @param {ImageRect} screenRect Rectangle in the application window's
+ * coordinate.
* @param {number=} opt_duration Duration of effect.
* @constructor
* @extends {ImageView.Effect}