| 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 "SkJpegDecoderMgr.h" | 8 #include "SkJpegDecoderMgr.h" |
| 9 | 9 |
| 10 #include "SkJpegUtility.h" | 10 #include "SkJpegUtility.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 bool JpegDecoderMgr::returnFalse(const char caller[]) { | 28 bool JpegDecoderMgr::returnFalse(const char caller[]) { |
| 29 print_message((j_common_ptr) &fDInfo, caller); | 29 print_message((j_common_ptr) &fDInfo, caller); |
| 30 return false; | 30 return false; |
| 31 } | 31 } |
| 32 | 32 |
| 33 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu
lt result) { | 33 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu
lt result) { |
| 34 print_message((j_common_ptr) &fDInfo, caller); | 34 print_message((j_common_ptr) &fDInfo, caller); |
| 35 return result; | 35 return result; |
| 36 } | 36 } |
| 37 | 37 |
| 38 SkEncodedInfo::Color JpegDecoderMgr::getEncodedColor() { | 38 bool JpegDecoderMgr::getEncodedColor(SkEncodedInfo::Color* outColor) { |
| 39 switch (fDInfo.jpeg_color_space) { | 39 switch (fDInfo.jpeg_color_space) { |
| 40 case JCS_GRAYSCALE: | 40 case JCS_GRAYSCALE: |
| 41 return SkEncodedInfo::kGray_Color; | 41 *outColor = SkEncodedInfo::kGray_Color; |
| 42 return true; |
| 42 case JCS_YCbCr: | 43 case JCS_YCbCr: |
| 43 return SkEncodedInfo::kYUV_Color; | 44 *outColor = SkEncodedInfo::kYUV_Color; |
| 45 return true; |
| 44 case JCS_RGB: | 46 case JCS_RGB: |
| 45 return SkEncodedInfo::kRGB_Color; | 47 *outColor = SkEncodedInfo::kRGB_Color; |
| 48 return true; |
| 46 case JCS_YCCK: | 49 case JCS_YCCK: |
| 47 return SkEncodedInfo::kYCCK_Color; | 50 *outColor = SkEncodedInfo::kYCCK_Color; |
| 51 return true; |
| 48 case JCS_CMYK: | 52 case JCS_CMYK: |
| 49 return SkEncodedInfo::kInvertedCMYK_Color; | 53 *outColor = SkEncodedInfo::kInvertedCMYK_Color; |
| 54 return true; |
| 50 default: | 55 default: |
| 51 return SkEncodedInfo::kUnknown_Color; | 56 return false; |
| 52 } | 57 } |
| 53 } | 58 } |
| 54 | 59 |
| 55 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) | 60 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) |
| 56 : fSrcMgr(stream) | 61 : fSrcMgr(stream) |
| 57 , fInit(false) | 62 , fInit(false) |
| 58 { | 63 { |
| 59 // Error manager must be set before any calls to libjeg in order to handle f
ailures | 64 // Error manager must be set before any calls to libjeg in order to handle f
ailures |
| 60 fDInfo.err = jpeg_std_error(&fErrorMgr); | 65 fDInfo.err = jpeg_std_error(&fErrorMgr); |
| 61 fErrorMgr.error_exit = skjpeg_err_exit; | 66 fErrorMgr.error_exit = skjpeg_err_exit; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 74 } | 79 } |
| 75 } | 80 } |
| 76 | 81 |
| 77 jmp_buf& JpegDecoderMgr::getJmpBuf() { | 82 jmp_buf& JpegDecoderMgr::getJmpBuf() { |
| 78 return fErrorMgr.fJmpBuf; | 83 return fErrorMgr.fJmpBuf; |
| 79 } | 84 } |
| 80 | 85 |
| 81 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { | 86 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { |
| 82 return &fDInfo; | 87 return &fDInfo; |
| 83 } | 88 } |
| OLD | NEW |