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

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

Issue 571453002: Correct indentation, JSDoc, etc... to comply with closure linter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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
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 * A namespace class for image encoding functions. All methods are static. 8 * A namespace class for image encoding functions. All methods are static.
9 */ 9 */
10 function ImageEncoder() {} 10 function ImageEncoder() {}
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 * Return a thumbnail for an image. 128 * Return a thumbnail for an image.
129 * @param {HTMLCanvasElement} canvas Original image. 129 * @param {HTMLCanvasElement} canvas Original image.
130 * @param {number=} opt_shrinkage Thumbnail should be at least this much smaller 130 * @param {number=} opt_shrinkage Thumbnail should be at least this much smaller
131 * than the original image (in each dimension). 131 * than the original image (in each dimension).
132 * @return {HTMLCanvasElement} Thumbnail canvas. 132 * @return {HTMLCanvasElement} Thumbnail canvas.
133 */ 133 */
134 ImageEncoder.createThumbnail = function(canvas, opt_shrinkage) { 134 ImageEncoder.createThumbnail = function(canvas, opt_shrinkage) {
135 var MAX_THUMBNAIL_DIMENSION = 320; 135 var MAX_THUMBNAIL_DIMENSION = 320;
136 136
137 opt_shrinkage = Math.max(opt_shrinkage || 4, 137 opt_shrinkage = Math.max(opt_shrinkage || 4,
138 canvas.width / MAX_THUMBNAIL_DIMENSION, 138 canvas.width / MAX_THUMBNAIL_DIMENSION,
139 canvas.height / MAX_THUMBNAIL_DIMENSION); 139 canvas.height / MAX_THUMBNAIL_DIMENSION);
140 140
141 var thumbnailCanvas = canvas.ownerDocument.createElement('canvas'); 141 var thumbnailCanvas = canvas.ownerDocument.createElement('canvas');
142 thumbnailCanvas.width = Math.round(canvas.width / opt_shrinkage); 142 thumbnailCanvas.width = Math.round(canvas.width / opt_shrinkage);
143 thumbnailCanvas.height = Math.round(canvas.height / opt_shrinkage); 143 thumbnailCanvas.height = Math.round(canvas.height / opt_shrinkage);
144 144
145 var context = thumbnailCanvas.getContext('2d'); 145 var context = thumbnailCanvas.getContext('2d');
146 context.drawImage(canvas, 146 context.drawImage(canvas,
147 0, 0, canvas.width, canvas.height, 147 0, 0, canvas.width, canvas.height,
148 0, 0, thumbnailCanvas.width, thumbnailCanvas.height); 148 0, 0, thumbnailCanvas.width, thumbnailCanvas.height);
149 149
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 findInsertionRange = function(encodedImage) { return {from: 0, to: 0}; }; 221 findInsertionRange = function(encodedImage) { return {from: 0, to: 0}; };
222 222
223 /** 223 /**
224 * Return serialized metadata ready to write to an image file. 224 * Return serialized metadata ready to write to an image file.
225 * The return type is optimized for passing to Blob.append. 225 * The return type is optimized for passing to Blob.append.
226 * @return {ArrayBuffer} // TODO(JSDOC). 226 * @return {ArrayBuffer} // TODO(JSDOC).
227 */ 227 */
228 ImageEncoder.MetadataEncoder.prototype.encode = function() { 228 ImageEncoder.MetadataEncoder.prototype.encode = function() {
229 return new Uint8Array(0).buffer; 229 return new Uint8Array(0).buffer;
230 }; 230 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/image_editor/image_editor.js ('k') | ui/file_manager/gallery/js/image_editor/image_transform.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698