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