OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_ | 7 #ifndef CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_ |
8 #define CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_ | 8 #define CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_system.h" | 10 #include "core/fxcrt/include/fx_system.h" |
11 | 11 |
12 class CCodec_ScanlineDecoder; | 12 class CCodec_ScanlineDecoder; |
13 class CFX_DIBSource; | 13 class CFX_DIBSource; |
14 struct FXJPEG_Context; | 14 struct FXJPEG_Context; |
15 | 15 |
16 #ifdef PDF_ENABLE_XFA | 16 #ifdef PDF_ENABLE_XFA |
17 class CFX_DIBAttribute; | 17 class CFX_DIBAttribute; |
18 #endif // PDF_ENABLE_XFA | 18 #endif // PDF_ENABLE_XFA |
19 | 19 |
20 class CCodec_JpegModule { | 20 class CCodec_JpegModule { |
21 public: | 21 public: |
22 CCodec_JpegModule() {} | 22 CCodec_JpegModule() {} |
| 23 |
23 CCodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 24 CCodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, |
24 uint32_t src_size, | 25 uint32_t src_size, |
25 int width, | 26 int width, |
26 int height, | 27 int height, |
27 int nComps, | 28 int nComps, |
28 FX_BOOL ColorTransform); | 29 FX_BOOL ColorTransform); |
29 FX_BOOL LoadInfo(const uint8_t* src_buf, | 30 bool LoadInfo(const uint8_t* src_buf, |
30 uint32_t src_size, | 31 uint32_t src_size, |
31 int& width, | 32 int* width, |
32 int& height, | 33 int* height, |
33 int& num_components, | 34 int* num_components, |
34 int& bits_per_components, | 35 int* bits_per_components, |
35 FX_BOOL& color_transform, | 36 bool* color_transform); |
36 uint8_t** icc_buf_ptr = nullptr, | |
37 uint32_t* icc_length = nullptr); | |
38 FX_BOOL Encode(const CFX_DIBSource* pSource, | |
39 uint8_t*& dest_buf, | |
40 FX_STRSIZE& dest_size, | |
41 int quality = 75, | |
42 const uint8_t* icc_buf = nullptr, | |
43 uint32_t icc_length = 0); | |
44 FXJPEG_Context* Start(); | 37 FXJPEG_Context* Start(); |
45 void Finish(FXJPEG_Context* pContext); | 38 void Finish(FXJPEG_Context* pContext); |
46 void Input(FXJPEG_Context* pContext, | 39 void Input(FXJPEG_Context* pContext, |
47 const uint8_t* src_buf, | 40 const uint8_t* src_buf, |
48 uint32_t src_size); | 41 uint32_t src_size); |
49 | 42 |
50 #ifndef PDF_ENABLE_XFA | 43 #ifndef PDF_ENABLE_XFA |
51 int ReadHeader(FXJPEG_Context* pContext, | 44 int ReadHeader(FXJPEG_Context* pContext, |
52 int* width, | 45 int* width, |
53 int* height, | 46 int* height, |
54 int* nComps); | 47 int* nComps); |
55 #else // PDF_ENABLE_XFA | 48 #else // PDF_ENABLE_XFA |
56 int ReadHeader(FXJPEG_Context* pContext, | 49 int ReadHeader(FXJPEG_Context* pContext, |
57 int* width, | 50 int* width, |
58 int* height, | 51 int* height, |
59 int* nComps, | 52 int* nComps, |
60 CFX_DIBAttribute* pAttribute); | 53 CFX_DIBAttribute* pAttribute); |
61 #endif // PDF_ENABLE_XFA | 54 #endif // PDF_ENABLE_XFA |
62 | 55 |
63 int StartScanline(FXJPEG_Context* pContext, int down_scale); | 56 int StartScanline(FXJPEG_Context* pContext, int down_scale); |
64 FX_BOOL ReadScanline(FXJPEG_Context* pContext, uint8_t* dest_buf); | 57 FX_BOOL ReadScanline(FXJPEG_Context* pContext, uint8_t* dest_buf); |
65 uint32_t GetAvailInput(FXJPEG_Context* pContext, uint8_t** avail_buf_ptr); | 58 uint32_t GetAvailInput(FXJPEG_Context* pContext, uint8_t** avail_buf_ptr); |
66 }; | 59 }; |
67 | 60 |
68 #endif // CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_ | 61 #endif // CORE_FXCODEC_CODEC_CCODEC_JPEGMODULE_H_ |
OLD | NEW |