| 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" |
| 11 #include "SkJpegDecoderMgr.h" | 11 #include "SkJpegDecoderMgr.h" |
| 12 #include "SkJpegUtility_codec.h" | |
| 13 #include "SkCodecPriv.h" | 12 #include "SkCodecPriv.h" |
| 14 #include "SkColorPriv.h" | 13 #include "SkColorPriv.h" |
| 15 #include "SkStream.h" | 14 #include "SkStream.h" |
| 16 #include "SkTemplates.h" | 15 #include "SkTemplates.h" |
| 17 #include "SkTypes.h" | 16 #include "SkTypes.h" |
| 18 | 17 |
| 19 // stdio is needed for libjpeg-turbo | 18 // stdio is needed for libjpeg-turbo |
| 20 #include <stdio.h> | 19 #include <stdio.h> |
| 20 #include "SkJpegUtility.h" |
| 21 | 21 |
| 22 extern "C" { | 22 extern "C" { |
| 23 #include "jerror.h" | 23 #include "jerror.h" |
| 24 #include "jpeglib.h" | 24 #include "jpeglib.h" |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool SkJpegCodec::IsJpeg(const void* buffer, size_t bytesRead) { | 27 bool SkJpegCodec::IsJpeg(const void* buffer, size_t bytesRead) { |
| 28 static const uint8_t jpegSig[] = { 0xFF, 0xD8, 0xFF }; | 28 static const uint8_t jpegSig[] = { 0xFF, 0xD8, 0xFF }; |
| 29 return bytesRead >= 3 && !memcmp(buffer, jpegSig, sizeof(jpegSig)); | 29 return bytesRead >= 3 && !memcmp(buffer, jpegSig, sizeof(jpegSig)); |
| 30 } | 30 } |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 889 |
| 890 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); | 890 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); |
| 891 if (linesRead < remainingRows) { | 891 if (linesRead < remainingRows) { |
| 892 // FIXME: Handle incomplete YUV decodes without signalling an error. | 892 // FIXME: Handle incomplete YUV decodes without signalling an error. |
| 893 return kInvalidInput; | 893 return kInvalidInput; |
| 894 } | 894 } |
| 895 } | 895 } |
| 896 | 896 |
| 897 return kSuccess; | 897 return kSuccess; |
| 898 } | 898 } |
| OLD | NEW |