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

Side by Side Diff: src/codec/SkCodecPriv.h

Issue 1813273002: Parse icc profiles and exif orientation from jpeg markers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix build error Created 4 years, 9 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
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The Android Open Source Project 2 * Copyright 2015 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkCodecPriv_DEFINED 8 #ifndef SkCodecPriv_DEFINED
9 #define SkCodecPriv_DEFINED 9 #define SkCodecPriv_DEFINED
10 10
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 inline uint32_t get_int(uint8_t* buffer, uint32_t i) { 244 inline uint32_t get_int(uint8_t* buffer, uint32_t i) {
245 uint32_t result; 245 uint32_t result;
246 memcpy(&result, &(buffer[i]), 4); 246 memcpy(&result, &(buffer[i]), 4);
247 #ifdef SK_CPU_BENDIAN 247 #ifdef SK_CPU_BENDIAN
248 return SkEndianSwap32(result); 248 return SkEndianSwap32(result);
249 #else 249 #else
250 return result; 250 return result;
251 #endif 251 #endif
252 } 252 }
253 253
254 /*
255 * @param data Buffer to read bytes from
256 * @param isLittleEndian Output parameter
257 * Indicates if the data is little endian
258 * Is unaffected on false returns
259 */
260 inline bool is_valid_endian_marker(const uint8_t* data, bool* isLittleEndian) {
261 // II indicates Intel (little endian) and MM indicates motorola (big endian) .
262 if (('I' != data[0] || 'I' != data[1]) && ('M' != data[0] || 'M' != data[1]) ) {
263 return false;
264 }
265
266 *isLittleEndian = ('I' == data[0]);
267 return true;
268 }
269
270 inline uint16_t get_endian_short(const uint8_t* data, bool littleEndian) {
271 if (littleEndian) {
272 return (data[1] << 8) | (data[0]);
273 }
274
275 return (data[0] << 8) | (data[1]);
276 }
277
254 #endif // SkCodecPriv_DEFINED 278 #endif // SkCodecPriv_DEFINED
OLDNEW
« no previous file with comments | « src/codec/SkCodec.cpp ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698