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

Side by Side Diff: core/fxcodec/codec/codec_int.h

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (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
« no previous file with comments | « core/fpdftext/fpdf_text_int.cpp ('k') | core/fxcodec/codec/fx_codec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_CODEC_INT_H_ 7 #ifndef CORE_FXCODEC_CODEC_CODEC_INT_H_
8 #define CORE_FXCODEC_CODEC_CODEC_INT_H_ 8 #define CORE_FXCODEC_CODEC_CODEC_INT_H_
9 9
10 #include <limits.h> 10 #include <limits.h>
11 11
12 #include <list> 12 #include <list>
13 #include <map> 13 #include <map>
14 #include <memory> 14 #include <memory>
15 #include <vector> 15 #include <vector>
16 16
17 #include "core/fxcodec/jbig2/JBig2_Context.h" 17 #include "core/fxcodec/jbig2/JBig2_Context.h"
18 #include "core/include/fxcodec/fx_codec.h" 18 #include "core/include/fxcodec/fx_codec.h"
19 #include "third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. 19 #include "third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T.
20 20
21 class CFX_IccProfileCache; 21 class CFX_IccProfileCache;
22 class CFX_IccTransformCache; 22 class CFX_IccTransformCache;
23 class CPDF_ColorSpace; 23 class CPDF_ColorSpace;
24 24
25 class CCodec_BasicModule : public ICodec_BasicModule { 25 class CCodec_BasicModule : public ICodec_BasicModule {
26 public: 26 public:
27 // ICodec_BasicModule: 27 // ICodec_BasicModule:
28 FX_BOOL RunLengthEncode(const uint8_t* src_buf, 28 FX_BOOL RunLengthEncode(const uint8_t* src_buf,
29 FX_DWORD src_size, 29 uint32_t src_size,
30 uint8_t*& dest_buf, 30 uint8_t*& dest_buf,
31 FX_DWORD& dest_size) override; 31 uint32_t& dest_size) override;
32 FX_BOOL A85Encode(const uint8_t* src_buf, 32 FX_BOOL A85Encode(const uint8_t* src_buf,
33 FX_DWORD src_size, 33 uint32_t src_size,
34 uint8_t*& dest_buf, 34 uint8_t*& dest_buf,
35 FX_DWORD& dest_size) override; 35 uint32_t& dest_size) override;
36 ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, 36 ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf,
37 FX_DWORD src_size, 37 uint32_t src_size,
38 int width, 38 int width,
39 int height, 39 int height,
40 int nComps, 40 int nComps,
41 int bpc) override; 41 int bpc) override;
42 }; 42 };
43 43
44 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder { 44 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder {
45 public: 45 public:
46 CCodec_ScanlineDecoder(); 46 CCodec_ScanlineDecoder();
47 ~CCodec_ScanlineDecoder() override; 47 ~CCodec_ScanlineDecoder() override;
48 48
49 // ICodec_ScanlineDecoder 49 // ICodec_ScanlineDecoder
50 void DownScale(int dest_width, int dest_height) override; 50 void DownScale(int dest_width, int dest_height) override;
51 const uint8_t* GetScanline(int line) override; 51 const uint8_t* GetScanline(int line) override;
52 FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) override; 52 FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) override;
53 int GetWidth() override { return m_OutputWidth; } 53 int GetWidth() override { return m_OutputWidth; }
54 int GetHeight() override { return m_OutputHeight; } 54 int GetHeight() override { return m_OutputHeight; }
55 int CountComps() override { return m_nComps; } 55 int CountComps() override { return m_nComps; }
56 int GetBPC() override { return m_bpc; } 56 int GetBPC() override { return m_bpc; }
57 FX_BOOL IsColorTransformed() override { return m_bColorTransformed; } 57 FX_BOOL IsColorTransformed() override { return m_bColorTransformed; }
58 void ClearImageData() override { m_pDataCache.reset(); } 58 void ClearImageData() override { m_pDataCache.reset(); }
59 59
60 protected: 60 protected:
61 class ImageDataCache { 61 class ImageDataCache {
62 public: 62 public:
63 ImageDataCache(int width, int height, FX_DWORD pitch); 63 ImageDataCache(int width, int height, uint32_t pitch);
64 ~ImageDataCache(); 64 ~ImageDataCache();
65 65
66 bool AllocateCache(); 66 bool AllocateCache();
67 void AppendLine(const uint8_t* line); 67 void AppendLine(const uint8_t* line);
68 68
69 int NumLines() const { return m_nCachedLines; } 69 int NumLines() const { return m_nCachedLines; }
70 const uint8_t* GetLine(int line) const; 70 const uint8_t* GetLine(int line) const;
71 bool IsSameDimensions(int width, int height) const { 71 bool IsSameDimensions(int width, int height) const {
72 return width == m_Width && height == m_Height; 72 return width == m_Width && height == m_Height;
73 } 73 }
74 74
75 private: 75 private:
76 bool IsValid() const { return m_Data.get() != nullptr; } 76 bool IsValid() const { return m_Data.get() != nullptr; }
77 77
78 const int m_Width; 78 const int m_Width;
79 const int m_Height; 79 const int m_Height;
80 const FX_DWORD m_Pitch; 80 const uint32_t m_Pitch;
81 int m_nCachedLines; 81 int m_nCachedLines;
82 std::unique_ptr<uint8_t, FxFreeDeleter> m_Data; 82 std::unique_ptr<uint8_t, FxFreeDeleter> m_Data;
83 }; 83 };
84 84
85 virtual FX_BOOL v_Rewind() = 0; 85 virtual FX_BOOL v_Rewind() = 0;
86 virtual uint8_t* v_GetNextLine() = 0; 86 virtual uint8_t* v_GetNextLine() = 0;
87 virtual void v_DownScale(int dest_width, int dest_height) = 0; 87 virtual void v_DownScale(int dest_width, int dest_height) = 0;
88 88
89 uint8_t* ReadNextLine(); 89 uint8_t* ReadNextLine();
90 90
91 int m_OrigWidth; 91 int m_OrigWidth;
92 int m_OrigHeight; 92 int m_OrigHeight;
93 int m_DownScale; 93 int m_DownScale;
94 int m_OutputWidth; 94 int m_OutputWidth;
95 int m_OutputHeight; 95 int m_OutputHeight;
96 int m_nComps; 96 int m_nComps;
97 int m_bpc; 97 int m_bpc;
98 FX_DWORD m_Pitch; 98 uint32_t m_Pitch;
99 FX_BOOL m_bColorTransformed; 99 FX_BOOL m_bColorTransformed;
100 int m_NextLine; 100 int m_NextLine;
101 uint8_t* m_pLastScanline; 101 uint8_t* m_pLastScanline;
102 std::unique_ptr<ImageDataCache> m_pDataCache; 102 std::unique_ptr<ImageDataCache> m_pDataCache;
103 }; 103 };
104 104
105 class CCodec_FaxModule : public ICodec_FaxModule { 105 class CCodec_FaxModule : public ICodec_FaxModule {
106 public: 106 public:
107 // ICodec_FaxModule: 107 // ICodec_FaxModule:
108 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, 108 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
109 FX_DWORD src_size, 109 uint32_t src_size,
110 int width, 110 int width,
111 int height, 111 int height,
112 int K, 112 int K,
113 FX_BOOL EndOfLine, 113 FX_BOOL EndOfLine,
114 FX_BOOL EncodedByteAlign, 114 FX_BOOL EncodedByteAlign,
115 FX_BOOL BlackIs1, 115 FX_BOOL BlackIs1,
116 int Columns, 116 int Columns,
117 int Rows) override; 117 int Rows) override;
118 FX_BOOL Encode(const uint8_t* src_buf, 118 FX_BOOL Encode(const uint8_t* src_buf,
119 int width, 119 int width,
120 int height, 120 int height,
121 int pitch, 121 int pitch,
122 uint8_t*& dest_buf, 122 uint8_t*& dest_buf,
123 FX_DWORD& dest_size) override; 123 uint32_t& dest_size) override;
124 }; 124 };
125 125
126 class CCodec_FlateModule : public ICodec_FlateModule { 126 class CCodec_FlateModule : public ICodec_FlateModule {
127 public: 127 public:
128 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, 128 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
129 FX_DWORD src_size, 129 uint32_t src_size,
130 int width, 130 int width,
131 int height, 131 int height,
132 int nComps, 132 int nComps,
133 int bpc, 133 int bpc,
134 int predictor, 134 int predictor,
135 int Colors, 135 int Colors,
136 int BitsPerComponent, 136 int BitsPerComponent,
137 int Columns); 137 int Columns);
138 virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, 138 virtual uint32_t FlateOrLZWDecode(FX_BOOL bLZW,
139 const uint8_t* src_buf, 139 const uint8_t* src_buf,
140 FX_DWORD src_size, 140 uint32_t src_size,
141 FX_BOOL bEarlyChange, 141 FX_BOOL bEarlyChange,
142 int predictor, 142 int predictor,
143 int Colors, 143 int Colors,
144 int BitsPerComponent, 144 int BitsPerComponent,
145 int Columns, 145 int Columns,
146 FX_DWORD estimated_size, 146 uint32_t estimated_size,
147 uint8_t*& dest_buf, 147 uint8_t*& dest_buf,
148 FX_DWORD& dest_size); 148 uint32_t& dest_size);
149 virtual FX_BOOL Encode(const uint8_t* src_buf, 149 virtual FX_BOOL Encode(const uint8_t* src_buf,
150 FX_DWORD src_size, 150 uint32_t src_size,
151 int predictor, 151 int predictor,
152 int Colors, 152 int Colors,
153 int BitsPerComponent, 153 int BitsPerComponent,
154 int Columns, 154 int Columns,
155 uint8_t*& dest_buf, 155 uint8_t*& dest_buf,
156 FX_DWORD& dest_size); 156 uint32_t& dest_size);
157 virtual FX_BOOL Encode(const uint8_t* src_buf, 157 virtual FX_BOOL Encode(const uint8_t* src_buf,
158 FX_DWORD src_size, 158 uint32_t src_size,
159 uint8_t*& dest_buf, 159 uint8_t*& dest_buf,
160 FX_DWORD& dest_size); 160 uint32_t& dest_size);
161 }; 161 };
162 162
163 class CCodec_JpegModule : public ICodec_JpegModule { 163 class CCodec_JpegModule : public ICodec_JpegModule {
164 public: 164 public:
165 CCodec_JpegModule() {} 165 CCodec_JpegModule() {}
166 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, 166 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf,
167 FX_DWORD src_size, 167 uint32_t src_size,
168 int width, 168 int width,
169 int height, 169 int height,
170 int nComps, 170 int nComps,
171 FX_BOOL ColorTransform) override; 171 FX_BOOL ColorTransform) override;
172 FX_BOOL LoadInfo(const uint8_t* src_buf, 172 FX_BOOL LoadInfo(const uint8_t* src_buf,
173 FX_DWORD src_size, 173 uint32_t src_size,
174 int& width, 174 int& width,
175 int& height, 175 int& height,
176 int& num_components, 176 int& num_components,
177 int& bits_per_components, 177 int& bits_per_components,
178 FX_BOOL& color_transform, 178 FX_BOOL& color_transform,
179 uint8_t** icc_buf_ptr, 179 uint8_t** icc_buf_ptr,
180 FX_DWORD* icc_length) override; 180 uint32_t* icc_length) override;
181 FX_BOOL Encode(const CFX_DIBSource* pSource, 181 FX_BOOL Encode(const CFX_DIBSource* pSource,
182 uint8_t*& dest_buf, 182 uint8_t*& dest_buf,
183 FX_STRSIZE& dest_size, 183 FX_STRSIZE& dest_size,
184 int quality, 184 int quality,
185 const uint8_t* icc_buf, 185 const uint8_t* icc_buf,
186 FX_DWORD icc_length) override; 186 uint32_t icc_length) override;
187 void* Start() override; 187 void* Start() override;
188 void Finish(void* pContext) override; 188 void Finish(void* pContext) override;
189 void Input(void* pContext, 189 void Input(void* pContext,
190 const uint8_t* src_buf, 190 const uint8_t* src_buf,
191 FX_DWORD src_size) override; 191 uint32_t src_size) override;
192 #ifndef PDF_ENABLE_XFA 192 #ifndef PDF_ENABLE_XFA
193 int ReadHeader(void* pContext, int* width, int* height, int* nComps) override; 193 int ReadHeader(void* pContext, int* width, int* height, int* nComps) override;
194 #else // PDF_ENABLE_XFA 194 #else // PDF_ENABLE_XFA
195 int ReadHeader(void* pContext, 195 int ReadHeader(void* pContext,
196 int* width, 196 int* width,
197 int* height, 197 int* height,
198 int* nComps, 198 int* nComps,
199 CFX_DIBAttribute* pAttribute) override; 199 CFX_DIBAttribute* pAttribute) override;
200 #endif // PDF_ENABLE_XFA 200 #endif // PDF_ENABLE_XFA
201 int StartScanline(void* pContext, int down_scale) override; 201 int StartScanline(void* pContext, int down_scale) override;
202 FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override; 202 FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override;
203 FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; 203 uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override;
204 }; 204 };
205 205
206 #ifdef PDF_ENABLE_XFA 206 #ifdef PDF_ENABLE_XFA
207 #define PNG_ERROR_SIZE 256 207 #define PNG_ERROR_SIZE 256
208 class CCodec_PngModule : public ICodec_PngModule { 208 class CCodec_PngModule : public ICodec_PngModule {
209 public: 209 public:
210 CCodec_PngModule() { FXSYS_memset(m_szLastError, '\0', PNG_ERROR_SIZE); } 210 CCodec_PngModule() { FXSYS_memset(m_szLastError, '\0', PNG_ERROR_SIZE); }
211 211
212 virtual void* Start(void* pModule); 212 virtual void* Start(void* pModule);
213 virtual void Finish(void* pContext); 213 virtual void Finish(void* pContext);
214 virtual FX_BOOL Input(void* pContext, 214 virtual FX_BOOL Input(void* pContext,
215 const uint8_t* src_buf, 215 const uint8_t* src_buf,
216 FX_DWORD src_size, 216 uint32_t src_size,
217 CFX_DIBAttribute* pAttribute); 217 CFX_DIBAttribute* pAttribute);
218 218
219 protected: 219 protected:
220 FX_CHAR m_szLastError[PNG_ERROR_SIZE]; 220 FX_CHAR m_szLastError[PNG_ERROR_SIZE];
221 }; 221 };
222 class CCodec_GifModule : public ICodec_GifModule { 222 class CCodec_GifModule : public ICodec_GifModule {
223 public: 223 public:
224 CCodec_GifModule() { FXSYS_memset(m_szLastError, '\0', 256); } 224 CCodec_GifModule() { FXSYS_memset(m_szLastError, '\0', 256); }
225 virtual void* Start(void* pModule); 225 virtual void* Start(void* pModule);
226 virtual void Finish(void* pContext); 226 virtual void Finish(void* pContext);
227 virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); 227 virtual uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr);
228 virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); 228 virtual void Input(void* pContext, const uint8_t* src_buf, uint32_t src_size);
229 229
230 virtual int32_t ReadHeader(void* pContext, 230 virtual int32_t ReadHeader(void* pContext,
231 int* width, 231 int* width,
232 int* height, 232 int* height,
233 int* pal_num, 233 int* pal_num,
234 void** pal_pp, 234 void** pal_pp,
235 int* bg_index, 235 int* bg_index,
236 CFX_DIBAttribute* pAttribute); 236 CFX_DIBAttribute* pAttribute);
237 237
238 virtual int32_t LoadFrameInfo(void* pContext, int* frame_num); 238 virtual int32_t LoadFrameInfo(void* pContext, int* frame_num);
239 239
240 virtual int32_t LoadFrame(void* pContext, 240 virtual int32_t LoadFrame(void* pContext,
241 int frame_num, 241 int frame_num,
242 CFX_DIBAttribute* pAttribute); 242 CFX_DIBAttribute* pAttribute);
243 243
244 protected: 244 protected:
245 FX_CHAR m_szLastError[256]; 245 FX_CHAR m_szLastError[256];
246 }; 246 };
247 class CCodec_BmpModule : public ICodec_BmpModule { 247 class CCodec_BmpModule : public ICodec_BmpModule {
248 public: 248 public:
249 CCodec_BmpModule() { FXSYS_memset(m_szLastError, 0, sizeof(m_szLastError)); } 249 CCodec_BmpModule() { FXSYS_memset(m_szLastError, 0, sizeof(m_szLastError)); }
250 void* Start(void* pModule) override; 250 void* Start(void* pModule) override;
251 void Finish(void* pContext) override; 251 void Finish(void* pContext) override;
252 FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override; 252 uint32_t GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override;
253 void Input(void* pContext, 253 void Input(void* pContext,
254 const uint8_t* src_buf, 254 const uint8_t* src_buf,
255 FX_DWORD src_size) override; 255 uint32_t src_size) override;
256 int32_t ReadHeader(void* pContext, 256 int32_t ReadHeader(void* pContext,
257 int32_t* width, 257 int32_t* width,
258 int32_t* height, 258 int32_t* height,
259 FX_BOOL* tb_flag, 259 FX_BOOL* tb_flag,
260 int32_t* components, 260 int32_t* components,
261 int32_t* pal_num, 261 int32_t* pal_num,
262 FX_DWORD** pal_pp, 262 uint32_t** pal_pp,
263 CFX_DIBAttribute* pAttribute) override; 263 CFX_DIBAttribute* pAttribute) override;
264 int32_t LoadImage(void* pContext) override; 264 int32_t LoadImage(void* pContext) override;
265 265
266 protected: 266 protected:
267 FX_CHAR m_szLastError[256]; 267 FX_CHAR m_szLastError[256];
268 }; 268 };
269 #endif // PDF_ENABLE_XFA 269 #endif // PDF_ENABLE_XFA
270 270
271 class CCodec_IccModule : public ICodec_IccModule { 271 class CCodec_IccModule : public ICodec_IccModule {
272 public: 272 public:
273 ~CCodec_IccModule() override; 273 ~CCodec_IccModule() override;
274 274
275 // ICodec_IccModule: 275 // ICodec_IccModule:
276 IccCS GetProfileCS(const uint8_t* pProfileData, 276 IccCS GetProfileCS(const uint8_t* pProfileData,
277 unsigned int dwProfileSize) override; 277 unsigned int dwProfileSize) override;
278 IccCS GetProfileCS(IFX_FileRead* pFile) override; 278 IccCS GetProfileCS(IFX_FileRead* pFile) override;
279 void* CreateTransform(ICodec_IccModule::IccParam* pInputParam, 279 void* CreateTransform(ICodec_IccModule::IccParam* pInputParam,
280 ICodec_IccModule::IccParam* pOutputParam, 280 ICodec_IccModule::IccParam* pOutputParam,
281 ICodec_IccModule::IccParam* pProofParam = NULL, 281 ICodec_IccModule::IccParam* pProofParam = NULL,
282 FX_DWORD dwIntent = Icc_INTENT_PERCEPTUAL, 282 uint32_t dwIntent = Icc_INTENT_PERCEPTUAL,
283 FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, 283 uint32_t dwFlag = Icc_FLAGS_DEFAULT,
284 FX_DWORD dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC, 284 uint32_t dwPrfIntent = Icc_INTENT_ABSOLUTE_COLORIMETRIC,
285 FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override; 285 uint32_t dwPrfFlag = Icc_FLAGS_SOFTPROOFING) override;
286 void* CreateTransform_sRGB( 286 void* CreateTransform_sRGB(
287 const uint8_t* pProfileData, 287 const uint8_t* pProfileData,
288 FX_DWORD dwProfileSize, 288 uint32_t dwProfileSize,
289 FX_DWORD& nComponents, 289 uint32_t& nComponents,
290 int32_t intent = 0, 290 int32_t intent = 0,
291 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT) override; 291 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT) override;
292 void* CreateTransform_CMYK( 292 void* CreateTransform_CMYK(
293 const uint8_t* pSrcProfileData, 293 const uint8_t* pSrcProfileData,
294 FX_DWORD dwSrcProfileSize, 294 uint32_t dwSrcProfileSize,
295 FX_DWORD& nSrcComponents, 295 uint32_t& nSrcComponents,
296 const uint8_t* pDstProfileData, 296 const uint8_t* pDstProfileData,
297 FX_DWORD dwDstProfileSize, 297 uint32_t dwDstProfileSize,
298 int32_t intent = 0, 298 int32_t intent = 0,
299 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, 299 uint32_t dwSrcFormat = Icc_FORMAT_DEFAULT,
300 FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT) override; 300 uint32_t dwDstFormat = Icc_FORMAT_DEFAULT) override;
301 void DestroyTransform(void* pTransform) override; 301 void DestroyTransform(void* pTransform) override;
302 void Translate(void* pTransform, 302 void Translate(void* pTransform,
303 FX_FLOAT* pSrcValues, 303 FX_FLOAT* pSrcValues,
304 FX_FLOAT* pDestValues) override; 304 FX_FLOAT* pDestValues) override;
305 void TranslateScanline(void* pTransform, 305 void TranslateScanline(void* pTransform,
306 uint8_t* pDest, 306 uint8_t* pDest,
307 const uint8_t* pSrc, 307 const uint8_t* pSrc,
308 int pixels) override; 308 int pixels) override;
309 void SetComponents(FX_DWORD nComponents) override { 309 void SetComponents(uint32_t nComponents) override {
310 m_nComponents = nComponents; 310 m_nComponents = nComponents;
311 } 311 }
312 312
313 protected: 313 protected:
314 enum Icc_CLASS { 314 enum Icc_CLASS {
315 Icc_CLASS_INPUT = 0, 315 Icc_CLASS_INPUT = 0,
316 Icc_CLASS_OUTPUT, 316 Icc_CLASS_OUTPUT,
317 Icc_CLASS_PROOF, 317 Icc_CLASS_PROOF,
318 Icc_CLASS_MAX 318 Icc_CLASS_MAX
319 }; 319 };
320 void* CreateProfile(ICodec_IccModule::IccParam* pIccParam, 320 void* CreateProfile(ICodec_IccModule::IccParam* pIccParam,
321 Icc_CLASS ic, 321 Icc_CLASS ic,
322 CFX_BinaryBuf* pTransformKey); 322 CFX_BinaryBuf* pTransformKey);
323 323
324 FX_DWORD m_nComponents; 324 uint32_t m_nComponents;
325 std::map<CFX_ByteString, CFX_IccTransformCache*> m_MapTranform; 325 std::map<CFX_ByteString, CFX_IccTransformCache*> m_MapTranform;
326 std::map<CFX_ByteString, CFX_IccProfileCache*> m_MapProfile; 326 std::map<CFX_ByteString, CFX_IccProfileCache*> m_MapProfile;
327 }; 327 };
328 328
329 class CCodec_JpxModule : public ICodec_JpxModule { 329 class CCodec_JpxModule : public ICodec_JpxModule {
330 public: 330 public:
331 CCodec_JpxModule(); 331 CCodec_JpxModule();
332 ~CCodec_JpxModule() override; 332 ~CCodec_JpxModule() override;
333 333
334 // ICodec_JpxModule: 334 // ICodec_JpxModule:
335 CJPX_Decoder* CreateDecoder(const uint8_t* src_buf, 335 CJPX_Decoder* CreateDecoder(const uint8_t* src_buf,
336 FX_DWORD src_size, 336 uint32_t src_size,
337 CPDF_ColorSpace* cs) override; 337 CPDF_ColorSpace* cs) override;
338 void GetImageInfo(CJPX_Decoder* pDecoder, 338 void GetImageInfo(CJPX_Decoder* pDecoder,
339 FX_DWORD* width, 339 uint32_t* width,
340 FX_DWORD* height, 340 uint32_t* height,
341 FX_DWORD* components) override; 341 uint32_t* components) override;
342 bool Decode(CJPX_Decoder* pDecoder, 342 bool Decode(CJPX_Decoder* pDecoder,
343 uint8_t* dest_data, 343 uint8_t* dest_data,
344 int pitch, 344 int pitch,
345 const std::vector<uint8_t>& offsets) override; 345 const std::vector<uint8_t>& offsets) override;
346 void DestroyDecoder(CJPX_Decoder* pDecoder) override; 346 void DestroyDecoder(CJPX_Decoder* pDecoder) override;
347 }; 347 };
348 348
349 #ifdef PDF_ENABLE_XFA 349 #ifdef PDF_ENABLE_XFA
350 class CCodec_TiffModule : public ICodec_TiffModule { 350 class CCodec_TiffModule : public ICodec_TiffModule {
351 public: 351 public:
352 // ICodec_TiffModule 352 // ICodec_TiffModule
353 void* CreateDecoder(IFX_FileRead* file_ptr) override; 353 void* CreateDecoder(IFX_FileRead* file_ptr) override;
354 void GetFrames(void* ctx, int32_t& frames) override; 354 void GetFrames(void* ctx, int32_t& frames) override;
355 FX_BOOL LoadFrameInfo(void* ctx, 355 FX_BOOL LoadFrameInfo(void* ctx,
356 int32_t frame, 356 int32_t frame,
357 FX_DWORD& width, 357 uint32_t& width,
358 FX_DWORD& height, 358 uint32_t& height,
359 FX_DWORD& comps, 359 uint32_t& comps,
360 FX_DWORD& bpc, 360 uint32_t& bpc,
361 CFX_DIBAttribute* pAttribute) override; 361 CFX_DIBAttribute* pAttribute) override;
362 FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) override; 362 FX_BOOL Decode(void* ctx, class CFX_DIBitmap* pDIBitmap) override;
363 void DestroyDecoder(void* ctx) override; 363 void DestroyDecoder(void* ctx) override;
364 364
365 protected: 365 protected:
366 ~CCodec_TiffModule() override {} 366 ~CCodec_TiffModule() override {}
367 }; 367 };
368 #endif // PDF_ENABLE_XFA 368 #endif // PDF_ENABLE_XFA
369 369
370 class CCodec_Jbig2Context { 370 class CCodec_Jbig2Context {
371 public: 371 public:
372 CCodec_Jbig2Context(); 372 CCodec_Jbig2Context();
373 ~CCodec_Jbig2Context() {} 373 ~CCodec_Jbig2Context() {}
374 374
375 FX_DWORD m_width; 375 uint32_t m_width;
376 FX_DWORD m_height; 376 uint32_t m_height;
377 CPDF_StreamAcc* m_pGlobalStream; 377 CPDF_StreamAcc* m_pGlobalStream;
378 CPDF_StreamAcc* m_pSrcStream; 378 CPDF_StreamAcc* m_pSrcStream;
379 uint8_t* m_dest_buf; 379 uint8_t* m_dest_buf;
380 FX_DWORD m_dest_pitch; 380 uint32_t m_dest_pitch;
381 IFX_Pause* m_pPause; 381 IFX_Pause* m_pPause;
382 CJBig2_Context* m_pContext; 382 CJBig2_Context* m_pContext;
383 CJBig2_Image* m_dest_image; 383 CJBig2_Image* m_dest_image;
384 }; 384 };
385 class CCodec_Jbig2Module : public ICodec_Jbig2Module { 385 class CCodec_Jbig2Module : public ICodec_Jbig2Module {
386 public: 386 public:
387 CCodec_Jbig2Module() {} 387 CCodec_Jbig2Module() {}
388 ~CCodec_Jbig2Module() override; 388 ~CCodec_Jbig2Module() override;
389 389
390 // ICodec_Jbig2Module 390 // ICodec_Jbig2Module
391 void* CreateJbig2Context() override; 391 void* CreateJbig2Context() override;
392 FXCODEC_STATUS StartDecode(void* pJbig2Context, 392 FXCODEC_STATUS StartDecode(void* pJbig2Context,
393 CFX_PrivateData* pPrivateData, 393 CFX_PrivateData* pPrivateData,
394 FX_DWORD width, 394 uint32_t width,
395 FX_DWORD height, 395 uint32_t height,
396 CPDF_StreamAcc* src_stream, 396 CPDF_StreamAcc* src_stream,
397 CPDF_StreamAcc* global_stream, 397 CPDF_StreamAcc* global_stream,
398 uint8_t* dest_buf, 398 uint8_t* dest_buf,
399 FX_DWORD dest_pitch, 399 uint32_t dest_pitch,
400 IFX_Pause* pPause) override; 400 IFX_Pause* pPause) override;
401 FXCODEC_STATUS ContinueDecode(void* pJbig2Context, 401 FXCODEC_STATUS ContinueDecode(void* pJbig2Context,
402 IFX_Pause* pPause) override; 402 IFX_Pause* pPause) override;
403 void DestroyJbig2Context(void* pJbig2Context) override; 403 void DestroyJbig2Context(void* pJbig2Context) override;
404 }; 404 };
405 405
406 struct DecodeData { 406 struct DecodeData {
407 public: 407 public:
408 DecodeData(unsigned char* src_data, OPJ_SIZE_T src_size) 408 DecodeData(unsigned char* src_data, OPJ_SIZE_T src_size)
409 : src_data(src_data), src_size(src_size), offset(0) {} 409 : src_data(src_data), src_size(src_size), offset(0) {}
410 unsigned char* src_data; 410 unsigned char* src_data;
411 OPJ_SIZE_T src_size; 411 OPJ_SIZE_T src_size;
412 OPJ_SIZE_T offset; 412 OPJ_SIZE_T offset;
413 }; 413 };
414 414
415 void sycc420_to_rgb(opj_image_t* img); 415 void sycc420_to_rgb(opj_image_t* img);
416 416
417 /* Wrappers for C-style callbacks. */ 417 /* Wrappers for C-style callbacks. */
418 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, 418 OPJ_SIZE_T opj_read_from_memory(void* p_buffer,
419 OPJ_SIZE_T nb_bytes, 419 OPJ_SIZE_T nb_bytes,
420 void* p_user_data); 420 void* p_user_data);
421 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, 421 OPJ_SIZE_T opj_write_from_memory(void* p_buffer,
422 OPJ_SIZE_T nb_bytes, 422 OPJ_SIZE_T nb_bytes,
423 void* p_user_data); 423 void* p_user_data);
424 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); 424 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
425 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); 425 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data);
426 426
427 #endif // CORE_FXCODEC_CODEC_CODEC_INT_H_ 427 #endif // CORE_FXCODEC_CODEC_CODEC_INT_H_
OLDNEW
« no previous file with comments | « core/fpdftext/fpdf_text_int.cpp ('k') | core/fxcodec/codec/fx_codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698