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 SkColorType JpegDecoderMgr::getColorType() { | 38 SkEncodedInfo::Color JpegDecoderMgr::getEncodedColor() { |
39 switch (fDInfo.jpeg_color_space) { | 39 switch (fDInfo.jpeg_color_space) { |
40 case JCS_GRAYSCALE: | 40 case JCS_GRAYSCALE: |
41 return kGray_8_SkColorType; | 41 return SkEncodedInfo::kGray_Color; |
| 42 case JCS_YCbCr: |
| 43 return SkEncodedInfo::kYUV_Color; |
| 44 case JCS_RGB: |
| 45 return SkEncodedInfo::kRGB_Color; |
| 46 case JCS_YCCK: |
| 47 return SkEncodedInfo::kYCCK_Color; |
| 48 case JCS_CMYK: |
| 49 return SkEncodedInfo::kInvertedCMYK_Color; |
42 default: | 50 default: |
43 return kN32_SkColorType; | 51 return SkEncodedInfo::kUnknown_Color; |
44 } | 52 } |
45 } | 53 } |
46 | 54 |
47 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) | 55 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) |
48 : fSrcMgr(stream) | 56 : fSrcMgr(stream) |
49 , fInit(false) | 57 , fInit(false) |
50 { | 58 { |
51 // Error manager must be set before any calls to libjeg in order to handle f
ailures | 59 // Error manager must be set before any calls to libjeg in order to handle f
ailures |
52 fDInfo.err = jpeg_std_error(&fErrorMgr); | 60 fDInfo.err = jpeg_std_error(&fErrorMgr); |
53 fErrorMgr.error_exit = skjpeg_err_exit; | 61 fErrorMgr.error_exit = skjpeg_err_exit; |
(...skipping 12 matching lines...) Expand all Loading... |
66 } | 74 } |
67 } | 75 } |
68 | 76 |
69 jmp_buf& JpegDecoderMgr::getJmpBuf() { | 77 jmp_buf& JpegDecoderMgr::getJmpBuf() { |
70 return fErrorMgr.fJmpBuf; | 78 return fErrorMgr.fJmpBuf; |
71 } | 79 } |
72 | 80 |
73 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { | 81 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { |
74 return &fDInfo; | 82 return &fDInfo; |
75 } | 83 } |
OLD | NEW |