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

Side by Side Diff: chrome/browser/resources/file_manager/js/image_editor/exif_encoder.js

Issue 12262003: [Cleanup] Files.app: Adds missing periods at the end of the descriptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 (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 // TODO:(kaznacheev) Share the EXIF constants with exif_parser.js 5 // TODO:(kaznacheev) Share the EXIF constants with exif_parser.js
6 var EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data). 6 var EXIF_MARK_SOS = 0xffda; // Start of "stream" (the actual image data).
7 var EXIF_MARK_SOI = 0xffd8; // Start of image data. 7 var EXIF_MARK_SOI = 0xffd8; // Start of image data.
8 var EXIF_MARK_EOI = 0xffd9; // End of image data. 8 var EXIF_MARK_EOI = 0xffd9; // End of image data.
9 9
10 var EXIF_MARK_APP0 = 0xffe0; // APP0 block, most commonly JFIF data. 10 var EXIF_MARK_APP0 = 0xffe0; // APP0 block, most commonly JFIF data.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 this.metadata_.width = canvas.width; 71 this.metadata_.width = canvas.width;
72 this.metadata_.height = canvas.height; 72 this.metadata_.height = canvas.height;
73 73
74 // Always save in default orientation. 74 // Always save in default orientation.
75 delete this.metadata_.imageTransform; 75 delete this.metadata_.imageTransform;
76 ExifEncoder.findOrCreateTag(image, EXIF_TAG_ORIENTATION).value = 1; 76 ExifEncoder.findOrCreateTag(image, EXIF_TAG_ORIENTATION).value = 1;
77 }; 77 };
78 78
79 79
80 /** 80 /**
81 * @param {HTMLCanvasElement} canvas Thumbnail canvas 81 * @param {HTMLCanvasElement} canvas Thumbnail canvas.
82 * @param {number} quality (0..1] Thumbnail encoding quality 82 * @param {number} quality (0..1] Thumbnail encoding quality.
83 */ 83 */
84 ExifEncoder.prototype.setThumbnailData = function(canvas, quality) { 84 ExifEncoder.prototype.setThumbnailData = function(canvas, quality) {
85 // Empirical formula with reasonable behavior: 85 // Empirical formula with reasonable behavior:
86 // 10K for 1Mpix, 30K for 5Mpix, 50K for 9Mpix and up. 86 // 10K for 1Mpix, 30K for 5Mpix, 50K for 9Mpix and up.
87 var pixelCount = this.metadata_.width * this.metadata_.height; 87 var pixelCount = this.metadata_.width * this.metadata_.height;
88 var maxEncodedSize = 5000 * Math.min(10, 1 + pixelCount / 1000000); 88 var maxEncodedSize = 5000 * Math.min(10, 1 + pixelCount / 1000000);
89 89
90 var DATA_URL_PREFIX = 'data:' + this.mimeType + ';base64,'; 90 var DATA_URL_PREFIX = 'data:' + this.mimeType + ';base64,';
91 var BASE64_BLOAT = 4 / 3; 91 var BASE64_BLOAT = 4 / 3;
92 var maxDataURLLength = 92 var maxDataURLLength =
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 430
431 /** 431 /**
432 * Bug endian byte order. 432 * Bug endian byte order.
433 * @type {number} 433 * @type {number}
434 */ 434 */
435 ByteWriter.BIG_ENDIAN = 1; 435 ByteWriter.BIG_ENDIAN = 1;
436 436
437 /** 437 /**
438 * Set the byte ordering for future writes. 438 * Set the byte ordering for future writes.
439 * @param {number} order ByteOrder to use {ByteWriter.LITTLE_ENDIAN} 439 * @param {number} order ByteOrder to use {ByteWriter.LITTLE_ENDIAN}
440 * or {ByteWriter.BIG_ENDIAN} 440 * or {ByteWriter.BIG_ENDIAN}.
441 */ 441 */
442 ByteWriter.prototype.setByteOrder = function(order) { 442 ByteWriter.prototype.setByteOrder = function(order) {
443 this.littleEndian_ = (order == ByteWriter.LITTLE_ENDIAN); 443 this.littleEndian_ = (order == ByteWriter.LITTLE_ENDIAN);
444 }; 444 };
445 445
446 /** 446 /**
447 * @return {number} the current write position. 447 * @return {number} the current write position.
448 */ 448 */
449 ByteWriter.prototype.tell = function() { return this.pos_ }; 449 ByteWriter.prototype.tell = function() { return this.pos_ };
450 450
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 }; 558 };
559 559
560 /** 560 /**
561 * Check if every forward has been resolved, throw and error if not. 561 * Check if every forward has been resolved, throw and error if not.
562 */ 562 */
563 ByteWriter.prototype.checkResolved = function() { 563 ByteWriter.prototype.checkResolved = function() {
564 for (var key in this.forwards_) { 564 for (var key in this.forwards_) {
565 throw new Error('Unresolved forward pointer ' + key.toString(16)); 565 throw new Error('Unresolved forward pointer ' + key.toString(16));
566 } 566 }
567 }; 567 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698