Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: ui/file_manager/gallery/js/image_editor/image_util.js

Issue 398263002: Gallery: Random fixes for the Viewport class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 'use strict'; 5 'use strict';
6 6
7 7
8 // Namespace object for the utilities. 8 // Namespace object for the utilities.
9 function ImageUtil() {} 9 function ImageUtil() {}
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 this.left = 0; 132 this.left = 0;
133 this.top = 0; 133 this.top = 0;
134 this.width = 0; 134 this.width = 0;
135 this.height = 0; 135 this.height = 0;
136 return; 136 return;
137 } 137 }
138 console.error('Invalid Rect constructor arguments:', 138 console.error('Invalid Rect constructor arguments:',
139 Array.apply(null, arguments)); 139 Array.apply(null, arguments));
140 } 140 }
141 141
142 Rect.prototype = {
143 /**
144 * Obtains the x coordinate of right edge. The most right pixels in the
145 * rectangle are (x = right - 1) and the pixels (x = right) are not included
146 * in the rectangle.
147 * @return {number}
148 */
149 get right() {
150 return this.left + this.width;
151 },
152
153 /**
154 * Obtains the y coordinate of bottom edge. The most bottom pixels in the
155 * rectanlge are (y = buttom - 1) and the pixels (y = bottom) are not included
156 * in the rectangle.
157 * @return {number}
158 */
159 get bottom() {
160 return this.top + this.height;
161 }
162 };
163
142 /** 164 /**
143 * @param {number} factor Factor to scale. 165 * @param {number} factor Factor to scale.
144 * @return {Rect} A rectangle with every dimension scaled. 166 * @return {Rect} A rectangle with every dimension scaled.
145 */ 167 */
146 Rect.prototype.scale = function(factor) { 168 Rect.prototype.scale = function(factor) {
147 return new Rect( 169 return new Rect(
148 this.left * factor, 170 this.left * factor,
149 this.top * factor, 171 this.top * factor,
150 this.width * factor, 172 this.width * factor,
151 this.height * factor); 173 this.height * factor);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 * @return {string} Full name. 685 * @return {string} Full name.
664 */ 686 */
665 ImageUtil.getMetricName = function(name) { 687 ImageUtil.getMetricName = function(name) {
666 return 'PhotoEditor.' + name; 688 return 'PhotoEditor.' + name;
667 }; 689 };
668 690
669 /** 691 /**
670 * Used for metrics reporting, keep in sync with the histogram description. 692 * Used for metrics reporting, keep in sync with the histogram description.
671 */ 693 */
672 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; 694 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp'];
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/image_transform.js ('k') | ui/file_manager/gallery/js/image_editor/image_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698