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

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

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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/txtproc.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 "../../../../third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. 13 #include "../../../../third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T.
14 #include "../../../include/fxcodec/fx_codec.h" 14 #include "../../../include/fxcodec/fx_codec.h"
15 #include "../jbig2/JBig2_Context.h" 15 #include "../jbig2/JBig2_Context.h"
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 uint8_t* src_buf, FX_DWORD src_siz e, uint8_t*& dest_buf, 20 virtual bool» RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_siz e, uint8_t*& dest_buf,
21 FX_DWORD& dest_size); 21 FX_DWORD& dest_size);
22 virtual FX_BOOL» A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uin t8_t*& dest_buf, 22 virtual bool» A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uin t8_t*& dest_buf,
23 FX_DWORD& dest_size); 23 FX_DWORD& dest_size);
24 virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* sr c_buf, FX_DWORD src_size, int width, int height, 24 virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* sr c_buf, 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 uint8_t 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()
41 { 41 {
42 return -1; 42 return -1;
43 } 43 }
44 44
45 virtual void DownScale(int dest_width, int dest_height); 45 virtual void DownScale(int dest_width, int dest_height);
46 46
47 uint8_t* GetScanline(int line); 47 uint8_t* GetScanline(int line);
48 48
49 FX_BOOL» » » » SkipToScanline(int line, IFX_Pause* pPau se); 49 bool» » » » SkipToScanline(int line, IFX_Pause* pPau se);
50 50
51 int GetWidth() 51 int GetWidth()
52 { 52 {
53 return m_OutputWidth; 53 return m_OutputWidth;
54 } 54 }
55 55
56 int GetHeight() 56 int GetHeight()
57 { 57 {
58 return m_OutputHeight; 58 return m_OutputHeight;
59 } 59 }
60 60
61 int CountComps() 61 int CountComps()
62 { 62 {
63 return m_nComps; 63 return m_nComps;
64 } 64 }
65 65
66 int GetBPC() 66 int GetBPC()
67 { 67 {
68 return m_bpc; 68 return m_bpc;
69 } 69 }
70 70
71 FX_BOOL» » » » IsColorTransformed() 71 bool» » » » IsColorTransformed()
72 { 72 {
73 return m_bColorTransformed; 73 return m_bColorTransformed;
74 } 74 }
75 75
76 void ClearImageData() 76 void ClearImageData()
77 { 77 {
78 if (m_pDataCache) { 78 if (m_pDataCache) {
79 FX_Free(m_pDataCache); 79 FX_Free(m_pDataCache);
80 } 80 }
81 m_pDataCache = NULL; 81 m_pDataCache = NULL;
82 } 82 }
83 protected: 83 protected:
84 84
85 int m_OrigWidth; 85 int m_OrigWidth;
86 86
87 int m_OrigHeight; 87 int m_OrigHeight;
88 88
89 int m_DownScale; 89 int m_DownScale;
90 90
91 int m_OutputWidth; 91 int m_OutputWidth;
92 92
93 int m_OutputHeight; 93 int m_OutputHeight;
94 94
95 int m_nComps; 95 int m_nComps;
96 96
97 int m_bpc; 97 int m_bpc;
98 98
99 int m_Pitch; 99 int m_Pitch;
100 100
101 FX_BOOL» » » » m_bColorTransformed; 101 bool» » » » m_bColorTransformed;
102 102
103 uint8_t* ReadNextLine(); 103 uint8_t* ReadNextLine();
104 104
105 virtual FX_BOOL» » v_Rewind() = 0; 105 virtual bool» » v_Rewind() = 0;
106 106
107 virtual uint8_t* v_GetNextLine() = 0; 107 virtual uint8_t* v_GetNextLine() = 0;
108 108
109 virtual void v_DownScale(int dest_width, int dest_height) = 0 ; 109 virtual void v_DownScale(int dest_width, int dest_height) = 0 ;
110 110
111 int m_NextLine; 111 int m_NextLine;
112 112
113 uint8_t* m_pLastScanline; 113 uint8_t* m_pLastScanline;
114 114
115 CCodec_ImageDataCache* m_pDataCache; 115 CCodec_ImageDataCache* m_pDataCache;
116 }; 116 };
117 class CCodec_FaxModule : public ICodec_FaxModule 117 class CCodec_FaxModule : public ICodec_FaxModule
118 { 118 {
119 public: 119 public:
120 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX _DWORD src_size, int width, int height, 120 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX _DWORD 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, bool EndOfLine, bool EncodedByteAlign, bool BlackIs1, int Col umns, int Rows);
122 FX_BOOL» » Encode(const uint8_t* src_buf, int width, int height, in t pitch, uint8_t*& dest_buf, FX_DWORD& dest_size); 122 bool» » Encode(const uint8_t* src_buf, int width, int height, in t pitch, uint8_t*& 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(const uint8_t* src_buf, FX _DWORD src_size, int width, int height, 127 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX _DWORD 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 uint8_t* src_buf, FX_D WORD src_size, FX_BOOL bEarlyChange, 129 virtual FX_DWORD FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, FX_DWOR D src_size, 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, uint8_t*& dest_bu f, FX_DWORD& dest_size); 131 FX_DWORD estimated_size, uint8_t*& dest_bu f, FX_DWORD& dest_size);
132 virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, 132 virtual 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 uint8_t*& dest_buf, FX_DWORD& dest_size); 134 uint8_t*& dest_buf, FX_DWORD& dest_size);
135 virtual FX_BOOL» » Encode(const uint8_t* src_buf, FX_DWORD src_size , uint8_t*& dest_buf, FX_DWORD& dest_size); 135 virtual bool» » Encode(const uint8_t* src_buf, FX_DWORD src_size , uint8_t*& 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 {
143 m_pExtProvider = pJP; 143 m_pExtProvider = pJP;
144 } 144 }
145 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD s rc_size, 145 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD s rc_size,
146 int width, int height, int nComps, FX_ BOOL ColorTransform); 146 int width, int height, int nComps, boo l ColorTransform);
147 FX_BOOL» » LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, 147 bool» » LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height,
148 int& num_components, int& bits_per_components, FX_BOOL& color_transform, 148 int& num_components, int& bits_per_components, bool& co lor_transform,
149 uint8_t** icc_buf_ptr, FX_DWORD* icc_length); 149 uint8_t** icc_buf_ptr, FX_DWORD* icc_length);
150 FX_BOOL» » Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length ); 150 bool» » Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length );
151 virtual void* Start(); 151 virtual void* Start();
152 virtual void Finish(void* pContext); 152 virtual void Finish(void* pContext);
153 virtual void Input(void* pContext, const uint8_t* src_buf, FX _DWORD src_size); 153 virtual void Input(void* pContext, const uint8_t* src_buf, FX _DWORD src_size);
154 virtual int ReadHeader(void* pContext, int* width, int* heig ht, int* nComps); 154 virtual int ReadHeader(void* pContext, int* width, int* heig ht, int* nComps);
155 virtual FX_BOOL» » StartScanline(void* pContext, int down_scale); 155 virtual int»» » StartScanline(void* pContext, int down_scale);
156 virtual FX_BOOL» » ReadScanline(void* pContext, uint8_t* dest_buf); 156 virtual bool» » ReadScanline(void* pContext, uint8_t* dest_buf);
157 virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); 157 virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr);
158 protected: 158 protected:
159 IFX_JpegProvider* m_pExtProvider; 159 IFX_JpegProvider* m_pExtProvider;
160 }; 160 };
161 class CCodec_IccModule : public ICodec_IccModule 161 class CCodec_IccModule : public ICodec_IccModule
162 { 162 {
163 public: 163 public:
164 virtual IccCS GetProfileCS(const uint8_t* pProfileData , unsigned int dwProfileSize); 164 virtual IccCS GetProfileCS(const uint8_t* pProfileData , unsigned int dwProfileSize);
165 virtual IccCS GetProfileCS(IFX_FileRead* pFile); 165 virtual IccCS GetProfileCS(IFX_FileRead* pFile);
166 virtual void* CreateTransform(ICodec_IccModule::IccParam* pInp utParam, 166 virtual void* CreateTransform(ICodec_IccModule::IccParam* pInp utParam,
(...skipping 25 matching lines...) Expand all
192 Icc_CLASS_OUTPUT, 192 Icc_CLASS_OUTPUT,
193 Icc_CLASS_PROOF, 193 Icc_CLASS_PROOF,
194 Icc_CLASS_MAX 194 Icc_CLASS_MAX
195 } Icc_CLASS; 195 } Icc_CLASS;
196 void* CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc _CLASS ic, CFX_BinaryBuf* pTransformKey); 196 void* CreateProfile(ICodec_IccModule::IccParam* pIccParam, Icc _CLASS ic, CFX_BinaryBuf* pTransformKey);
197 }; 197 };
198 class CCodec_JpxModule : public ICodec_JpxModule 198 class CCodec_JpxModule : public ICodec_JpxModule
199 { 199 {
200 public: 200 public:
201 CCodec_JpxModule(); 201 CCodec_JpxModule();
202 void*» » CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); 202 void*» » CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, bool useColorSpace = false);
203 void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& heigh t, 203 void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& heigh t,
204 FX_DWORD& codestream_nComps, FX_DWORD& output_nComp s); 204 FX_DWORD& codestream_nComps, FX_DWORD& output_nComp s);
205 FX_BOOL» » Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); 205 bool» » Decode(void* ctx, uint8_t* dest_data, int pitch, bool bT ranslateColor, uint8_t* offsets);
206 void DestroyDecoder(void* ctx); 206 void DestroyDecoder(void* ctx);
207 }; 207 };
208 class CPDF_Jbig2Interface : public CJBig2_Module 208 class CPDF_Jbig2Interface : public CJBig2_Module
209 { 209 {
210 public: 210 public:
211 virtual void *JBig2_Malloc(FX_DWORD dwSize) 211 virtual void *JBig2_Malloc(FX_DWORD dwSize)
212 { 212 {
213 return FX_Alloc(uint8_t, dwSize); 213 return FX_Alloc(uint8_t, dwSize);
214 } 214 }
215 virtual void *JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize) 215 virtual void *JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize)
(...skipping 30 matching lines...) Expand all
246 ~CCodec_Jbig2Context() {}; 246 ~CCodec_Jbig2Context() {};
247 IFX_FileRead* m_file_ptr; 247 IFX_FileRead* m_file_ptr;
248 FX_DWORD m_width; 248 FX_DWORD m_width;
249 FX_DWORD m_height; 249 FX_DWORD m_height;
250 uint8_t* m_src_buf; 250 uint8_t* m_src_buf;
251 FX_DWORD m_src_size; 251 FX_DWORD m_src_size;
252 const uint8_t* m_global_data; 252 const uint8_t* m_global_data;
253 FX_DWORD m_global_size; 253 FX_DWORD m_global_size;
254 uint8_t* m_dest_buf; 254 uint8_t* m_dest_buf;
255 FX_DWORD m_dest_pitch; 255 FX_DWORD m_dest_pitch;
256 FX_BOOL» m_bFileReader; 256 bool» m_bFileReader;
257 IFX_Pause* m_pPause; 257 IFX_Pause* m_pPause;
258 CJBig2_Context* m_pContext; 258 CJBig2_Context* m_pContext;
259 CJBig2_Image* m_dest_image; 259 CJBig2_Image* m_dest_image;
260 }; 260 };
261 class CCodec_Jbig2Module : public ICodec_Jbig2Module 261 class CCodec_Jbig2Module : public ICodec_Jbig2Module
262 { 262 {
263 public: 263 public:
264 CCodec_Jbig2Module() {}; 264 CCodec_Jbig2Module() {};
265 ~CCodec_Jbig2Module(); 265 ~CCodec_Jbig2Module();
266 FX_BOOL» » Decode(FX_DWORD width, FX_DWORD height, const uint8_t* s rc_buf, FX_DWORD src_size, 266 bool» » Decode(FX_DWORD width, FX_DWORD height, const uint8_t* s rc_buf, FX_DWORD src_size,
267 const uint8_t* global_data, FX_DWORD global_size, uint8_t * dest_buf, FX_DWORD dest_pitch); 267 const uint8_t* global_data, FX_DWORD global_size, uint8_t * dest_buf, FX_DWORD dest_pitch);
268 FX_BOOL» » Decode(IFX_FileRead* file_ptr, 268 bool» » Decode(IFX_FileRead* file_ptr,
269 FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8 _t*& dest_buf); 269 FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8 _t*& dest_buf);
270 void* CreateJbig2Context(); 270 void* CreateJbig2Context();
271 FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, 271 FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size,
272 const uint8_t* global_data, FX_DWORD global_ size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause); 272 const uint8_t* global_data, FX_DWORD global_ size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause);
273 273
274 FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_FileRead* f ile_ptr, 274 FXCODEC_STATUS StartDecode(void* pJbig2Context, IFX_FileRead* f ile_ptr,
275 FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause); 275 FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf, IFX_Pause* pPause);
276 FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* p Pause); 276 FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* p Pause);
277 void DestroyJbig2Context(void* pJbig2Context) ; 277 void DestroyJbig2Context(void* pJbig2Context) ;
278 CPDF_Jbig2Interface m_Module; 278 CPDF_Jbig2Interface m_Module;
(...skipping 11 matching lines...) Expand all
290 OPJ_SIZE_T offset; 290 OPJ_SIZE_T offset;
291 }; 291 };
292 292
293 /* Wrappers for C-style callbacks. */ 293 /* Wrappers for C-style callbacks. */
294 OPJ_SIZE_T opj_read_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data); 294 OPJ_SIZE_T opj_read_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data);
295 OPJ_SIZE_T opj_write_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data); 295 OPJ_SIZE_T opj_write_from_memory (void* p_buffer, OPJ_SIZE_T nb_bytes, void* p_u ser_data);
296 OPJ_OFF_T opj_skip_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data); 296 OPJ_OFF_T opj_skip_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data);
297 OPJ_BOOL opj_seek_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data); 297 OPJ_BOOL opj_seek_from_memory (OPJ_OFF_T nb_bytes, void* p_user_data);
298 298
299 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ 299 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_
OLDNEW
« no previous file with comments | « core/src/fpdftext/txtproc.h ('k') | core/src/fxcodec/codec/fx_codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698