OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * Portions are Copyright (C) 2001-6 mozilla.org | 4 * Portions are Copyright (C) 2001-6 mozilla.org |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Stuart Parmenter <stuart@mozilla.com> | 7 * Stuart Parmenter <stuart@mozilla.com> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 const int exifMarker = JPEG_APP0 + 1; | 75 const int exifMarker = JPEG_APP0 + 1; |
76 | 76 |
77 // JPEG only supports a denominator of 8. | 77 // JPEG only supports a denominator of 8. |
78 const unsigned scaleDenominator = 8; | 78 const unsigned scaleDenominator = 8; |
79 | 79 |
80 } // namespace | 80 } // namespace |
81 | 81 |
82 namespace blink { | 82 namespace blink { |
83 | 83 |
84 struct decoder_error_mgr { | 84 struct decoder_error_mgr { |
| 85 DISALLOW_NEW(); |
85 struct jpeg_error_mgr pub; // "public" fields for IJG library | 86 struct jpeg_error_mgr pub; // "public" fields for IJG library |
86 int num_corrupt_warnings; // Counts corrupt warning messages | 87 int num_corrupt_warnings; // Counts corrupt warning messages |
87 jmp_buf setjmp_buffer; // For handling catastropic errors | 88 jmp_buf setjmp_buffer; // For handling catastropic errors |
88 }; | 89 }; |
89 | 90 |
90 struct decoder_source_mgr { | 91 struct decoder_source_mgr { |
| 92 DISALLOW_NEW(); |
91 struct jpeg_source_mgr pub; // "public" fields for IJG library | 93 struct jpeg_source_mgr pub; // "public" fields for IJG library |
92 JPEGImageReader* reader; | 94 JPEGImageReader* reader; |
93 }; | 95 }; |
94 | 96 |
95 enum jstate { | 97 enum jstate { |
96 JPEG_HEADER, // Reading JFIF headers | 98 JPEG_HEADER, // Reading JFIF headers |
97 JPEG_START_DECOMPRESS, | 99 JPEG_START_DECOMPRESS, |
98 JPEG_DECOMPRESS_PROGRESSIVE, // Output progressive pixels | 100 JPEG_DECOMPRESS_PROGRESSIVE, // Output progressive pixels |
99 JPEG_DECOMPRESS_SEQUENTIAL, // Output sequential pixels | 101 JPEG_DECOMPRESS_SEQUENTIAL, // Output sequential pixels |
100 JPEG_DONE | 102 JPEG_DONE |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 return YUV_410; | 284 return YUV_410; |
283 default: | 285 default: |
284 break; | 286 break; |
285 } | 287 } |
286 } | 288 } |
287 } | 289 } |
288 | 290 |
289 return YUV_UNKNOWN; | 291 return YUV_UNKNOWN; |
290 } | 292 } |
291 | 293 |
292 class JPEGImageReader { | 294 class JPEGImageReader final { |
293 USING_FAST_MALLOC(JPEGImageReader); | 295 USING_FAST_MALLOC(JPEGImageReader); |
| 296 WTF_MAKE_NONCOPYABLE(JPEGImageReader); |
294 public: | 297 public: |
295 JPEGImageReader(JPEGImageDecoder* decoder) | 298 JPEGImageReader(JPEGImageDecoder* decoder) |
296 : m_decoder(decoder) | 299 : m_decoder(decoder) |
297 , m_needsRestart(false) | 300 , m_needsRestart(false) |
298 , m_restartPosition(0) | 301 , m_restartPosition(0) |
299 , m_nextReadPosition(0) | 302 , m_nextReadPosition(0) |
300 , m_lastSetByte(nullptr) | 303 , m_lastSetByte(nullptr) |
301 , m_state(JPEG_HEADER) | 304 , m_state(JPEG_HEADER) |
302 , m_samples(nullptr) | 305 , m_samples(nullptr) |
303 #if USE(QCMSLIB) | 306 #if USE(QCMSLIB) |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 // has failed. | 1063 // has failed. |
1061 if (!m_reader->decode(onlySize) && isAllDataReceived()) | 1064 if (!m_reader->decode(onlySize) && isAllDataReceived()) |
1062 setFailed(); | 1065 setFailed(); |
1063 | 1066 |
1064 // If decoding is done or failed, we don't need the JPEGImageReader anymore. | 1067 // If decoding is done or failed, we don't need the JPEGImageReader anymore. |
1065 if (isComplete(this, onlySize) || failed()) | 1068 if (isComplete(this, onlySize) || failed()) |
1066 m_reader.clear(); | 1069 m_reader.clear(); |
1067 } | 1070 } |
1068 | 1071 |
1069 } | 1072 } |
OLD | NEW |