47class ProgressiveDecoder
final :
48#ifdef PDF_ENABLE_XFA_BMP
49 public BmpDecoder::Delegate,
51#ifdef PDF_ENABLE_XFA_GIF
52 public GifDecoder::Delegate,
54#ifdef PDF_ENABLE_XFA_PNG
55 public PngDecoder::Delegate,
75 FXCODEC_IMAGE_TYPE imageType,
76 CFX_DIBAttribute* pAttribute,
77 bool bSkipImageTypeCheck);
80 int32_t
GetWidth()
const {
return m_SrcWidth; }
94#ifdef PDF_ENABLE_XFA_PNG
96 bool PngReadHeader(
int width,
101 double* gamma) override;
102 bool PngAskScanlineBuf(
int line, uint8_t** pSrcBuf) override;
103 void PngFillScanlineBufCompleted(
int pass,
int line) override;
106#ifdef PDF_ENABLE_XFA_GIF
108 uint32_t GifCurrentPosition()
const override;
109 bool GifInputRecordPositionBuf(uint32_t rcd_pos,
110 const FX_RECT& img_rc,
112 CFX_GifPalette* pal_ptr,
114 bool interlace) override;
115 void GifReadScanline(int32_t row_num, pdfium::span<uint8_t> row_buf) override;
118#ifdef PDF_ENABLE_XFA_BMP
120 bool BmpInputImagePositionBuf(uint32_t rcd_pos) override;
121 void BmpReadScanline(uint32_t row_num,
122 pdfium::span<
const uint8_t> row_buf) override;
134 void CalculateWeights(
int dest_len,
int src_len);
135 PixelWeight* GetPixelWeight(
int pixel) {
136 return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
142 DataVector<uint8_t> m_pWeightTables;
150 void CalculateWeights(
int dest_len,
int src_len);
151 PixelWeight* GetPixelWeight(
int pixel) {
152 return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() +
158 DataVector<uint8_t> m_pWeightTables;
161#ifdef PDF_ENABLE_XFA_BMP
162 bool BmpReadMoreData(ProgressiveDecoderIface::Context* pBmpContext,
163 FXCODEC_STATUS* err_status);
164 bool BmpDetectImageTypeInBuffer(CFX_DIBAttribute* pAttribute);
165 FXCODEC_STATUS BmpStartDecode();
166 FXCODEC_STATUS BmpContinueDecode();
169#ifdef PDF_ENABLE_XFA_GIF
170 bool GifReadMoreData(FXCODEC_STATUS* err_status);
171 bool GifDetectImageTypeInBuffer();
172 FXCODEC_STATUS GifStartDecode();
173 FXCODEC_STATUS GifContinueDecode();
174 void GifDoubleLineResampleVert(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
179#ifdef PDF_ENABLE_XFA_PNG
180 void PngOneOneMapResampleHorz(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
182 pdfium::span<uint8_t> src_span,
183 FXCodec_Format src_format);
184 bool PngDetectImageTypeInBuffer(CFX_DIBAttribute* pAttribute);
185 FXCODEC_STATUS PngStartDecode();
186 FXCODEC_STATUS PngContinueDecode();
189#ifdef PDF_ENABLE_XFA_TIFF
190 bool TiffDetectImageTypeFromFile(CFX_DIBAttribute* pAttribute);
191 FXCODEC_STATUS TiffContinueDecode();
195 bool JpegDetectImageTypeInBuffer(CFX_DIBAttribute* pAttribute);
199 bool DetectImageType(FXCODEC_IMAGE_TYPE imageType,
200 CFX_DIBAttribute* pAttribute);
208 void ResampleScanline(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
210 pdfium::span<uint8_t> src_span,
212 void Resample(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
216 void ResampleVert(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
219 void ResampleVertBT(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
224 FXCODEC_IMAGE_TYPE m_imageType = FXCODEC_IMAGE_UNKNOWN;
227 RetainPtr<CFX_CodecMemory> m_pCodecMemory;
228 DataVector<uint8_t> m_DecodeBuf;
229 DataVector<FX_ARGB> m_SrcPalette;
230 std::unique_ptr<ProgressiveDecoderIface::Context> m_pJpegContext;
231#ifdef PDF_ENABLE_XFA_BMP
232 std::unique_ptr<ProgressiveDecoderIface::Context> m_pBmpContext;
234#ifdef PDF_ENABLE_XFA_GIF
235 std::unique_ptr<ProgressiveDecoderIface::Context> m_pGifContext;
237#ifdef PDF_ENABLE_XFA_PNG
238 std::unique_ptr<ProgressiveDecoderIface::Context> m_pPngContext;
240#ifdef PDF_ENABLE_XFA_TIFF
241 std::unique_ptr<ProgressiveDecoderIface::Context> m_pTiffContext;
243 uint32_t m_offSet = 0;
244 int m_ScanlineSize = 0;
245 WeightTable m_WeightHorz;
246 VertTable m_WeightVert;
247 HorzTable m_WeightHorzOO;
250 int m_SrcComponents = 0;
257 int m_TransMethod = -1;
258 int m_SrcPaletteNumber = 0;
261 int m_SrcPassNumber = 0;
262 size_t m_FrameNumber = 0;
263 size_t m_FrameCur = 0;
264#ifdef PDF_ENABLE_XFA_GIF
265 int m_GifBgIndex = 0;
266 UNOWNED_PTR_EXCLUSION CFX_GifPalette* m_pGifPalette =
nullptr;
267 int32_t m_GifPltNumber = 0;
268 int m_GifTransIndex = -1;
269 FX_RECT m_GifFrameRect;
271#ifdef PDF_ENABLE_XFA_BMP
272 bool m_BmpIsTopBottom =
false;