Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: core/src/fxcodec/codec/fx_codec_progress.h

Issue 1800523005: Move core/src/ up to core/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_png.cpp ('k') | core/src/fxcodec/codec/fx_codec_progress.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
8 #define CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
9
10 #define FXCODEC_BLOCK_SIZE 4096
11 #define FXCODEC_PNG_GAMMA 2.2
12 #if _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
13 #undef FXCODEC_PNG_GAMMA
14 #define FXCODEC_PNG_GAMMA 1.7
15 #endif
16 struct PixelWeight {
17 int m_SrcStart;
18 int m_SrcEnd;
19 int m_Weights[1];
20 };
21 class CFXCODEC_WeightTable {
22 public:
23 CFXCODEC_WeightTable() { m_pWeightTables = NULL; }
24 ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); }
25
26 void Calc(int dest_len,
27 int dest_min,
28 int dest_max,
29 int src_len,
30 int src_min,
31 int src_max,
32 FX_BOOL bInterpol);
33 PixelWeight* GetPixelWeight(int pixel) {
34 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize);
35 }
36
37 int m_DestMin, m_ItemSize;
38 uint8_t* m_pWeightTables;
39 };
40 class CFXCODEC_HorzTable {
41 public:
42 CFXCODEC_HorzTable() { m_pWeightTables = NULL; }
43 ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); }
44
45 void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
46 PixelWeight* GetPixelWeight(int pixel) {
47 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
48 }
49
50 int m_ItemSize;
51 uint8_t* m_pWeightTables;
52 };
53 class CFXCODEC_VertTable {
54 public:
55 CFXCODEC_VertTable() { m_pWeightTables = NULL; }
56 ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); }
57 void Calc(int dest_len, int src_len);
58 PixelWeight* GetPixelWeight(int pixel) {
59 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
60 }
61 int m_ItemSize;
62 uint8_t* m_pWeightTables;
63 };
64 enum FXCodec_Format {
65 FXCodec_Invalid = 0,
66 FXCodec_1bppGray = 0x101,
67 FXCodec_1bppRgb = 0x001,
68 FXCodec_8bppGray = 0x108,
69 FXCodec_8bppRgb = 0x008,
70 FXCodec_Rgb = 0x018,
71 FXCodec_Rgb32 = 0x020,
72 FXCodec_Argb = 0x220,
73 FXCodec_Cmyk = 0x120
74 };
75 class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder {
76 public:
77 CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr);
78 ~CCodec_ProgressiveDecoder() override;
79
80 FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile,
81 FXCODEC_IMAGE_TYPE imageType,
82 CFX_DIBAttribute* pAttribute) override;
83
84 FXCODEC_IMAGE_TYPE GetType() const override { return m_imagType; }
85 int32_t GetWidth() const override { return m_SrcWidth; }
86 int32_t GetHeight() const override { return m_SrcHeight; }
87 int32_t GetNumComponents() const override { return m_SrcComponents; }
88 int32_t GetBPC() const override { return m_SrcBPC; }
89 void SetClipBox(FX_RECT* clip) override;
90
91 FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause) override;
92 FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap,
93 int start_x,
94 int start_y,
95 int size_x,
96 int size_y,
97 int32_t frames,
98 FX_BOOL bInterpol) override;
99
100 FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause) override;
101
102 protected:
103 static FX_BOOL PngReadHeaderFunc(void* pModule,
104 int width,
105 int height,
106 int bpc,
107 int pass,
108 int* color_type,
109 double* gamma);
110 static FX_BOOL PngAskScanlineBufFunc(void* pModule,
111 int line,
112 uint8_t*& src_buf);
113 static void PngFillScanlineBufCompletedFunc(void* pModule,
114 int pass,
115 int line);
116 static void GifRecordCurrentPositionCallback(void* pModule,
117 FX_DWORD& cur_pos);
118 static uint8_t* GifAskLocalPaletteBufCallback(void* pModule,
119 int32_t frame_num,
120 int32_t pal_size);
121 static FX_BOOL GifInputRecordPositionBufCallback(void* pModule,
122 FX_DWORD rcd_pos,
123 const FX_RECT& img_rc,
124 int32_t pal_num,
125 void* pal_ptr,
126 int32_t delay_time,
127 FX_BOOL user_input,
128 int32_t trans_index,
129 int32_t disposal_method,
130 FX_BOOL interlace);
131 static void GifReadScanlineCallback(void* pModule,
132 int32_t row_num,
133 uint8_t* row_buf);
134 static FX_BOOL BmpInputImagePositionBufCallback(void* pModule,
135 FX_DWORD rcd_pos);
136 static void BmpReadScanlineCallback(void* pModule,
137 int32_t row_num,
138 uint8_t* row_buf);
139
140 FX_BOOL DetectImageType(FXCODEC_IMAGE_TYPE imageType,
141 CFX_DIBAttribute* pAttribute);
142 void GetDownScale(int& down_scale);
143 void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
144 void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
145 int32_t des_line,
146 uint8_t* src_scan,
147 FXCodec_Format src_format);
148 void Resample(CFX_DIBitmap* pDeviceBitmap,
149 int32_t src_line,
150 uint8_t* src_scan,
151 FXCodec_Format src_format);
152 void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
153 FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule,
154 FXCODEC_STATUS& err_status);
155 void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap,
156 int32_t des_line,
157 uint8_t* src_scan,
158 FXCodec_Format src_format);
159 FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule,
160 FXCODEC_STATUS& err_status);
161 void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap,
162 double scale_y,
163 int des_row);
164 FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule,
165 FXCODEC_STATUS& err_status);
166 void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
167
168 public:
169 IFX_FileRead* m_pFile;
170 CCodec_ModuleMgr* m_pCodecMgr;
171 void* m_pJpegContext;
172 void* m_pPngContext;
173 void* m_pGifContext;
174 void* m_pBmpContext;
175 void* m_pTiffContext;
176 FXCODEC_IMAGE_TYPE m_imagType;
177 FX_DWORD m_offSet;
178 uint8_t* m_pSrcBuf;
179 FX_DWORD m_SrcSize;
180 uint8_t* m_pDecodeBuf;
181 int m_ScanlineSize;
182 CFX_DIBitmap* m_pDeviceBitmap;
183 FX_BOOL m_bInterpol;
184 CFXCODEC_WeightTable m_WeightHorz;
185 CFXCODEC_VertTable m_WeightVert;
186 CFXCODEC_HorzTable m_WeightHorzOO;
187 int m_SrcWidth;
188 int m_SrcHeight;
189 int m_SrcComponents;
190 int m_SrcBPC;
191 FX_RECT m_clipBox;
192 int m_startX;
193 int m_startY;
194 int m_sizeX;
195 int m_sizeY;
196 int m_TransMethod;
197 FX_ARGB* m_pSrcPalette;
198 int m_SrcPaletteNumber;
199 int m_SrcRow;
200 FXCodec_Format m_SrcFormat;
201 int m_SrcPassNumber;
202 int m_FrameNumber;
203 int m_FrameCur;
204 int m_GifBgIndex;
205 uint8_t* m_pGifPalette;
206 int32_t m_GifPltNumber;
207 int m_GifTransIndex;
208 FX_RECT m_GifFrameRect;
209 FX_BOOL m_BmpIsTopBottom;
210 FXCODEC_STATUS m_status;
211 };
212
213 #endif // CORE_SRC_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_
OLDNEW
« no previous file with comments | « core/src/fxcodec/codec/fx_codec_png.cpp ('k') | core/src/fxcodec/codec/fx_codec_progress.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698