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

Side by Side Diff: core/fxcodec/codec/include/ccodec_progressivedecoder.h

Issue 1876023003: Remove ICodec_* Interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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 CORE_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_ 7 #ifndef CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_
8 #define CORE_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_ 8 #define CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_
9 9
10 #include "core/fxcodec/include/fx_codec.h"
11 #include "core/fxcrt/include/fx_memory.h"
12 #include "core/fxcrt/include/fx_system.h" 10 #include "core/fxcrt/include/fx_system.h"
11 #include "core/fxcodec/include/fx_codec_def.h"
Tom Sepez 2016/04/11 17:16:21 alphabetize
dsinclair 2016/04/11 20:40:40 Done.
13 #include "core/fxge/include/fx_dib.h" 12 #include "core/fxge/include/fx_dib.h"
14 13
15 #define FXCODEC_BLOCK_SIZE 4096 14 class CCodec_BmpModule;
16 #define FXCODEC_PNG_GAMMA 2.2 15 class CCodec_GifModule;
16 class CCodec_JpegModule;
17 class CCodec_ModuleMgr;
18 class CFX_DIBAttribute;
19 class IFX_FileRead;
20 class IFX_Pause;
17 21
18 #if _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_ 22 class CCodec_ProgressiveDecoder {
19 #undef FXCODEC_PNG_GAMMA 23 public:
20 #define FXCODEC_PNG_GAMMA 1.7 24 enum FXCodec_Format {
21 #endif 25 FXCodec_Invalid = 0,
26 FXCodec_1bppGray = 0x101,
27 FXCodec_1bppRgb = 0x001,
28 FXCodec_8bppGray = 0x108,
29 FXCodec_8bppRgb = 0x008,
30 FXCodec_Rgb = 0x018,
31 FXCodec_Rgb32 = 0x020,
32 FXCodec_Argb = 0x220,
33 FXCodec_Cmyk = 0x120
34 };
22 35
23 struct PixelWeight {
24 int m_SrcStart;
25 int m_SrcEnd;
26 int m_Weights[1];
27 };
28
29 class CFXCODEC_WeightTable {
30 public:
31 CFXCODEC_WeightTable() { m_pWeightTables = NULL; }
32 ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); }
33
34 void Calc(int dest_len,
35 int dest_min,
36 int dest_max,
37 int src_len,
38 int src_min,
39 int src_max,
40 FX_BOOL bInterpol);
41 PixelWeight* GetPixelWeight(int pixel) {
42 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize);
43 }
44
45 int m_DestMin, m_ItemSize;
46 uint8_t* m_pWeightTables;
47 };
48 class CFXCODEC_HorzTable {
49 public:
50 CFXCODEC_HorzTable() { m_pWeightTables = NULL; }
51 ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); }
52
53 void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
54 PixelWeight* GetPixelWeight(int pixel) {
55 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
56 }
57
58 int m_ItemSize;
59 uint8_t* m_pWeightTables;
60 };
61 class CFXCODEC_VertTable {
62 public:
63 CFXCODEC_VertTable() { m_pWeightTables = NULL; }
64 ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); }
65 void Calc(int dest_len, int src_len);
66 PixelWeight* GetPixelWeight(int pixel) {
67 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
68 }
69 int m_ItemSize;
70 uint8_t* m_pWeightTables;
71 };
72 enum FXCodec_Format {
73 FXCodec_Invalid = 0,
74 FXCodec_1bppGray = 0x101,
75 FXCodec_1bppRgb = 0x001,
76 FXCodec_8bppGray = 0x108,
77 FXCodec_8bppRgb = 0x008,
78 FXCodec_Rgb = 0x018,
79 FXCodec_Rgb32 = 0x020,
80 FXCodec_Argb = 0x220,
81 FXCodec_Cmyk = 0x120
82 };
83 class CCodec_ProgressiveDecoder : public ICodec_ProgressiveDecoder {
84 public:
85 CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); 36 CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr);
86 ~CCodec_ProgressiveDecoder() override; 37 ~CCodec_ProgressiveDecoder();
87 38
88 FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, 39 FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile,
89 FXCODEC_IMAGE_TYPE imageType, 40 FXCODEC_IMAGE_TYPE imageType,
90 CFX_DIBAttribute* pAttribute) override; 41 CFX_DIBAttribute* pAttribute);
91 42
92 FXCODEC_IMAGE_TYPE GetType() const override { return m_imagType; } 43 FXCODEC_IMAGE_TYPE GetType() const { return m_imagType; }
93 int32_t GetWidth() const override { return m_SrcWidth; } 44 int32_t GetWidth() const { return m_SrcWidth; }
94 int32_t GetHeight() const override { return m_SrcHeight; } 45 int32_t GetHeight() const { return m_SrcHeight; }
95 int32_t GetNumComponents() const override { return m_SrcComponents; } 46 int32_t GetNumComponents() const { return m_SrcComponents; }
96 int32_t GetBPC() const override { return m_SrcBPC; } 47 int32_t GetBPC() const { return m_SrcBPC; }
97 void SetClipBox(FX_RECT* clip) override; 48 void SetClipBox(FX_RECT* clip);
98 49
99 FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause) override; 50 FXCODEC_STATUS GetFrames(int32_t& frames, IFX_Pause* pPause = nullptr);
100 FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap, 51 FXCODEC_STATUS StartDecode(CFX_DIBitmap* pDIBitmap,
101 int start_x, 52 int start_x,
102 int start_y, 53 int start_y,
103 int size_x, 54 int size_x,
104 int size_y, 55 int size_y,
105 int32_t frames, 56 int32_t frames = 0,
106 FX_BOOL bInterpol) override; 57 FX_BOOL bInterpol = TRUE);
107 58
108 FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause) override; 59 FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = nullptr);
60
61 struct PixelWeight {
62 int m_SrcStart;
63 int m_SrcEnd;
64 int m_Weights[1];
65 };
66
67 class CFXCODEC_WeightTable {
68 public:
69 CFXCODEC_WeightTable() { m_pWeightTables = NULL; }
70 ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); }
71
72 void Calc(int dest_len,
73 int dest_min,
74 int dest_max,
75 int src_len,
76 int src_min,
77 int src_max,
78 FX_BOOL bInterpol);
79 PixelWeight* GetPixelWeight(int pixel) {
80 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize);
81 }
82
83 int m_DestMin, m_ItemSize;
84 uint8_t* m_pWeightTables;
85 };
86
87 class CFXCODEC_HorzTable {
88 public:
89 CFXCODEC_HorzTable() { m_pWeightTables = NULL; }
90 ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); }
91
92 void Calc(int dest_len, int src_len, FX_BOOL bInterpol);
93 PixelWeight* GetPixelWeight(int pixel) {
94 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
95 }
96
97 int m_ItemSize;
98 uint8_t* m_pWeightTables;
99 };
100
101 class CFXCODEC_VertTable {
102 public:
103 CFXCODEC_VertTable() { m_pWeightTables = NULL; }
104 ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); }
105 void Calc(int dest_len, int src_len);
106 PixelWeight* GetPixelWeight(int pixel) {
107 return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize);
108 }
109 int m_ItemSize;
110 uint8_t* m_pWeightTables;
111 };
112
113 IFX_FileRead* m_pFile;
114 CCodec_ModuleMgr* m_pCodecMgr;
115 void* m_pJpegContext;
116 void* m_pPngContext;
117 void* m_pGifContext;
118 void* m_pBmpContext;
119 void* m_pTiffContext;
120 FXCODEC_IMAGE_TYPE m_imagType;
121 uint32_t m_offSet;
122 uint8_t* m_pSrcBuf;
123 uint32_t m_SrcSize;
124 uint8_t* m_pDecodeBuf;
125 int m_ScanlineSize;
126 CFX_DIBitmap* m_pDeviceBitmap;
127 FX_BOOL m_bInterpol;
128 CFXCODEC_WeightTable m_WeightHorz;
129 CFXCODEC_VertTable m_WeightVert;
130 CFXCODEC_HorzTable m_WeightHorzOO;
131 int m_SrcWidth;
132 int m_SrcHeight;
133 int m_SrcComponents;
134 int m_SrcBPC;
135 FX_RECT m_clipBox;
136 int m_startX;
137 int m_startY;
138 int m_sizeX;
139 int m_sizeY;
140 int m_TransMethod;
141 FX_ARGB* m_pSrcPalette;
142 int m_SrcPaletteNumber;
143 int m_SrcRow;
144 FXCodec_Format m_SrcFormat;
145 int m_SrcPassNumber;
146 int m_FrameNumber;
147 int m_FrameCur;
148 int m_GifBgIndex;
149 uint8_t* m_pGifPalette;
150 int32_t m_GifPltNumber;
151 int m_GifTransIndex;
152 FX_RECT m_GifFrameRect;
153 FX_BOOL m_BmpIsTopBottom;
154 FXCODEC_STATUS m_status;
109 155
110 protected: 156 protected:
111 static FX_BOOL PngReadHeaderFunc(void* pModule, 157 static FX_BOOL PngReadHeaderFunc(void* pModule,
112 int width, 158 int width,
113 int height, 159 int height,
114 int bpc, 160 int bpc,
115 int pass, 161 int pass,
116 int* color_type, 162 int* color_type,
117 double* gamma); 163 double* gamma);
118 static FX_BOOL PngAskScanlineBufFunc(void* pModule, 164 static FX_BOOL PngAskScanlineBufFunc(void* pModule,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format); 197 void GetTransMethod(FXDIB_Format des_format, FXCodec_Format src_format);
152 void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap, 198 void ReSampleScanline(CFX_DIBitmap* pDeviceBitmap,
153 int32_t des_line, 199 int32_t des_line,
154 uint8_t* src_scan, 200 uint8_t* src_scan,
155 FXCodec_Format src_format); 201 FXCodec_Format src_format);
156 void Resample(CFX_DIBitmap* pDeviceBitmap, 202 void Resample(CFX_DIBitmap* pDeviceBitmap,
157 int32_t src_line, 203 int32_t src_line,
158 uint8_t* src_scan, 204 uint8_t* src_scan,
159 FXCodec_Format src_format); 205 FXCodec_Format src_format);
160 void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); 206 void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
161 FX_BOOL JpegReadMoreData(ICodec_JpegModule* pJpegModule, 207 FX_BOOL JpegReadMoreData(CCodec_JpegModule* pJpegModule,
162 FXCODEC_STATUS& err_status); 208 FXCODEC_STATUS& err_status);
163 void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap, 209 void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap,
164 int32_t des_line, 210 int32_t des_line,
165 uint8_t* src_scan, 211 uint8_t* src_scan,
166 FXCodec_Format src_format); 212 FXCodec_Format src_format);
167 FX_BOOL GifReadMoreData(ICodec_GifModule* pGifModule, 213 FX_BOOL GifReadMoreData(CCodec_GifModule* pGifModule,
168 FXCODEC_STATUS& err_status); 214 FXCODEC_STATUS& err_status);
169 void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap, 215 void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap,
170 double scale_y, 216 double scale_y,
171 int des_row); 217 int des_row);
172 FX_BOOL BmpReadMoreData(ICodec_BmpModule* pBmpModule, 218 FX_BOOL BmpReadMoreData(CCodec_BmpModule* pBmpModule,
173 FXCODEC_STATUS& err_status); 219 FXCODEC_STATUS& err_status);
174 void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row); 220 void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
175
176 public:
177 IFX_FileRead* m_pFile;
178 CCodec_ModuleMgr* m_pCodecMgr;
179 void* m_pJpegContext;
180 void* m_pPngContext;
181 void* m_pGifContext;
182 void* m_pBmpContext;
183 void* m_pTiffContext;
184 FXCODEC_IMAGE_TYPE m_imagType;
185 uint32_t m_offSet;
186 uint8_t* m_pSrcBuf;
187 uint32_t m_SrcSize;
188 uint8_t* m_pDecodeBuf;
189 int m_ScanlineSize;
190 CFX_DIBitmap* m_pDeviceBitmap;
191 FX_BOOL m_bInterpol;
192 CFXCODEC_WeightTable m_WeightHorz;
193 CFXCODEC_VertTable m_WeightVert;
194 CFXCODEC_HorzTable m_WeightHorzOO;
195 int m_SrcWidth;
196 int m_SrcHeight;
197 int m_SrcComponents;
198 int m_SrcBPC;
199 FX_RECT m_clipBox;
200 int m_startX;
201 int m_startY;
202 int m_sizeX;
203 int m_sizeY;
204 int m_TransMethod;
205 FX_ARGB* m_pSrcPalette;
206 int m_SrcPaletteNumber;
207 int m_SrcRow;
208 FXCodec_Format m_SrcFormat;
209 int m_SrcPassNumber;
210 int m_FrameNumber;
211 int m_FrameCur;
212 int m_GifBgIndex;
213 uint8_t* m_pGifPalette;
214 int32_t m_GifPltNumber;
215 int m_GifTransIndex;
216 FX_RECT m_GifFrameRect;
217 FX_BOOL m_BmpIsTopBottom;
218 FXCODEC_STATUS m_status;
219 }; 221 };
220 222
221 #endif // CORE_FXCODEC_CODEC_FX_CODEC_PROGRESS_H_ 223 #endif // CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698