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

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

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 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/fpdftext/text_int.h ('k') | core/src/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_SRC_FXCODEC_CODEC_CODEC_INT_H_ 7 #ifndef CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_
8 #define CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ 8 #define CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_
9 9
10 #include <limits.h> 10 #include <limits.h>
11 #include <list> 11 #include <list>
12 12
13 #include "../../../include/fxcodec/fx_codec.h" 13 #include "../../../include/fxcodec/fx_codec.h"
14 #include "../jbig2/JBig2_Context.h" 14 #include "../jbig2/JBig2_Context.h"
15 #include "../fx_libopenjpeg/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. 15 #include "../fx_libopenjpeg/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T.
16 16
17 class CCodec_BasicModule : public ICodec_BasicModule 17 class CCodec_BasicModule : public ICodec_BasicModule
18 { 18 {
19 public: 19 public:
20 virtual FX_BOOL» RunLengthEncode(const FX_BYTE* src_buf, FX_DWORD src_siz e, FX_LPBYTE& dest_buf, 20 virtual FX_BOOL» RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_siz e, FX_LPBYTE& dest_buf,
21 FX_DWORD& dest_size); 21 FX_DWORD& dest_size);
22 virtual FX_BOOL» A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_ LPBYTE& dest_buf, 22 virtual FX_BOOL» A85Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_ LPBYTE& dest_buf,
23 FX_DWORD& dest_size); 23 FX_DWORD& dest_size);
24 virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_bu f, FX_DWORD src_size, int width, int height, 24 virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(FX_LPCBYTE src_bu f, FX_DWORD src_size, int width, int height,
25 int nComps, int bpc); 25 int nComps, int bpc);
26 }; 26 };
27 struct CCodec_ImageDataCache { 27 struct CCodec_ImageDataCache {
28 int m_Width, m_Height; 28 int m_Width, m_Height;
29 int m_nCachedLines; 29 int m_nCachedLines;
30 FX_BYTE» » m_Data; 30 uint8_t» » m_Data;
31 }; 31 };
32 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder 32 class CCodec_ScanlineDecoder : public ICodec_ScanlineDecoder
33 { 33 {
34 public: 34 public:
35 35
36 CCodec_ScanlineDecoder(); 36 CCodec_ScanlineDecoder();
37 37
38 virtual ~CCodec_ScanlineDecoder(); 38 virtual ~CCodec_ScanlineDecoder();
39 39
40 virtual FX_DWORD GetSrcOffset() 40 virtual FX_DWORD GetSrcOffset()
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 public: 119 public:
120 virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWO RD src_size, int width, int height, 120 virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWO RD src_size, int width, int height,
121 int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1 , int Columns, int Rows); 121 int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1 , int Columns, int Rows);
122 FX_BOOL Encode(FX_LPCBYTE src_buf, int width, int height, int pi tch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size); 122 FX_BOOL Encode(FX_LPCBYTE src_buf, int width, int height, int pi tch, FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
123 }; 123 };
124 class CCodec_FlateModule : public ICodec_FlateModule 124 class CCodec_FlateModule : public ICodec_FlateModule
125 { 125 {
126 public: 126 public:
127 virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWO RD src_size, int width, int height, 127 virtual ICodec_ScanlineDecoder* CreateDecoder(FX_LPCBYTE src_buf, FX_DWO RD src_size, int width, int height,
128 int nComps, int bpc, int predictor, int Colors, int BitsPerComponent , int Columns); 128 int nComps, int bpc, int predictor, int Colors, int BitsPerComponent , int Columns);
129 virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const FX_BYTE* src_buf, FX_D WORD src_size, FX_BOOL bEarlyChange, 129 virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_D WORD src_size, FX_BOOL bEarlyChange,
130 int predictor, int Colors, int BitsPerComp onent, int Columns, 130 int predictor, int Colors, int BitsPerComp onent, int Columns,
131 FX_DWORD estimated_size, FX_LPBYTE& dest_b uf, FX_DWORD& dest_size); 131 FX_DWORD estimated_size, FX_LPBYTE& dest_b uf, FX_DWORD& dest_size);
132 virtual FX_BOOL Encode(const FX_BYTE* src_buf, FX_DWORD src_size, 132 virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size,
133 int predictor, int Colors, int BitsPerComponent, int Columns, 133 int predictor, int Colors, int BitsPerComponent, int Columns,
134 FX_LPBYTE& dest_buf, FX_DWORD& dest_size); 134 FX_LPBYTE& dest_buf, FX_DWORD& dest_size);
135 virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX _LPBYTE& dest_buf, FX_DWORD& dest_size); 135 virtual FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_size, FX _LPBYTE& dest_buf, FX_DWORD& dest_size);
136 }; 136 };
137 class CCodec_JpegModule : public ICodec_JpegModule 137 class CCodec_JpegModule : public ICodec_JpegModule
138 { 138 {
139 public: 139 public:
140 CCodec_JpegModule() : m_pExtProvider(NULL) {} 140 CCodec_JpegModule() : m_pExtProvider(NULL) {}
141 void SetPovider(IFX_JpegProvider* pJP) 141 void SetPovider(IFX_JpegProvider* pJP)
142 { 142 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 public: 178 public:
179 CCodec_GifModule() 179 CCodec_GifModule()
180 { 180 {
181 FXSYS_memset8(m_szLastError, '\0', 256); 181 FXSYS_memset8(m_szLastError, '\0', 256);
182 } 182 }
183 virtual void* Start(void* pModule); 183 virtual void* Start(void* pModule);
184 virtual void Finish(void* pContext); 184 virtual void Finish(void* pContext);
185 virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); 185 virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr);
186 virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWO RD src_size); 186 virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWO RD src_size);
187 187
188 virtual FX_INT32» ReadHeader(void* pContext, int* width, int* height, 188 virtual int32_t» ReadHeader(void* pContext, int* width, int* height,
189 int* pal_num, void** pal_pp, int* bg_index, C FX_DIBAttribute* pAttribute); 189 int* pal_num, void** pal_pp, int* bg_index, C FX_DIBAttribute* pAttribute);
190 190
191 virtual FX_INT32» LoadFrameInfo(void* pContext, int* frame_num); 191 virtual int32_t» LoadFrameInfo(void* pContext, int* frame_num);
192 192
193 virtual FX_INT32» LoadFrame(void* pContext, int frame_num, CFX_DIBAttribut e* pAttribute); 193 virtual int32_t» LoadFrame(void* pContext, int frame_num, CFX_DIBAttribut e* pAttribute);
194 194
195 protected: 195 protected:
196 FX_CHAR m_szLastError[256]; 196 FX_CHAR m_szLastError[256];
197 }; 197 };
198 class CCodec_BmpModule : public ICodec_BmpModule 198 class CCodec_BmpModule : public ICodec_BmpModule
199 { 199 {
200 public: 200 public:
201 CCodec_BmpModule() 201 CCodec_BmpModule()
202 { 202 {
203 FXSYS_memset8(m_szLastError, '\0', 256); 203 FXSYS_memset8(m_szLastError, '\0', 256);
204 } 204 }
205 virtual void* Start(void* pModule); 205 virtual void* Start(void* pModule);
206 virtual void Finish(void* pContext); 206 virtual void Finish(void* pContext);
207 virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr); 207 virtual FX_DWORD GetAvailInput(void* pContext, FX_LPBYTE* avail_buf_ptr);
208 virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWO RD src_size); 208 virtual void Input(void* pContext, FX_LPCBYTE src_buf, FX_DWO RD src_size);
209 virtual FX_INT32» ReadHeader(void* pContext, FX_INT32* width, FX_INT32* he ight, FX_BOOL* tb_flag, FX_INT32* components, FX_INT32* pal_num, FX_DWORD** pal_ pp, CFX_DIBAttribute* pAttribute); 209 virtual int32_t» ReadHeader(void* pContext, int32_t* width, int32_t* heig ht, FX_BOOL* tb_flag, int32_t* components, int32_t* pal_num, FX_DWORD** pal_pp, CFX_DIBAttribute* pAttribute);
210 virtual FX_INT32» LoadImage(void* pContext); 210 virtual int32_t» LoadImage(void* pContext);
211 211
212 protected: 212 protected:
213 FX_CHAR m_szLastError[256]; 213 FX_CHAR m_szLastError[256];
214 }; 214 };
215 class CCodec_IccModule : public ICodec_IccModule 215 class CCodec_IccModule : public ICodec_IccModule
216 { 216 {
217 public: 217 public:
218 virtual IccCS GetProfileCS(FX_LPCBYTE pProfileData, un signed int dwProfileSize); 218 virtual IccCS GetProfileCS(FX_LPCBYTE pProfileData, un signed int dwProfileSize);
219 virtual IccCS GetProfileCS(IFX_FileRead* pFile); 219 virtual IccCS GetProfileCS(IFX_FileRead* pFile);
220 virtual FX_LPVOID CreateTransform(ICodec_IccModule::IccParam* pInp utParam, 220 virtual FX_LPVOID CreateTransform(ICodec_IccModule::IccParam* pInp utParam,
221 ICodec_IccModule::IccParam* pOutputP aram, 221 ICodec_IccModule::IccParam* pOutputP aram,
222 ICodec_IccModule::IccParam* pProofPa ram = NULL, 222 ICodec_IccModule::IccParam* pProofPa ram = NULL,
223 FX_DWORD dwIntent = Icc_INTENT_PERCE PTUAL, 223 FX_DWORD dwIntent = Icc_INTENT_PERCE PTUAL,
224 FX_DWORD dwFlag = Icc_FLAGS_DEFAULT, 224 FX_DWORD dwFlag = Icc_FLAGS_DEFAULT,
225 FX_DWORD dwPrfIntent = Icc_INTENT_AB SOLUTE_COLORIMETRIC, 225 FX_DWORD dwPrfIntent = Icc_INTENT_AB SOLUTE_COLORIMETRIC,
226 FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTP ROOFING 226 FX_DWORD dwPrfFlag = Icc_FLAGS_SOFTP ROOFING
227 ); 227 );
228 virtual FX_LPVOID» » CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX _DWORD dwProfileSize, FX_INT32& nComponents, FX_INT32 intent = 0, 228 virtual FX_LPVOID» » CreateTransform_sRGB(FX_LPCBYTE pProfileData, FX _DWORD dwProfileSize, int32_t& nComponents, int32_t intent = 0,
229 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT); 229 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT);
230 virtual FX_LPVOID» » CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, FX_INT32& nSrcComponents, 230 virtual FX_LPVOID» » CreateTransform_CMYK(FX_LPCBYTE pSrcProfileData, FX_DWORD dwSrcProfileSize, int32_t& nSrcComponents,
231 FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, FX_INT32 inte nt = 0, 231 FX_LPCBYTE pDstProfileData, FX_DWORD dwDstProfileSize, int32_t inten t = 0,
232 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT, 232 FX_DWORD dwSrcFormat = Icc_FORMAT_DEFAULT,
233 FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT 233 FX_DWORD dwDstFormat = Icc_FORMAT_DEFAULT
234 ); 234 );
235 virtual void DestroyTransform(FX_LPVOID pTransform); 235 virtual void DestroyTransform(FX_LPVOID pTransform);
236 virtual void Translate(FX_LPVOID pTransform, FX_FLOAT * pSrcValues, FX_FLOAT* pDestValues); 236 virtual void Translate(FX_LPVOID pTransform, FX_FLOAT * pSrcValues, FX_FLOAT* pDestValues);
237 virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels); 237 virtual void TranslateScanline(FX_LPVOID pTransform, FX_LPBYTE pDest, FX_LPCBYTE pSrc, int pixels);
238 virtual void SetComponents(FX_DWORD nComponents) {m_n Components = nComponents;} 238 virtual void SetComponents(FX_DWORD nComponents) {m_n Components = nComponents;}
239 virtual ~CCodec_IccModule(); 239 virtual ~CCodec_IccModule();
240 protected: 240 protected:
241 CFX_MapByteStringToPtr m_MapTranform; 241 CFX_MapByteStringToPtr m_MapTranform;
(...skipping 14 matching lines...) Expand all
256 void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_ BOOL useColorSpace = FALSE); 256 void* CreateDecoder(FX_LPCBYTE src_buf, FX_DWORD src_size, FX_ BOOL useColorSpace = FALSE);
257 void GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& h eight, 257 void GetImageInfo(FX_LPVOID ctx, FX_DWORD& width, FX_DWORD& h eight,
258 FX_DWORD& codestream_nComps, FX_DWORD& output_nComp s); 258 FX_DWORD& codestream_nComps, FX_DWORD& output_nComp s);
259 FX_BOOL Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOO L bTranslateColor, FX_LPBYTE offsets); 259 FX_BOOL Decode(void* ctx, FX_LPBYTE dest_data, int pitch, FX_BOO L bTranslateColor, FX_LPBYTE offsets);
260 void DestroyDecoder(void* ctx); 260 void DestroyDecoder(void* ctx);
261 }; 261 };
262 class CCodec_TiffModule : public ICodec_TiffModule 262 class CCodec_TiffModule : public ICodec_TiffModule
263 { 263 {
264 public: 264 public:
265 virtual FX_LPVOID CreateDecoder(IFX_FileRead* file_ptr); 265 virtual FX_LPVOID CreateDecoder(IFX_FileRead* file_ptr);
266 virtual void» » GetFrames(FX_LPVOID ctx, FX_INT32& frames); 266 virtual void» » GetFrames(FX_LPVOID ctx, int32_t& frames);
267 virtual FX_BOOL» » LoadFrameInfo(FX_LPVOID ctx, FX_INT32 frame, FX_ DWORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute * pAttribute = NULL); 267 virtual FX_BOOL» » LoadFrameInfo(FX_LPVOID ctx, int32_t frame, FX_D WORD& width, FX_DWORD& height, FX_DWORD& comps, FX_DWORD& bpc, CFX_DIBAttribute* pAttribute = NULL);
268 virtual FX_BOOL Decode(FX_LPVOID ctx, class CFX_DIBitmap* pDIBit map); 268 virtual FX_BOOL Decode(FX_LPVOID ctx, class CFX_DIBitmap* pDIBit map);
269 virtual void DestroyDecoder(FX_LPVOID ctx); 269 virtual void DestroyDecoder(FX_LPVOID ctx);
270 }; 270 };
271 class CPDF_Jbig2Interface : public CJBig2_Module 271 class CPDF_Jbig2Interface : public CJBig2_Module
272 { 272 {
273 public: 273 public:
274 virtual void *JBig2_Malloc(FX_DWORD dwSize) 274 virtual void *JBig2_Malloc(FX_DWORD dwSize)
275 { 275 {
276 return FX_Alloc(FX_BYTE, dwSize); 276 return FX_Alloc(uint8_t, dwSize);
277 } 277 }
278 virtual void *JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize) 278 virtual void *JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize)
279 { 279 {
280 if (dwSize && num >= UINT_MAX / dwSize) { 280 if (dwSize && num >= UINT_MAX / dwSize) {
281 return NULL; 281 return NULL;
282 } 282 }
283 return FX_Alloc(FX_BYTE, num * dwSize); 283 return FX_Alloc(uint8_t, num * dwSize);
284 } 284 }
285 virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) 285 virtual void *JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2)
286 { 286 {
287 if (dwSize2 && dwSize >= UINT_MAX / dwSize2) { 287 if (dwSize2 && dwSize >= UINT_MAX / dwSize2) {
288 return NULL; 288 return NULL;
289 } 289 }
290 FX_DWORD size = dwSize2 * dwSize; 290 FX_DWORD size = dwSize2 * dwSize;
291 if (size && num >= UINT_MAX / size) { 291 if (size && num >= UINT_MAX / size) {
292 return NULL; 292 return NULL;
293 } 293 }
294 return FX_Alloc(FX_BYTE, num * size); 294 return FX_Alloc(uint8_t, num * size);
295 } 295 }
296 virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize) 296 virtual void *JBig2_Realloc(FX_LPVOID pMem, FX_DWORD dwSize)
297 { 297 {
298 return FX_Realloc(FX_BYTE, pMem, dwSize); 298 return FX_Realloc(uint8_t, pMem, dwSize);
299 } 299 }
300 virtual void JBig2_Free(FX_LPVOID pMem) 300 virtual void JBig2_Free(FX_LPVOID pMem)
301 { 301 {
302 FX_Free(pMem); 302 FX_Free(pMem);
303 } 303 }
304 }; 304 };
305 class CCodec_Jbig2Context 305 class CCodec_Jbig2Context
306 { 306 {
307 public: 307 public:
308 CCodec_Jbig2Context(); 308 CCodec_Jbig2Context();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 OPJ_SIZE_T offset; 377 OPJ_SIZE_T offset;
378 }; 378 };
379 379
380 /* Wrappers for C-style callbacks. */ 380 /* Wrappers for C-style callbacks. */
381 OPJ_SIZE_T opj_read_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data); 381 OPJ_SIZE_T opj_read_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data);
382 OPJ_SIZE_T opj_write_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data); 382 OPJ_SIZE_T opj_write_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data);
383 OPJ_OFF_T opj_skip_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data); 383 OPJ_OFF_T opj_skip_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data);
384 OPJ_BOOL opj_seek_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data); 384 OPJ_BOOL opj_seek_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data);
385 385
386 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ 386 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_
OLDNEW
« no previous file with comments | « core/src/fpdftext/text_int.h ('k') | core/src/fxcodec/codec/fx_codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698