| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 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 #include "SkCodec.h" | 8 #include "SkCodec.h" |
| 9 #include "SkMSAN.h" | 9 #include "SkMSAN.h" |
| 10 #include "SkJpegCodec.h" | 10 #include "SkJpegCodec.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 jpeg_save_markers(decoderMgr->dinfo(), kICCMarker, 0xFFFF); | 205 jpeg_save_markers(decoderMgr->dinfo(), kICCMarker, 0xFFFF); |
| 206 } | 206 } |
| 207 | 207 |
| 208 // Read the jpeg header | 208 // Read the jpeg header |
| 209 if (JPEG_HEADER_OK != jpeg_read_header(decoderMgr->dinfo(), true)) { | 209 if (JPEG_HEADER_OK != jpeg_read_header(decoderMgr->dinfo(), true)) { |
| 210 return decoderMgr->returnFalse("read_header"); | 210 return decoderMgr->returnFalse("read_header"); |
| 211 } | 211 } |
| 212 | 212 |
| 213 if (codecOut) { | 213 if (codecOut) { |
| 214 // Get the encoded color type | 214 // Get the encoded color type |
| 215 SkEncodedInfo::Color color = decoderMgr->getEncodedColor(); | 215 SkEncodedInfo::Color color; |
| 216 if (SkEncodedInfo::kUnknown_Color == color) { | 216 if (!decoderMgr->getEncodedColor(&color)) { |
| 217 return false; | 217 return false; |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Create image info object and the codec | 220 // Create image info object and the codec |
| 221 SkEncodedInfo info = SkEncodedInfo::Make(color, SkEncodedInfo::kOpaque_A
lpha, 8); | 221 SkEncodedInfo info = SkEncodedInfo::Make(color, SkEncodedInfo::kOpaque_A
lpha, 8); |
| 222 | 222 |
| 223 Origin orientation = get_exif_orientation(decoderMgr->dinfo()); | 223 Origin orientation = get_exif_orientation(decoderMgr->dinfo()); |
| 224 sk_sp<SkColorSpace> colorSpace = get_icc_profile(decoderMgr->dinfo()); | 224 sk_sp<SkColorSpace> colorSpace = get_icc_profile(decoderMgr->dinfo()); |
| 225 | 225 |
| 226 const int width = decoderMgr->dinfo()->image_width; | 226 const int width = decoderMgr->dinfo()->image_width; |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 | 887 |
| 888 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 888 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
| 889 if (linesRead < remainingRows) { | 889 if (linesRead < remainingRows) { |
| 890 // FIXME: Handle incomplete YUV decodes without signalling an error. | 890 // FIXME: Handle incomplete YUV decodes without signalling an error. |
| 891 return kInvalidInput; | 891 return kInvalidInput; |
| 892 } | 892 } |
| 893 } | 893 } |
| 894 | 894 |
| 895 return kSuccess; | 895 return kSuccess; |
| 896 } | 896 } |
| OLD | NEW |