OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 _FX_CODEC_PROGRESS_H_ | 7 #ifndef _FX_CODEC_PROGRESS_H_ |
8 #define _FX_CODEC_PROGRESS_H_ | 8 #define _FX_CODEC_PROGRESS_H_ |
9 #define FXCODEC_BLOCK_SIZE 4096 | 9 #define FXCODEC_BLOCK_SIZE 4096 |
10 #define FXCODEC_PNG_GAMMA 2.2 | 10 #define FXCODEC_PNG_GAMMA 2.2 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 FXCodec_8bppGray = 0x108, | 79 FXCodec_8bppGray = 0x108, |
80 FXCodec_8bppRgb = 0x008, | 80 FXCodec_8bppRgb = 0x008, |
81 FXCodec_Rgb = 0x018, | 81 FXCodec_Rgb = 0x018, |
82 FXCodec_Rgb32 = 0x020, | 82 FXCodec_Rgb32 = 0x020, |
83 FXCodec_Argb = 0x220, | 83 FXCodec_Argb = 0x220, |
84 FXCodec_Cmyk = 0x120 | 84 FXCodec_Cmyk = 0x120 |
85 }; | 85 }; |
86 class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { | 86 class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder { |
87 public: | 87 public: |
88 CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); | 88 CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); |
89 virtual ~CCodec_ProgressiveDecoder(); | 89 ~CCodec_ProgressiveDecoder() override; |
90 | 90 |
91 public: | 91 FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, |
92 virtual FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, | 92 FXCODEC_IMAGE_TYPE imageType, |
93 FXCODEC_IMAGE_TYPE imageType, | 93 CFX_DIBAttribute* pAttribute) override; |
94 CFX_DIBAttribute* pAttribute); | |
95 | 94 |
96 virtual FXCODEC_IMAGE_TYPE GetType() { return m_imagType; } | 95 FXCODEC_IMAGE_TYPE GetType() const override { return m_imagType; } |
97 virtual int32_t GetWidth() { return m_SrcWidth; } | 96 int32_t GetWidth() const override { return m_SrcWidth; } |
98 virtual int32_t GetHeight() { return m_SrcHeight; } | 97 int32_t GetHeight() const override { return m_SrcHeight; } |
99 virtual int32_t GetNumComponents() { return m_SrcComponents; } | 98 int32_t GetNumComponents() const override { return m_SrcComponents; } |
100 virtual int32_t GetBPC() { return m_SrcBPC; } | 99 int32_t GetBPC() const override { return m_SrcBPC; } |
101 virtual void SetClipBox(FX_RECT* clip); | 100 void SetClipBox(FX_RECT* clip) override; |
102 virtual FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause); | |
103 | 101 |
104 virtual FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap, | 102 FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause) override; |
105 int start_x, | 103 FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap, |
106 int start_y, | 104 int start_x, |
107 int size_x, | 105 int start_y, |
108 int size_y, | 106 int size_x, |
109 int32_t frames, | 107 int size_y, |
110 FX_BOOL bInterpol); | 108 int32_t frames, |
| 109 FX_BOOL bInterpol) override; |
111 | 110 |
112 virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause); | 111 FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause) override; |
113 | 112 |
114 protected: | 113 protected: |
115 FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType, | |
116 CFX_DIBAttribute* pAttribute = NULL); | |
117 void GetDownScale(int& down_scale); | |
118 void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format); | |
119 void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, | |
120 int32_t des_line, | |
121 uint8_t* src_scan, | |
122 FXCodec_Format src_format); | |
123 void Resample(CFX_DIBitmap* pDeviceBitmap, | |
124 int32_t src_line, | |
125 uint8_t* src_scan, | |
126 FXCodec_Format src_format); | |
127 void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); | |
128 FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule, | |
129 FXCODEC_STATUS& err_status); | |
130 static FX_BOOL PngReadHeaderFunc(void* pModule, | 114 static FX_BOOL PngReadHeaderFunc(void* pModule, |
131 int width, | 115 int width, |
132 int height, | 116 int height, |
133 int bpc, | 117 int bpc, |
134 int pass, | 118 int pass, |
135 int* color_type, | 119 int* color_type, |
136 double* gamma); | 120 double* gamma); |
137 static FX_BOOL PngAskScanlineBufFunc(void* pModule, | 121 static FX_BOOL PngAskScanlineBufFunc(void* pModule, |
138 int line, | 122 int line, |
139 uint8_t*& src_buf); | 123 uint8_t*& src_buf); |
140 static void PngFillScanlineBufCompletedFunc(void* pModule, | 124 static void PngFillScanlineBufCompletedFunc(void* pModule, |
141 int pass, | 125 int pass, |
142 int line); | 126 int line); |
143 void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, | |
144 int32_t des_line, | |
145 uint8_t* src_scan, | |
146 FXCodec_Format src_format); | |
147 | |
148 FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule, | |
149 FXCODEC_STATUS& err_status); | |
150 static void GifRecordCurrentPositionCallback(void* pModule, | 127 static void GifRecordCurrentPositionCallback(void* pModule, |
151 FX_DWORD& cur_pos); | 128 FX_DWORD& cur_pos); |
152 static uint8_t* GifAskLocalPaletteBufCallback(void* pModule, | 129 static uint8_t* GifAskLocalPaletteBufCallback(void* pModule, |
153 int32_t frame_num, | 130 int32_t frame_num, |
154 int32_t pal_size); | 131 int32_t pal_size); |
155 static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, | 132 static FX_BOOL GifInputRecordPositionBufCallback(void* pModule, |
156 FX_DWORD rcd_pos, | 133 FX_DWORD rcd_pos, |
157 const FX_RECT& img_rc, | 134 const FX_RECT& img_rc, |
158 int32_t pal_num, | 135 int32_t pal_num, |
159 void* pal_ptr, | 136 void* pal_ptr, |
160 int32_t delay_time, | 137 int32_t delay_time, |
161 FX_BOOL user_input, | 138 FX_BOOL user_input, |
162 int32_t trans_index, | 139 int32_t trans_index, |
163 int32_t disposal_method, | 140 int32_t disposal_method, |
164 FX_BOOL interlace); | 141 FX_BOOL interlace); |
165 static void GifReadScanlineCallback(void* pModule, | 142 static void GifReadScanlineCallback(void* pModule, |
166 int32_t row_num, | 143 int32_t row_num, |
167 uint8_t* row_buf); | 144 uint8_t* row_buf); |
| 145 static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, |
| 146 FX_DWORD rcd_pos); |
| 147 static void BmpReadScanlineCallback(void* pModule, |
| 148 int32_t row_num, |
| 149 uint8_t* row_buf); |
| 150 |
| 151 FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType, |
| 152 CFX_DIBAttribute* pAttribute); |
| 153 void GetDownScale(int& down_scale); |
| 154 void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format); |
| 155 void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, |
| 156 int32_t des_line, |
| 157 uint8_t* src_scan, |
| 158 FXCodec_Format src_format); |
| 159 void Resample(CFX_DIBitmap* pDeviceBitmap, |
| 160 int32_t src_line, |
| 161 uint8_t* src_scan, |
| 162 FXCodec_Format src_format); |
| 163 void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); |
| 164 FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule, |
| 165 FXCODEC_STATUS& err_status); |
| 166 void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, |
| 167 int32_t des_line, |
| 168 uint8_t* src_scan, |
| 169 FXCodec_Format src_format); |
| 170 FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule, |
| 171 FXCODEC_STATUS& err_status); |
168 void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, | 172 void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, |
169 double scale_y, | 173 double scale_y, |
170 int des_row); | 174 int des_row); |
171 FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule, | 175 FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule, |
172 FXCODEC_STATUS& err_status); | 176 FXCODEC_STATUS& err_status); |
173 static FX_BOOL BmpInputImagePositionBufCallback(void* pModule, | |
174 FX_DWORD rcd_pos); | |
175 static void BmpReadScanlineCallback(void* pModule, | |
176 int32_t row_num, | |
177 uint8_t* row_buf); | |
178 void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); | 177 void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); |
179 | 178 |
180 public: | 179 public: |
181 IFX_FileRead* m_pFile; | 180 IFX_FileRead* m_pFile; |
182 CCodec_ModuleMgr* m_pCodecMgr; | 181 CCodec_ModuleMgr* m_pCodecMgr; |
183 void* m_pJpegContext; | 182 void* m_pJpegContext; |
184 void* m_pPngContext; | 183 void* m_pPngContext; |
185 void* m_pGifContext; | 184 void* m_pGifContext; |
186 void* m_pBmpContext; | 185 void* m_pBmpContext; |
187 void* m_pTiffContext; | 186 void* m_pTiffContext; |
(...skipping 27 matching lines...) Expand all Loading... |
215 int m_FrameCur; | 214 int m_FrameCur; |
216 int m_GifBgIndex; | 215 int m_GifBgIndex; |
217 uint8_t* m_pGifPalette; | 216 uint8_t* m_pGifPalette; |
218 int32_t m_GifPltNumber; | 217 int32_t m_GifPltNumber; |
219 int m_GifTransIndex; | 218 int m_GifTransIndex; |
220 FX_RECT m_GifFrameRect; | 219 FX_RECT m_GifFrameRect; |
221 FX_BOOL m_BmpIsTopBottom; | 220 FX_BOOL m_BmpIsTopBottom; |
222 FXCODEC_STATUS m_status; | 221 FXCODEC_STATUS m_status; |
223 }; | 222 }; |
224 #endif | 223 #endif |
OLD | NEW |