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

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: 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 number of right edge.
mtomasz 2014/07/17 06:08:56 nit: Please add a comment, that the edge is one pi
hirono 2014/07/17 06:26:54 Done.
145 * @return {number}
146 */
147 get right() {
148 return this.left + this.width;
mtomasz 2014/07/17 05:43:20 I think it should be: this.left + this.width - 1.
hirono 2014/07/17 05:56:47 Exactly. but the right edge of the pixel is a line
mtomasz 2014/07/17 06:08:56 This is quite confusing. The left edge is within t
hirono 2014/07/17 06:26:54 Maybe this is common when implementing rectangle c
149 },
150
151 /**
152 * Obtains the y coordinate number of bottom edge.
mtomasz 2014/07/17 06:08:56 nit: coordinate number -> coordinate
hirono 2014/07/17 06:26:54 Done.
153 * @return {number}
154 */
155 get bottom() {
156 return this.top + this.height;
157 }
158 };
159
142 /** 160 /**
143 * @param {number} factor Factor to scale. 161 * @param {number} factor Factor to scale.
144 * @return {Rect} A rectangle with every dimension scaled. 162 * @return {Rect} A rectangle with every dimension scaled.
145 */ 163 */
146 Rect.prototype.scale = function(factor) { 164 Rect.prototype.scale = function(factor) {
147 return new Rect( 165 return new Rect(
148 this.left * factor, 166 this.left * factor,
149 this.top * factor, 167 this.top * factor,
150 this.width * factor, 168 this.width * factor,
151 this.height * factor); 169 this.height * factor);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 * @return {string} Full name. 681 * @return {string} Full name.
664 */ 682 */
665 ImageUtil.getMetricName = function(name) { 683 ImageUtil.getMetricName = function(name) {
666 return 'PhotoEditor.' + name; 684 return 'PhotoEditor.' + name;
667 }; 685 };
668 686
669 /** 687 /**
670 * Used for metrics reporting, keep in sync with the histogram description. 688 * Used for metrics reporting, keep in sync with the histogram description.
671 */ 689 */
672 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp']; 690 ImageUtil.FILE_TYPES = ['jpg', 'png', 'gif', 'bmp', 'webp'];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698