From f1e7c461dfabbff6b65a072f24f6711b34159361 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 23 Jul 2015 13:36:00 -0700 Subject: Revert "FX_BOOL considered harmful, part 2." This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9. Reason for revert: build failure. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255693002 . --- core/src/fxcodec/codec/codec_int.h | 42 ++++---- core/src/fxcodec/codec/fx_codec.cpp | 58 +++++------ core/src/fxcodec/codec/fx_codec_fax.cpp | 86 ++++++++-------- core/src/fxcodec/codec/fx_codec_flate.cpp | 54 +++++----- core/src/fxcodec/codec/fx_codec_icc.cpp | 30 +++--- core/src/fxcodec/codec/fx_codec_jbig.cpp | 24 ++--- core/src/fxcodec/codec/fx_codec_jpeg.cpp | 108 +++++++++---------- core/src/fxcodec/codec/fx_codec_jpx_opj.cpp | 44 ++++---- core/src/fxcodec/jbig2/JBig2_BitStream.h | 4 +- core/src/fxcodec/jbig2/JBig2_Context.cpp | 30 +++--- core/src/fxcodec/jbig2/JBig2_Context.h | 4 +- core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp | 114 ++++++++++----------- core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h | 40 ++++---- core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp | 10 +- core/src/fxcodec/jbig2/JBig2_HuffmanTable.h | 10 +- .../fxcodec/jbig2/JBig2_HuffmanTable_Standard.h | 30 +++--- core/src/fxcodec/jbig2/JBig2_Image.cpp | 60 +++++------ core/src/fxcodec/jbig2/JBig2_Image.h | 26 ++--- core/src/fxcodec/jbig2/JBig2_Page.h | 2 +- core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp | 2 +- core/src/fxcodec/jbig2/JBig2_SymbolDict.h | 2 +- 21 files changed, 390 insertions(+), 390 deletions(-) (limited to 'core/src/fxcodec') diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index dc64748e83..7668f84a20 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -17,9 +17,9 @@ class CCodec_BasicModule : public ICodec_BasicModule { public: - virtual bool RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, + virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual bool A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, + virtual FX_BOOL A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); virtual ICodec_ScanlineDecoder* CreateRunLengthDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); @@ -46,7 +46,7 @@ public: uint8_t* GetScanline(int line); - bool SkipToScanline(int line, IFX_Pause* pPause); + FX_BOOL SkipToScanline(int line, IFX_Pause* pPause); int GetWidth() { @@ -68,7 +68,7 @@ public: return m_bpc; } - bool IsColorTransformed() + FX_BOOL IsColorTransformed() { return m_bColorTransformed; } @@ -98,11 +98,11 @@ protected: int m_Pitch; - bool m_bColorTransformed; + FX_BOOL m_bColorTransformed; uint8_t* ReadNextLine(); - virtual bool v_Rewind() = 0; + virtual FX_BOOL v_Rewind() = 0; virtual uint8_t* v_GetNextLine() = 0; @@ -118,21 +118,21 @@ class CCodec_FaxModule : public ICodec_FaxModule { public: virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int K, bool EndOfLine, bool EncodedByteAlign, bool BlackIs1, int Columns, int Rows); - bool Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size); + int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); + FX_BOOL Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_FlateModule : public ICodec_FlateModule { public: virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc, int predictor, int Colors, int BitsPerComponent, int Columns); - virtual FX_DWORD FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, FX_DWORD src_size, bool bEarlyChange, + virtual FX_DWORD FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual bool Encode(const uint8_t* src_buf, FX_DWORD src_size, + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, FX_DWORD& dest_size); - virtual bool Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); + virtual FX_BOOL Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size); }; class CCodec_JpegModule : public ICodec_JpegModule { @@ -143,17 +143,17 @@ public: m_pExtProvider = pJP; } ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, - int width, int height, int nComps, bool ColorTransform); - bool LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, - int& num_components, int& bits_per_components, bool& color_transform, + int width, int height, int nComps, FX_BOOL ColorTransform); + FX_BOOL LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, + int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, FX_DWORD* icc_length); - 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); + 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); virtual void* Start(); virtual void Finish(void* pContext); virtual void Input(void* pContext, const uint8_t* src_buf, FX_DWORD src_size); virtual int ReadHeader(void* pContext, int* width, int* height, int* nComps); virtual int StartScanline(void* pContext, int down_scale); - virtual bool ReadScanline(void* pContext, uint8_t* dest_buf); + virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf); virtual FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr); protected: IFX_JpegProvider* m_pExtProvider; @@ -199,10 +199,10 @@ class CCodec_JpxModule : public ICodec_JpxModule { public: CCodec_JpxModule(); - void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, bool useColorSpace = false); + void* CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL useColorSpace = FALSE); void GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - bool Decode(void* ctx, uint8_t* dest_data, int pitch, bool bTranslateColor, uint8_t* offsets); + FX_BOOL Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); void DestroyDecoder(void* ctx); }; class CPDF_Jbig2Interface : public CJBig2_Module @@ -253,7 +253,7 @@ public: FX_DWORD m_global_size; uint8_t* m_dest_buf; FX_DWORD m_dest_pitch; - bool m_bFileReader; + FX_BOOL m_bFileReader; IFX_Pause* m_pPause; CJBig2_Context* m_pContext; CJBig2_Image* m_dest_image; @@ -263,9 +263,9 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module public: CCodec_Jbig2Module() {}; ~CCodec_Jbig2Module(); - bool Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, + FX_BOOL Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch); - bool Decode(IFX_FileRead* file_ptr, + FX_BOOL Decode(IFX_FileRead* file_ptr, FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf); void* CreateJbig2Context(); FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp index 8edfde5319..9bbcce105f 100644 --- a/core/src/fxcodec/codec/fx_codec.cpp +++ b/core/src/fxcodec/codec/fx_codec.cpp @@ -49,13 +49,13 @@ uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) m_NextLine ++; return m_pLastScanline; } -bool CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) +FX_BOOL CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) { if (m_pDataCache && line < m_pDataCache->m_nCachedLines) { - return false; + return FALSE; } if (m_NextLine == line || m_NextLine == line + 1) { - return false; + return FALSE; } if (m_NextLine < 0 || m_NextLine > line) { v_Rewind(); @@ -66,10 +66,10 @@ bool CCodec_ScanlineDecoder::SkipToScanline(int line, IFX_Pause* pPause) m_pLastScanline = ReadNextLine(); m_NextLine ++; if (pPause && pPause->NeedToPauseNow()) { - return true; + return TRUE; } } - return false; + return FALSE; } uint8_t* CCodec_ScanlineDecoder::ReadNextLine() { @@ -107,10 +107,10 @@ void CCodec_ScanlineDecoder::DownScale(int dest_width, int dest_height) m_pDataCache->m_Width = m_OutputWidth; m_pDataCache->m_nCachedLines = 0; } -bool CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, +FX_BOOL CCodec_BasicModule::RunLengthEncode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { - return false; + return FALSE; } extern "C" double FXstrtod(const char* nptr, char** endptr) { @@ -216,26 +216,26 @@ extern "C" double FXstrtod(const char* nptr, char** endptr) } return is_negative ? -ret : ret; } -bool CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, +FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { - return false; + return FALSE; } class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { public: CCodec_RLScanlineDecoder(); virtual ~CCodec_RLScanlineDecoder(); - bool Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc); virtual void v_DownScale(int dest_width, int dest_height) {} - virtual bool v_Rewind(); + virtual FX_BOOL v_Rewind(); virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset() { return m_SrcOffset; } protected: - bool CheckDestSize(); + FX_BOOL CheckDestSize(); void GetNextOperator(); void UpdateOperator(uint8_t used_bytes); @@ -244,7 +244,7 @@ protected: FX_DWORD m_SrcSize; FX_DWORD m_dwLineBytes; FX_DWORD m_SrcOffset; - bool m_bEOD; + FX_BOOL m_bEOD; uint8_t m_Operator; }; CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder() @@ -253,7 +253,7 @@ CCodec_RLScanlineDecoder::CCodec_RLScanlineDecoder() , m_SrcSize(0) , m_dwLineBytes(0) , m_SrcOffset(0) - , m_bEOD(false) + , m_bEOD(FALSE) , m_Operator(0) { } @@ -263,7 +263,7 @@ CCodec_RLScanlineDecoder::~CCodec_RLScanlineDecoder() FX_Free(m_pScanline); } } -bool CCodec_RLScanlineDecoder::CheckDestSize() +FX_BOOL CCodec_RLScanlineDecoder::CheckDestSize() { FX_DWORD i = 0; FX_DWORD old_size = 0; @@ -273,14 +273,14 @@ bool CCodec_RLScanlineDecoder::CheckDestSize() old_size = dest_size; dest_size += m_pSrcBuf[i] + 1; if (dest_size < old_size) { - return false; + return FALSE; } i += m_pSrcBuf[i] + 2; } else if (m_pSrcBuf[i] > 128) { old_size = dest_size; dest_size += 257 - m_pSrcBuf[i]; if (dest_size < old_size) { - return false; + return FALSE; } i += 2; } else { @@ -288,11 +288,11 @@ bool CCodec_RLScanlineDecoder::CheckDestSize() } } if (((FX_DWORD)m_OrigWidth * m_nComps * m_bpc * m_OrigHeight + 7) / 8 > dest_size) { - return false; + return FALSE; } - return true; + return TRUE; } -bool CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) +FX_BOOL CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, int bpc) { m_pSrcBuf = src_buf; m_SrcSize = src_size; @@ -300,20 +300,20 @@ bool CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, m_OutputHeight = m_OrigHeight = height; m_nComps = nComps; m_bpc = bpc; - m_bColorTransformed = false; + m_bColorTransformed = FALSE; m_DownScale = 1; m_Pitch = (width * nComps * bpc + 31) / 32 * 4; m_dwLineBytes = (width * nComps * bpc + 7) / 8; m_pScanline = FX_Alloc(uint8_t, m_Pitch); return CheckDestSize(); } -bool CCodec_RLScanlineDecoder::v_Rewind() +FX_BOOL CCodec_RLScanlineDecoder::v_Rewind() { FXSYS_memset(m_pScanline, 0, m_Pitch); m_SrcOffset = 0; - m_bEOD = false; + m_bEOD = FALSE; m_Operator = 0; - return true; + return TRUE; } uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { @@ -326,17 +326,17 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() } FXSYS_memset(m_pScanline, 0, m_Pitch); FX_DWORD col_pos = 0; - bool eol = false; + FX_BOOL eol = FALSE; while (m_SrcOffset < m_SrcSize && !eol) { if (m_Operator < 128) { FX_DWORD copy_len = m_Operator + 1; if (col_pos + copy_len >= m_dwLineBytes) { copy_len = m_dwLineBytes - col_pos; - eol = true; + eol = TRUE; } if (copy_len >= m_SrcSize - m_SrcOffset) { copy_len = m_SrcSize - m_SrcOffset; - m_bEOD = true; + m_bEOD = TRUE; } FXSYS_memcpy(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); col_pos += copy_len; @@ -349,13 +349,13 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() FX_DWORD duplicate_len = 257 - m_Operator; if (col_pos + duplicate_len >= m_dwLineBytes) { duplicate_len = m_dwLineBytes - col_pos; - eol = true; + eol = TRUE; } FXSYS_memset(m_pScanline + col_pos, fill, duplicate_len); col_pos += duplicate_len; UpdateOperator((uint8_t)duplicate_len); } else { - m_bEOD = true; + m_bEOD = TRUE; break; } } diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index 3446d0a7b9..d45600372f 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -79,7 +79,7 @@ int _FindBit(const uint8_t* data_buf, int max_pos, int start_pos, int bit) } return pos; } -void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, bool a0color, int& b1, int& b2) +void _FaxG4FindB1B2(const uint8_t* ref_buf, int columns, int a0, FX_BOOL a0color, int& b1, int& b2) { if (a0color) { a0color = 1; @@ -400,27 +400,27 @@ int _FaxGetRun(const uint8_t* ins_array, const uint8_t* src_buf, int& bitpos, in } } } -bool _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns) +FX_BOOL _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, const uint8_t* ref_buf, int columns) { int a0 = -1, a0color = 1; while (1) { if (bitpos >= bitsize) { - return false; + return FALSE; } int a1, a2, b1, b2; _FaxG4FindB1B2(ref_buf, columns, a0, a0color, b1, b2); - bool bit = NEXTBIT; + FX_BOOL bit = NEXTBIT; int v_delta = 0; if (bit) { } else { if (bitpos >= bitsize) { - return false; + return FALSE; } - bool bit1 = NEXTBIT; + FX_BOOL bit1 = NEXTBIT; if (bitpos >= bitsize) { - return false; + return FALSE; } - bool bit2 = NEXTBIT; + FX_BOOL bit2 = NEXTBIT; if (bit1 && bit2) { v_delta = 1; } else if (bit1) { @@ -457,10 +457,10 @@ bool _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* des if (a0 < columns) { continue; } - return true; + return TRUE; } else { if (bitpos >= bitsize) { - return false; + return FALSE; } bit = NEXTBIT; if (bit) { @@ -468,26 +468,26 @@ bool _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* des _FaxFillBits(dest_buf, columns, a0, b2); } if (b2 >= columns) { - return true; + return TRUE; } a0 = b2; continue; } else { if (bitpos >= bitsize) { - return false; + return FALSE; } - bool bit1 = NEXTBIT; + FX_BOOL bit1 = NEXTBIT; if (bitpos >= bitsize) { - return false; + return FALSE; } - bool bit2 = NEXTBIT; + FX_BOOL bit2 = NEXTBIT; if (bit1 && bit2) { v_delta = 2; } else if (bit1) { v_delta = -2; } else if (bit2) { if (bitpos >= bitsize) { - return false; + return FALSE; } bit = NEXTBIT; if (bit) { @@ -497,7 +497,7 @@ bool _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* des } } else { if (bitpos >= bitsize) { - return false; + return FALSE; } bit = NEXTBIT; if (bit) { @@ -505,7 +505,7 @@ bool _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* des continue; } else { bitpos += 5; - return true; + return TRUE; } } } @@ -516,13 +516,13 @@ bool _FaxG4GetRow(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* des _FaxFillBits(dest_buf, columns, a0, a1); } if (a1 >= columns) { - return true; + return TRUE; } a0 = a1; a0color = !a0color; } } -bool _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) +FX_BOOL _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) { int startbit = bitpos; while (bitpos < bitsize) { @@ -531,18 +531,18 @@ bool _FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) if (bitpos - startbit <= 11) { bitpos = startbit; } - return true; + return TRUE; } } - return false; + return FALSE; } -bool _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns) +FX_BOOL _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* dest_buf, int columns) { - int color = true; + int color = TRUE; int startpos = 0; while (1) { if (bitpos >= bitsize) { - return false; + return FALSE; } int run_len = 0; while (1) { @@ -551,10 +551,10 @@ bool _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* de while (bitpos < bitsize) { int bit = NEXTBIT; if (bit) { - return true; + return TRUE; } } - return false; + return FALSE; } run_len += run; if (run < 64) { @@ -570,17 +570,17 @@ bool _FaxGet1DLine(const uint8_t* src_buf, int bitsize, int& bitpos, uint8_t* de } color = !color; } - return true; + return TRUE; } class CCodec_FaxDecoder : public CCodec_ScanlineDecoder { public: CCodec_FaxDecoder(); virtual ~CCodec_FaxDecoder(); - bool Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int K, bool EndOfLine, bool EncodedByteAlign, bool BlackIs1, int Columns, int Rows); + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, + int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows); virtual void v_DownScale(int dest_width, int dest_height) {} - virtual bool v_Rewind(); + virtual FX_BOOL v_Rewind(); virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); int m_Encoding, m_bEndOfLine, m_bByteAlign, m_bBlack; @@ -604,8 +604,8 @@ CCodec_FaxDecoder::~CCodec_FaxDecoder() FX_Free(m_pRefBuf); } } -bool CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int K, bool EndOfLine, bool EncodedByteAlign, bool BlackIs1, int Columns, int Rows) +FX_BOOL CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, + int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { m_Encoding = K; m_bEndOfLine = EndOfLine; @@ -628,14 +628,14 @@ bool CCodec_FaxDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int wi m_SrcSize = src_size; m_nComps = 1; m_bpc = 1; - m_bColorTransformed = false; - return true; + m_bColorTransformed = FALSE; + return TRUE; } -bool CCodec_FaxDecoder::v_Rewind() +FX_BOOL CCodec_FaxDecoder::v_Rewind() { FXSYS_memset(m_pRefBuf, 0xff, m_Pitch); bitpos = 0; - return true; + return TRUE; } uint8_t* CCodec_FaxDecoder::v_GetNextLine() { @@ -651,7 +651,7 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() } else if (m_Encoding == 0) { _FaxGet1DLine(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_OrigWidth); } else { - bool bNext1D = m_pSrcBuf[bitpos / 8] & (1 << (7 - bitpos % 8)); + FX_BOOL bNext1D = m_pSrcBuf[bitpos / 8] & (1 << (7 - bitpos % 8)); bitpos ++; if (bNext1D) { _FaxGet1DLine(m_pSrcBuf, bitsize, bitpos, m_pScanlineBuf, m_OrigWidth); @@ -669,7 +669,7 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() while (m_bByteAlign && bitpos0 < bitpos1) { int bit = m_pSrcBuf[bitpos0 / 8] & (1 << (7 - bitpos0 % 8)); if (bit != 0) { - m_bByteAlign = false; + m_bByteAlign = FALSE; } else { bitpos0 ++; } @@ -846,7 +846,7 @@ static void _AddBitStream(uint8_t* dest_buf, int& dest_bitpos, int data, int bit dest_bitpos ++; } } -static void _FaxEncodeRun(uint8_t* dest_buf, int& dest_bitpos, int run, bool bWhite) +static void _FaxEncodeRun(uint8_t* dest_buf, int& dest_bitpos, int run, FX_BOOL bWhite) { while (run >= 2560) { _AddBitStream(dest_buf, dest_bitpos, 0x1f, 12); @@ -972,14 +972,14 @@ void CCodec_FaxEncoder::Encode(uint8_t*& dest_buf, FX_DWORD& dest_size) dest_size = m_DestBuf.GetSize(); m_DestBuf.DetachBuffer(); } -bool CCodec_FaxModule::Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FaxModule::Encode(const uint8_t* src_buf, int width, int height, int pitch, uint8_t*& dest_buf, FX_DWORD& dest_size) { CCodec_FaxEncoder encoder(src_buf, width, height, pitch); encoder.Encode(dest_buf, dest_size); - return true; + return TRUE; } ICodec_ScanlineDecoder* CCodec_FaxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int K, bool EndOfLine, bool EncodedByteAlign, bool BlackIs1, int Columns, int Rows) + int K, FX_BOOL EndOfLine, FX_BOOL EncodedByteAlign, FX_BOOL BlackIs1, int Columns, int Rows) { CCodec_FaxDecoder* pDecoder = new CCodec_FaxDecoder; pDecoder->Create(src_buf, src_size, width, height, K, EndOfLine, EncodedByteAlign, BlackIs1, Columns, Rows); diff --git a/core/src/fxcodec/codec/fx_codec_flate.cpp b/core/src/fxcodec/codec/fx_codec_flate.cpp index a61be75bbe..d129e36392 100644 --- a/core/src/fxcodec/codec/fx_codec_flate.cpp +++ b/core/src/fxcodec/codec/fx_codec_flate.cpp @@ -84,7 +84,7 @@ extern "C" class CLZWDecoder { public: - int Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, bool bEarlyChange); + int Decode(uint8_t* output, FX_DWORD& outlen, const uint8_t* input, FX_DWORD& size, FX_BOOL bEarlyChange); private: void AddCode(FX_DWORD prefix_code, uint8_t append_char); @@ -94,7 +94,7 @@ private: FX_DWORD m_OutPos; uint8_t* m_pOutput; const uint8_t* m_pInput; - bool m_Early; + FX_BOOL m_Early; FX_DWORD m_CodeArray[5021]; FX_DWORD m_nCodes; uint8_t m_DecodeStack[4000]; @@ -134,7 +134,7 @@ void CLZWDecoder::DecodeString(FX_DWORD code) } m_DecodeStack[m_StackLen++] = (uint8_t)code; } -int CLZWDecoder::Decode(uint8_t* dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, bool bEarlyChange) +int CLZWDecoder::Decode(uint8_t* dest_buf, FX_DWORD& dest_size, const uint8_t* src_buf, FX_DWORD& src_size, FX_BOOL bEarlyChange) { m_CodeLen = 9; m_InPos = 0; @@ -238,14 +238,14 @@ static uint8_t PaethPredictor(int a, int b, int c) } return (uint8_t)c; } -static bool PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int predictor, int Colors, int BitsPerComponent, int Columns) { const int BytesPerPixel = (Colors * BitsPerComponent + 7) / 8; const int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; if (row_size <= 0) - return false; + return FALSE; const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size + 1, row_count); @@ -328,7 +328,7 @@ static bool PNG_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, FX_Free(data_buf); data_buf = dest_buf; data_size = (row_size + 1) * row_count - (last_row_size > 0 ? (row_size - last_row_size) : 0); - return true; + return TRUE; } static void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const uint8_t* pLastLine, int bpc, int nColors, int nPixels) @@ -393,13 +393,13 @@ static void PNG_PredictLine(uint8_t* pDestData, const uint8_t* pSrcData, const u } } } -static bool PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, +static FX_BOOL PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { const int BytesPerPixel = (Colors * BitsPerComponent + 7) / 8; const int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; if (row_size <= 0) - return false; + return FALSE; const int row_count = (data_size + row_size) / (row_size + 1); const int last_row_size = data_size % (row_size + 1); uint8_t* dest_buf = FX_Alloc2D(uint8_t, row_size, row_count); @@ -479,7 +479,7 @@ static bool PNG_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, FX_Free(data_buf); data_buf = dest_buf; data_size = row_size * row_count - (last_row_size > 0 ? (row_size + 1 - last_row_size) : 0); - return true; + return TRUE; } static void TIFF_PredictorEncodeLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { @@ -518,12 +518,12 @@ static void TIFF_PredictorEncodeLine(uint8_t* dest_buf, int row_size, int BitsPe } } } -static bool TIFF_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; if (row_size == 0) - return false; + return FALSE; const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row++) { @@ -533,7 +533,7 @@ static bool TIFF_PredictorEncode(uint8_t*& data_buf, FX_DWORD& data_size, } TIFF_PredictorEncodeLine(scan_line, row_size, BitsPerComponent, Colors, Columns); } - return true; + return TRUE; } static void TIFF_PredictLine(uint8_t* dest_buf, int row_size, int BitsPerComponent, int Colors, int Columns) { @@ -568,12 +568,12 @@ static void TIFF_PredictLine(uint8_t* dest_buf, int row_size, int BitsPerCompone } } } -static bool TIFF_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, +static FX_BOOL TIFF_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, int Colors, int BitsPerComponent, int Columns) { int row_size = (Colors * BitsPerComponent * Columns + 7) / 8; if (row_size == 0) - return false; + return FALSE; const int row_count = (data_size + row_size - 1) / row_size; const int last_row_size = data_size % row_size; for (int row = 0; row < row_count; row ++) { @@ -583,7 +583,7 @@ static bool TIFF_Predictor(uint8_t*& data_buf, FX_DWORD& data_size, } TIFF_PredictLine(scan_line, row_size, BitsPerComponent, Colors, Columns); } - return true; + return TRUE; } class CCodec_FlateScanlineDecoder : public CCodec_ScanlineDecoder { @@ -597,7 +597,7 @@ public: delete this; } virtual void v_DownScale(int dest_width, int dest_height) {} - virtual bool v_Rewind(); + virtual FX_BOOL v_Rewind(); virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); void* m_pFlate; @@ -646,7 +646,7 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_si m_OutputHeight = m_OrigHeight = height; m_nComps = nComps; m_bpc = bpc; - m_bColorTransformed = false; + m_bColorTransformed = FALSE; m_Pitch = (width * nComps * bpc + 7) / 8; m_pScanline = FX_Alloc(uint8_t, m_Pitch); m_Predictor = 0; @@ -672,18 +672,18 @@ void CCodec_FlateScanlineDecoder::Create(const uint8_t* src_buf, FX_DWORD src_si } } } -bool CCodec_FlateScanlineDecoder::v_Rewind() +FX_BOOL CCodec_FlateScanlineDecoder::v_Rewind() { if (m_pFlate) { FPDFAPI_FlateEnd(m_pFlate); } m_pFlate = FPDFAPI_FlateInit(my_alloc_func, my_free_func); if (m_pFlate == NULL) { - return false; + return FALSE; } FPDFAPI_FlateInput(m_pFlate, m_SrcBuf, m_SrcSize); m_LeftOver = 0; - return true; + return TRUE; } uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { @@ -732,7 +732,7 @@ FX_DWORD CCodec_FlateScanlineDecoder::GetSrcOffset() static void FlateUncompress(const uint8_t* src_buf, FX_DWORD src_size, FX_DWORD orig_size, uint8_t*& dest_buf, FX_DWORD& dest_size, FX_DWORD& offset) { - const bool useOldImpl = src_size < 10240; + const FX_BOOL useOldImpl = src_size < 10240; FX_DWORD guess_size = orig_size ? orig_size : src_size * 2; FX_DWORD alloc_step = orig_size ? 10240 : (src_size < 10240 ? 10240 : src_size); static const FX_DWORD kMaxInitialAllocSize = 10000000; @@ -839,7 +839,7 @@ ICodec_ScanlineDecoder* CCodec_FlateModule::CreateDecoder(const uint8_t* src_buf pDecoder->Create(src_buf, src_size, width, height, nComps, bpc, predictor, Colors, BitsPerComponent, Columns); return pDecoder; } -FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, FX_DWORD src_size, bool bEarlyChange, +FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD src_size, FX_BOOL bEarlyChange, int predictor, int Colors, int BitsPerComponent, int Columns, FX_DWORD estimated_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { @@ -876,7 +876,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, if (predictor_type == 0) { return offset; } - bool ret = true; + FX_BOOL ret = TRUE; if (predictor_type == 2) { ret = PNG_Predictor(dest_buf, dest_size, Colors, BitsPerComponent, Columns); @@ -886,7 +886,7 @@ FX_DWORD CCodec_FlateModule::FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, } return ret ? offset : -1; } -bool CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, +FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, int predictor, int Colors, int BitsPerComponent, int Columns, uint8_t*& dest_buf, FX_DWORD& dest_size) { @@ -896,7 +896,7 @@ bool CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t* pSrcBuf = NULL; pSrcBuf = FX_Alloc(uint8_t, src_size); FXSYS_memcpy(pSrcBuf, src_buf, src_size); - bool ret = true; + FX_BOOL ret = TRUE; if (predictor == 2) { ret = TIFF_PredictorEncode(pSrcBuf, src_size, Colors, BitsPerComponent, Columns); @@ -909,12 +909,12 @@ bool CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, FX_Free(pSrcBuf); return ret; } -bool CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) +FX_BOOL CCodec_FlateModule::Encode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_buf, FX_DWORD& dest_size) { dest_size = src_size + src_size / 1000 + 12; dest_buf = FX_Alloc( uint8_t, dest_size); unsigned long temp_size = dest_size; FPDFAPI_FlateCompress(dest_buf, &temp_size, src_buf, src_size); dest_size = (FX_DWORD)temp_size; - return true; + return TRUE; } diff --git a/core/src/fxcodec/codec/fx_codec_icc.cpp b/core/src/fxcodec/codec/fx_codec_icc.cpp index 0ccfe1fba6..7507fe5d6d 100644 --- a/core/src/fxcodec/codec/fx_codec_icc.cpp +++ b/core/src/fxcodec/codec/fx_codec_icc.cpp @@ -14,7 +14,7 @@ const FX_DWORD N_COMPONENT_RGB = 3; const FX_DWORD N_COMPONENT_CMYK = 4; const FX_DWORD N_COMPONENT_DEFAULT = 3; -bool MD5ComputeID( const void* buf, FX_DWORD dwSize, uint8_t ID[16] ) +FX_BOOL MD5ComputeID( const void* buf, FX_DWORD dwSize, uint8_t ID[16] ) { return cmsMD5computeIDExt(buf, dwSize, ID); } @@ -22,50 +22,50 @@ struct CLcmsCmm { cmsHTRANSFORM m_hTransform; int m_nSrcComponents; int m_nDstComponents; - bool m_bLab; + FX_BOOL m_bLab; }; extern "C" { int ourHandler(int ErrorCode, const char *ErrorText) { - return true; + return TRUE; } }; -bool CheckComponents(cmsColorSpaceSignature cs, int nComponents, bool bDst) +FX_BOOL CheckComponents(cmsColorSpaceSignature cs, int nComponents, FX_BOOL bDst) { if (nComponents <= 0 || nComponents > 15) { - return false; + return FALSE; } switch(cs) { case cmsSigLabData: if (nComponents < 3) { - return false; + return FALSE; } break; case cmsSigGrayData: if (bDst && nComponents != 1) { - return false; + return FALSE; } if (!bDst && nComponents > 2) { - return false; + return FALSE; } break; case cmsSigRgbData: if (bDst && nComponents != 3) { - return false; + return FALSE; } break; case cmsSigCmykData: if (bDst && nComponents != 4) { - return false; + return FALSE; } break; default: if (nComponents != 3) { - return false; + return FALSE; } break; } - return true; + return TRUE; } int32_t GetCSComponents(cmsColorSpaceSignature cs) { @@ -112,12 +112,12 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr return NULL; } int srcFormat; - bool bLab = false; + FX_BOOL bLab = FALSE; cmsColorSpaceSignature srcCS = cmsGetColorSpace(srcProfile); nSrcComponents = GetCSComponents(srcCS); if (srcCS == cmsSigLabData) { srcFormat = COLORSPACE_SH(PT_Lab) | CHANNELS_SH(nSrcComponents) | BYTES_SH(0); - bLab = true; + bLab = TRUE; } else { srcFormat = COLORSPACE_SH(PT_ANY) | CHANNELS_SH(nSrcComponents) | BYTES_SH(1); if (srcCS == cmsSigRgbData && T_DOSWAP(dwSrcFormat)) { @@ -125,7 +125,7 @@ void* IccLib_CreateTransform(const unsigned char* pSrcProfileData, FX_DWORD dwSr } } cmsColorSpaceSignature dstCS = cmsGetColorSpace(dstProfile); - if (!CheckComponents(dstCS, nDstComponents, true)) { + if (!CheckComponents(dstCS, nDstComponents, TRUE)) { cmsCloseProfile(srcProfile); cmsCloseProfile(dstProfile); return NULL; diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index c13a2f9526..51184306eb 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -26,28 +26,28 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) } pJbig2Content = NULL; } -bool CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, +FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch) { FXSYS_memset(dest_buf, 0, height * dest_pitch); CJBig2_Context* pContext = CJBig2_Context::CreateContext(&m_Module, (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); if (pContext == NULL) { - return false; + return FALSE; } int ret = pContext->getFirstPage(dest_buf, width, height, dest_pitch, NULL); CJBig2_Context::DestroyContext(pContext); if (ret != JBIG2_SUCCESS) { - return false; + return FALSE; } int dword_size = height * dest_pitch / 4; FX_DWORD* dword_buf = (FX_DWORD*)dest_buf; for (int i = 0; i < dword_size; i ++) { dword_buf[i] = ~dword_buf[i]; } - return true; + return TRUE; } -bool CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, +FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, FX_DWORD& width, FX_DWORD& height, FX_DWORD& pitch, uint8_t*& dest_buf) { CJBig2_Context* pContext = NULL; @@ -71,15 +71,15 @@ bool CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, height = (FX_DWORD)dest_image->m_nHeight; pitch = (FX_DWORD)dest_image->m_nStride; dest_buf = dest_image->m_pData; - dest_image->m_bNeedFree = false; + dest_image->m_bNeedFree = FALSE; delete dest_image; FX_Free(src_buf); - return true; + return TRUE; failed: if(src_buf) { FX_Free(src_buf); } - return false; + return FALSE; } FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, const uint8_t* src_buf, FX_DWORD src_size, const uint8_t* global_data, FX_DWORD global_size, uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) @@ -97,7 +97,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD wid m_pJbig2Context->m_dest_buf = dest_buf; m_pJbig2Context->m_dest_pitch = dest_pitch; m_pJbig2Context->m_pPause = pPause; - m_pJbig2Context->m_bFileReader = false; + m_pJbig2Context->m_bFileReader = FALSE; FXSYS_memset(dest_buf, 0, height * dest_pitch); m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext(&m_Module, (uint8_t*)global_data, global_size, (uint8_t*)src_buf, src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); @@ -127,7 +127,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead return FXCODEC_STATUS_ERR_PARAMS; } CCodec_Jbig2Context* m_pJbig2Context = (CCodec_Jbig2Context*)pJbig2Context; - m_pJbig2Context->m_bFileReader = true; + m_pJbig2Context->m_bFileReader = TRUE; m_pJbig2Context->m_dest_image = NULL; m_pJbig2Context->m_src_size = (FX_DWORD)file_ptr->GetSize(); m_pJbig2Context->m_src_buf = FX_Alloc(uint8_t, m_pJbig2Context->m_src_size); @@ -145,7 +145,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead height = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nHeight; pitch = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nStride; dest_buf = m_pJbig2Context->m_dest_image->m_pData; - m_pJbig2Context->m_dest_image->m_bNeedFree = false; + m_pJbig2Context->m_dest_image->m_bNeedFree = FALSE; return FXCODEC_STATUS_DECODE_TOBECONTINUE; } CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); @@ -157,7 +157,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, IFX_FileRead height = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nHeight; pitch = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nStride; dest_buf = m_pJbig2Context->m_dest_image->m_pData; - m_pJbig2Context->m_dest_image->m_bNeedFree = false; + m_pJbig2Context->m_dest_image->m_bNeedFree = FALSE; delete m_pJbig2Context->m_dest_image; FX_Free(m_pJbig2Context->m_src_buf); return FXCODEC_STATUS_DECODE_FINISH; diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp index 1ac2f03c04..6839d31509 100644 --- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp @@ -78,15 +78,15 @@ extern "C" { #define JPEG_MARKER_AUTHORTIME (JPEG_APP0 + 3) #define JPEG_MARKER_MAXSIZE 0xFFFF #define JPEG_OVERHEAD_LEN 14 -static bool _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, FX_DWORD icc_length) +static FX_BOOL _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_ptr, FX_DWORD icc_length) { if(icc_buf_ptr == NULL || icc_length == 0) { - return false; + return FALSE; } FX_DWORD icc_segment_size = (JPEG_MARKER_MAXSIZE - 2 - JPEG_OVERHEAD_LEN); FX_DWORD icc_segment_num = (icc_length / icc_segment_size) + 1; if (icc_segment_num > 255) { - return false; + return FALSE; } FX_DWORD icc_data_length = JPEG_OVERHEAD_LEN + (icc_segment_num > 1 ? icc_segment_size : icc_length); uint8_t* icc_data = FX_Alloc(uint8_t, icc_data_length); @@ -102,7 +102,7 @@ static bool _JpegEmbedIccProfile(j_compress_ptr cinfo, const uint8_t* icc_buf_pt FXSYS_memcpy(icc_data + JPEG_OVERHEAD_LEN, icc_buf_ptr + icc_size, icc_length - icc_size); jpeg_write_marker(cinfo, JPEG_MARKER_ICC, icc_data, JPEG_OVERHEAD_LEN + icc_length - icc_size); FX_Free(icc_data); - return true; + return TRUE; } extern "C" { static void _dest_do_nothing(j_compress_ptr cinfo) {} @@ -110,7 +110,7 @@ extern "C" { extern "C" { static boolean _dest_empty(j_compress_ptr cinfo) { - return false; + return FALSE; } }; #define JPEG_BLOCK_SIZE 1048576 @@ -178,9 +178,9 @@ static void _JpegEncode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STR } jpeg_set_defaults(&cinfo); if(quality != 75) { - jpeg_set_quality(&cinfo, quality, true); + jpeg_set_quality(&cinfo, quality, TRUE); } - jpeg_start_compress(&cinfo, true); + jpeg_start_compress(&cinfo, TRUE); _JpegEmbedIccProfile(&cinfo, icc_buf, icc_length); JSAMPROW row_pointer[1]; JDIMENSION row; @@ -221,8 +221,8 @@ static void _JpegEncode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STR } dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer; } -static bool _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, - int& num_components, int& bits_per_components, bool& color_transform, +static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, + int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { _JpegScanSOI(src_buf, src_size); @@ -238,7 +238,7 @@ static bool _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, jmp_buf mark; cinfo.client_data = &mark; if (setjmp(mark) == -1) { - return false; + return FALSE; } jpeg_create_decompress(&cinfo); struct jpeg_source_mgr src; @@ -252,15 +252,15 @@ static bool _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, cinfo.src = &src; if (setjmp(mark) == -1) { jpeg_destroy_decompress(&cinfo); - return false; + return FALSE; } if(icc_buf_ptr && icc_length) { jpeg_save_markers(&cinfo, JPEG_MARKER_ICC, JPEG_MARKER_MAXSIZE); } - int ret = jpeg_read_header(&cinfo, true); + int ret = jpeg_read_header(&cinfo, TRUE); if (ret != JPEG_HEADER_OK) { jpeg_destroy_decompress(&cinfo); - return false; + return FALSE; } width = cinfo.image_width; height = cinfo.image_height; @@ -274,21 +274,21 @@ static bool _JpegLoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, *icc_length = 0; } jpeg_destroy_decompress(&cinfo); - return true; + return TRUE; } class CCodec_JpegDecoder : public CCodec_ScanlineDecoder { public: CCodec_JpegDecoder(); ~CCodec_JpegDecoder(); - bool Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, - bool ColorTransform, IFX_JpegProvider* pJP); + FX_BOOL Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, int nComps, + FX_BOOL ColorTransform, IFX_JpegProvider* pJP); virtual void Destroy() { delete this; } virtual void v_DownScale(int dest_width, int dest_height); - virtual bool v_Rewind(); + virtual FX_BOOL v_Rewind(); virtual uint8_t* v_GetNextLine(); virtual FX_DWORD GetSrcOffset(); jmp_buf m_JmpBuf; @@ -298,8 +298,8 @@ public: const uint8_t* m_SrcBuf; FX_DWORD m_SrcSize; uint8_t* m_pScanlineBuf; - bool InitDecode(); - bool m_bInited, m_bStarted, m_bJpegTransform; + FX_BOOL InitDecode(); + FX_BOOL m_bInited, m_bStarted, m_bJpegTransform; protected: IFX_JpegProvider* m_pExtProvider; void* m_pExtContext; @@ -309,8 +309,8 @@ CCodec_JpegDecoder::CCodec_JpegDecoder() { m_pScanlineBuf = NULL; m_DownScale = 1; - m_bStarted = false; - m_bInited = false; + m_bStarted = FALSE; + m_bInited = FALSE; m_pExtProvider = NULL; m_pExtContext = NULL; FXSYS_memset(&cinfo, 0, sizeof(cinfo)); @@ -331,31 +331,31 @@ CCodec_JpegDecoder::~CCodec_JpegDecoder() jpeg_destroy_decompress(&cinfo); } } -bool CCodec_JpegDecoder::InitDecode() +FX_BOOL CCodec_JpegDecoder::InitDecode() { cinfo.err = &jerr; cinfo.client_data = &m_JmpBuf; if (setjmp(m_JmpBuf) == -1) { - return false; + return FALSE; } jpeg_create_decompress(&cinfo); - m_bInited = true; + m_bInited = TRUE; cinfo.src = &src; src.bytes_in_buffer = m_SrcSize; src.next_input_byte = m_SrcBuf; if (setjmp(m_JmpBuf) == -1) { jpeg_destroy_decompress(&cinfo); - m_bInited = false; - return false; + m_bInited = FALSE; + return FALSE; } cinfo.image_width = m_OrigWidth; cinfo.image_height = m_OrigHeight; - int ret = jpeg_read_header(&cinfo, true); + int ret = jpeg_read_header(&cinfo, TRUE); if (ret != JPEG_HEADER_OK) { - return false; + return FALSE; } if (cinfo.saw_Adobe_marker) { - m_bJpegTransform = true; + m_bJpegTransform = TRUE; } if (cinfo.num_components == 3 && !m_bJpegTransform) { cinfo.out_color_space = cinfo.jpeg_color_space; @@ -365,10 +365,10 @@ bool CCodec_JpegDecoder::InitDecode() m_OutputWidth = m_OrigWidth; m_OutputHeight = m_OrigHeight; m_nDefaultScaleDenom = cinfo.scale_denom; - return true; + return TRUE; } -bool CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, - int nComps, bool ColorTransform, IFX_JpegProvider* pJP) +FX_BOOL CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int width, int height, + int nComps, FX_BOOL ColorTransform, IFX_JpegProvider* pJP) { if (pJP) { m_pExtProvider = pJP; @@ -396,21 +396,21 @@ bool CCodec_JpegDecoder::Create(const uint8_t* src_buf, FX_DWORD src_size, int w m_OutputWidth = m_OrigWidth = width; m_OutputHeight = m_OrigHeight = height; if (!InitDecode()) { - return false; + return FALSE; } if (cinfo.num_components < nComps) { - return false; + return FALSE; } if ((int)cinfo.image_width < width) { - return false; + return FALSE; } m_Pitch = (cinfo.image_width * cinfo.num_components + 3) / 4 * 4; m_pScanlineBuf = FX_Alloc(uint8_t, m_Pitch); m_nComps = cinfo.num_components; m_bpc = 8; - m_bColorTransformed = false; - m_bStarted = false; - return true; + m_bColorTransformed = FALSE; + m_bStarted = FALSE; + return TRUE; } extern "C" { int32_t FX_GetDownsampleRatio(int32_t originWidth, int32_t originHeight, int32_t downsampleWidth, int32_t downsampleHeight) @@ -445,7 +445,7 @@ void CCodec_JpegDecoder::v_DownScale(int dest_width, int dest_height) m_NextLine = -1; } } -bool CCodec_JpegDecoder::v_Rewind() +FX_BOOL CCodec_JpegDecoder::v_Rewind() { if (m_pExtProvider) { return m_pExtProvider->Rewind(m_pExtContext); @@ -453,25 +453,25 @@ bool CCodec_JpegDecoder::v_Rewind() if (m_bStarted) { jpeg_destroy_decompress(&cinfo); if (!InitDecode()) { - return false; + return FALSE; } } if (setjmp(m_JmpBuf) == -1) { - return false; + return FALSE; } cinfo.scale_denom = m_nDefaultScaleDenom * m_DownScale; m_OutputWidth = (m_OrigWidth + m_DownScale - 1) / m_DownScale; m_OutputHeight = (m_OrigHeight + m_DownScale - 1) / m_DownScale; if (!jpeg_start_decompress(&cinfo)) { jpeg_destroy_decompress(&cinfo); - return false; + return FALSE; } if ((int)cinfo.output_width > m_OrigWidth) { - FXSYS_assert(false); - return false; + FXSYS_assert(FALSE); + return FALSE; } - m_bStarted = true; - return true; + m_bStarted = TRUE; + return TRUE; } uint8_t* CCodec_JpegDecoder::v_GetNextLine() { @@ -492,7 +492,7 @@ FX_DWORD CCodec_JpegDecoder::GetSrcOffset() return (FX_DWORD)(m_SrcSize - src.bytes_in_buffer); } ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size, - int width, int height, int nComps, bool ColorTransform) + int width, int height, int nComps, FX_BOOL ColorTransform) { if (src_buf == NULL || src_size == 0) { return NULL; @@ -504,8 +504,8 @@ ICodec_ScanlineDecoder* CCodec_JpegModule::CreateDecoder(const uint8_t* src_buf, } return pDecoder; } -bool CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, - int& num_components, int& bits_per_components, bool& color_transform, +FX_BOOL CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& width, int& height, + int& num_components, int& bits_per_components, FX_BOOL& color_transform, uint8_t** icc_buf_ptr, FX_DWORD* icc_length) { if (m_pExtProvider) { @@ -515,17 +515,17 @@ bool CCodec_JpegModule::LoadInfo(const uint8_t* src_buf, FX_DWORD src_size, int& } return _JpegLoadInfo(src_buf, src_size, width, height, num_components, bits_per_components, color_transform, icc_buf_ptr, icc_length); } -bool CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) +FX_BOOL CCodec_JpegModule::Encode(const CFX_DIBSource* pSource, uint8_t*& dest_buf, FX_STRSIZE& dest_size, int quality, const uint8_t* icc_buf, FX_DWORD icc_length) { if (m_pExtProvider) { return m_pExtProvider->Encode(pSource, dest_buf, dest_size, quality, icc_buf, icc_length); } if(pSource->GetBPP() < 8 || pSource->GetPalette() != NULL) { ASSERT(pSource->GetBPP() >= 8 && pSource->GetPalette() == NULL); - return false; + return FALSE; } _JpegEncode(pSource, dest_buf, dest_size, quality, icc_buf, icc_length); - return true; + return TRUE; } struct FXJPEG_Context { jmp_buf m_JumpMark; @@ -653,14 +653,14 @@ int CCodec_JpegModule::StartScanline(void* pContext, int down_scale) p->m_Info.scale_denom = down_scale; return jpeg_start_decompress(&p->m_Info); } -bool CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf) +FX_BOOL CCodec_JpegModule::ReadScanline(void* pContext, unsigned char* dest_buf) { if (m_pExtProvider) { return m_pExtProvider->ReadScanline(pContext, dest_buf); } FXJPEG_Context* p = (FXJPEG_Context*)pContext; if (setjmp(p->m_JumpMark) == -1) { - return false; + return FALSE; } int nlines = jpeg_read_scanlines(&p->m_Info, &dest_buf, 1); return nlines == 1; diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp index 92af626f25..2d395b0b4b 100644 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -587,17 +587,17 @@ class CJPX_Decoder public: CJPX_Decoder(); ~CJPX_Decoder(); - bool Init(const unsigned char* src_data, int src_size); + FX_BOOL Init(const unsigned char* src_data, int src_size); void GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps); - bool Decode(uint8_t* dest_buf, int pitch, bool bTranslateColor, uint8_t* offsets); + FX_BOOL Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets); const uint8_t* m_SrcData; int m_SrcSize; opj_image_t *image; opj_codec_t* l_codec; opj_stream_t *l_stream; - bool m_useColorSpace; + FX_BOOL m_useColorSpace; }; -CJPX_Decoder::CJPX_Decoder(): image(NULL), l_codec(NULL), l_stream(NULL), m_useColorSpace(false) +CJPX_Decoder::CJPX_Decoder(): image(NULL), l_codec(NULL), l_stream(NULL), m_useColorSpace(FALSE) { } CJPX_Decoder::~CJPX_Decoder() @@ -612,11 +612,11 @@ CJPX_Decoder::~CJPX_Decoder() opj_image_destroy(image); } } -bool CJPX_Decoder::Init(const unsigned char* src_data, int src_size) +FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, int src_size) { static const unsigned char szJP2Header[] = { 0x00, 0x00, 0x00, 0x0c, 0x6a, 0x50, 0x20, 0x20, 0x0d, 0x0a, 0x87, 0x0a }; if (!src_data || src_size < sizeof(szJP2Header)) { - return false; + return FALSE; } image = NULL; m_SrcData = src_data; @@ -624,7 +624,7 @@ bool CJPX_Decoder::Init(const unsigned char* src_data, int src_size) DecodeData srcData(const_cast(src_data), src_size); l_stream = fx_opj_stream_create_memory_stream(&srcData, OPJ_J2K_STREAM_CHUNK_SIZE, 1); if (l_stream == NULL) { - return false; + return FALSE; } opj_dparameters_t parameters; opj_set_default_decoder_parameters(¶meters); @@ -637,33 +637,33 @@ bool CJPX_Decoder::Init(const unsigned char* src_data, int src_size) l_codec = opj_create_decompress(OPJ_CODEC_J2K); } if(!l_codec) { - return false; + return FALSE; } opj_set_info_handler(l_codec, fx_info_callback, 00); opj_set_warning_handler(l_codec, fx_warning_callback, 00); opj_set_error_handler(l_codec, fx_error_callback, 00); if ( !opj_setup_decoder(l_codec, ¶meters) ) { - return false; + return FALSE; } if(! opj_read_header(l_stream, l_codec, &image)) { image = NULL; - return false; + return FALSE; } if (!parameters.nb_tile_to_decode) { if (!opj_set_decode_area(l_codec, image, parameters.DA_x0, parameters.DA_y0, parameters.DA_x1, parameters.DA_y1)) { opj_image_destroy(image); image = NULL; - return false; + return FALSE; } if (!(opj_decode(l_codec, l_stream, image) && opj_end_decompress(l_codec, l_stream))) { opj_image_destroy(image); image = NULL; - return false; + return FALSE; } } else { if (!opj_get_decoded_tile(l_codec, l_stream, image, parameters.tile_index)) { - return false; + return FALSE; } } opj_stream_destroy(l_stream); @@ -684,9 +684,9 @@ bool CJPX_Decoder::Init(const unsigned char* src_data, int src_size) image->icc_profile_len = 0; } if(!image) { - return false; + return FALSE; } - return true; + return TRUE; } void CJPX_Decoder::GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestream_nComps, FX_DWORD& output_nComps) { @@ -694,7 +694,7 @@ void CJPX_Decoder::GetInfo(FX_DWORD& width, FX_DWORD& height, FX_DWORD& codestre height = (FX_DWORD)image->y1; output_nComps = codestream_nComps = (FX_DWORD)image->numcomps; } -bool CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, bool bTranslateColor, uint8_t* offsets) +FX_BOOL CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { int i, wid, hei, row, col, channel, src; uint8_t* pChannel; @@ -702,14 +702,14 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, bool bTranslateColor, ui uint8_t* pPixel; if(image->comps[0].w != image->x1 || image->comps[0].h != image->y1) { - return false; + return FALSE; } if(pitch < (int)(image->comps[0].w * 8 * image->numcomps + 31) >> 5 << 2) { - return false; + return FALSE; } FXSYS_memset(dest_buf, 0xff, image->y1 * pitch); uint8_t** channel_bufs = FX_Alloc(uint8_t*, image->numcomps); - bool result = false; + FX_BOOL result = FALSE; int* adjust_comps = FX_Alloc(int, image->numcomps); for (i = 0; i < (int)image->numcomps; i ++) { channel_bufs[i] = dest_buf + offsets[i]; @@ -765,7 +765,7 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf, int pitch, bool bTranslateColor, ui } } } - result = true; + result = TRUE; done: FX_Free(channel_bufs); @@ -778,7 +778,7 @@ void initialize_sign_lut(); CCodec_JpxModule::CCodec_JpxModule() { } -void* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size , bool useColorSpace) +void* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf, FX_DWORD src_size , FX_BOOL useColorSpace) { CJPX_Decoder* pDecoder = new CJPX_Decoder; pDecoder->m_useColorSpace = useColorSpace; @@ -794,7 +794,7 @@ void CCodec_JpxModule::GetImageInfo(void* ctx, FX_DWORD& width, FX_DWORD& height CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; pDecoder->GetInfo(width, height, codestream_nComps, output_nComps); } -bool CCodec_JpxModule::Decode(void* ctx, uint8_t* dest_data, int pitch, bool bTranslateColor, uint8_t* offsets) +FX_BOOL CCodec_JpxModule::Decode(void* ctx, uint8_t* dest_data, int pitch, FX_BOOL bTranslateColor, uint8_t* offsets) { CJPX_Decoder* pDecoder = (CJPX_Decoder*)ctx; return pDecoder->Decode(dest_data, pitch, bTranslateColor, offsets); diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.h b/core/src/fxcodec/jbig2/JBig2_BitStream.h index fcd11f4ddf..ff0b9fcfeb 100644 --- a/core/src/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.h @@ -23,7 +23,7 @@ public: int32_t read1Bit(FX_DWORD *dwResult); - int32_t read1Bit(bool *bResult); + int32_t read1Bit(FX_BOOL *bResult); int32_t read1Byte(uint8_t *cResult); @@ -165,7 +165,7 @@ inline int32_t CJBig2_BitStream::read1Bit(FX_DWORD *dwResult) } } -inline int32_t CJBig2_BitStream::read1Bit(bool *bResult) +inline int32_t CJBig2_BitStream::read1Bit(FX_BOOL *bResult) { if(m_dwByteIdx < m_dwLength) { *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index 0b71c475c2..68c973547c 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -47,7 +47,7 @@ CJBig2_Context::CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, JBIG2_ALLOC(m_pSegmentList, CJBig2_List); JBIG2_ALLOC(m_pPageInfoList, CJBig2_List(1)); m_pPage = NULL; - m_bBufSpecified = false; + m_bBufSpecified = FALSE; m_pPause = pPause; m_nSegmentDecoded = 0; m_PauseStep = 10; @@ -231,11 +231,11 @@ int32_t CJBig2_Context::getFirstPage(uint8_t *pBuf, int32_t width, int32_t heigh return nRet; } } - m_bFirstPage = true; + m_bFirstPage = TRUE; m_PauseStep = 0; delete m_pPage; JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf)); - m_bBufSpecified = true; + m_bBufSpecified = TRUE; if(m_pPage && pPause && pPause->NeedToPauseNow()) { m_PauseStep = 1; m_ProcessiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; @@ -298,11 +298,11 @@ int32_t CJBig2_Context::Continue(IFX_Pause* pPause) int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause) { int32_t nRet = JBIG2_ERROR_STREAM_TYPE; - m_bFirstPage = false; + m_bFirstPage = FALSE; m_PauseStep = 0; delete m_pPage; JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf)); - m_bBufSpecified = true; + m_bBufSpecified = TRUE; if(m_pPage && pPause && pPause->NeedToPauseNow()) { m_PauseStep = 1; m_ProcessiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; @@ -330,7 +330,7 @@ int32_t CJBig2_Context::getNextPage(uint8_t *pBuf, int32_t width, int32_t height int32_t CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) { int32_t nRet; - m_bFirstPage = true; + m_bFirstPage = TRUE; m_PauseStep = 0; if(m_pGlobalContext) { nRet = m_pGlobalContext->decode_EmbedOrgnazation(pPause); @@ -338,14 +338,14 @@ int32_t CJBig2_Context::getFirstPage(CJBig2_Image **image, IFX_Pause* pPause) return nRet; } } - m_bBufSpecified = false; + m_bBufSpecified = FALSE; return Continue(pPause); } int32_t CJBig2_Context::getNextPage(CJBig2_Image **image, IFX_Pause* pPause) { int32_t nRet; - m_bBufSpecified = false; - m_bFirstPage = false; + m_bBufSpecified = FALSE; + m_bFirstPage = FALSE; m_PauseStep = 0; switch(m_nStreamType) { case JBIG2_FILE_STREAM: @@ -601,14 +601,14 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa CJBig2_HuffmanTable *Table_B1 = NULL, *Table_B2 = NULL, *Table_B3 = NULL, *Table_B4 = NULL, *Table_B5 = NULL; int32_t i, nIndex, nRet; CJBig2_Segment *pSeg = NULL, *pLRSeg = NULL; - bool bUsed; + FX_BOOL bUsed; CJBig2_Image ** SDINSYMS = NULL; CJBig2_SDDProc *pSymbolDictDecoder; JBig2ArithCtx *gbContext = NULL, *grContext = NULL; CJBig2_ArithDecoder *pArithDecoder; JBIG2_ALLOC(pSymbolDictDecoder, CJBig2_SDDProc()); uint8_t *key = pSegment->m_pData; - bool cache_hit = false; + FX_BOOL cache_hit = false; if(m_pStream->readShortInteger(&wFlags) != 0) { m_pModule->JBig2_Error("symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; @@ -825,16 +825,16 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa } } if(wFlags & 0x0200) { - pSegment->m_Result.sd->m_bContextRetained = true; + pSegment->m_Result.sd->m_bContextRetained = TRUE; if(pSymbolDictDecoder->SDHUFF == 0) { pSegment->m_Result.sd->m_gbContext = gbContext; } if(pSymbolDictDecoder->SDREFAGG == 1) { pSegment->m_Result.sd->m_grContext = grContext; } - bUsed = true; + bUsed = TRUE; } else { - bUsed = false; + bUsed = FALSE; } delete pSymbolDictDecoder; if(SDINSYMS) { @@ -845,7 +845,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPa delete Table_B3; delete Table_B4; delete Table_B5; - if(bUsed == false) { + if(bUsed == FALSE) { if(gbContext) { m_pModule->JBig2_Free(gbContext); } diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index 02d4192ee9..e6a0d7b3bc 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -123,13 +123,13 @@ private: CJBig2_Image *m_pPage; - bool m_bBufSpecified; + FX_BOOL m_bBufSpecified; int32_t m_nSegmentDecoded; IFX_Pause* m_pPause; int32_t m_PauseStep; FXCODEC_STATUS m_ProcessiveStatus; - bool m_bFirstPage; + FX_BOOL m_bFirstPage; CJBig2_ArithDecoder *m_pArithDecoder; CJBig2_GRDProc *m_pGRD; JBig2ArithCtx *m_gbContext; diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp index 1e338a5f60..cabcd4c634 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -101,7 +101,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2, line3; @@ -146,7 +146,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt(CJBig2_ArithDecoder *pA } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -213,7 +213,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -305,7 +305,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2, line3; @@ -352,7 +352,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_ArithDecoder * } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2, line3; @@ -397,7 +397,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt(CJBig2_ArithDecoder *pA } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -464,7 +464,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -555,7 +555,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2, line3; @@ -600,7 +600,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_ArithDecoder * } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2, line3; @@ -643,7 +643,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt(CJBig2_ArithDecoder *pA } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -710,7 +710,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -801,7 +801,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2, line3; @@ -844,7 +844,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_ArithDecoder * } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -883,7 +883,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt(CJBig2_ArithDecoder *pA } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; @@ -941,7 +941,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1; @@ -1017,7 +1017,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *p } CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_unopt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2; @@ -1056,7 +1056,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_unopt(CJBig2_ArithDecoder * } CJBig2_Image *CJBig2_GRDProc::decode_Arith_V2(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG; FX_DWORD line1, line2, line3; @@ -1195,7 +1195,7 @@ CJBig2_Image *CJBig2_GRDProc::decode_Arith_V2(CJBig2_ArithDecoder *pArithDecoder } CJBig2_Image *CJBig2_GRDProc::decode_Arith_V1(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT = 0; CJBig2_Image *GBREG; LTP = 0; @@ -1340,7 +1340,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode(CJBig2_ArithDecoder *pArithDecoder, JBig2A } CJBig2_Image *CJBig2_GRRDProc::decode_Template0_unopt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line2, line3, line4, line5; @@ -1424,7 +1424,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_unopt(CJBig2_ArithDecoder *pArit } CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; @@ -1459,9 +1459,9 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD } line1 = (h > 0) ? pLine[-nStride] << 4 : 0; int32_t reference_h = h - GRREFERENCEDY; - bool line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); - bool line2_r_ok = (reference_h > -1 && reference_h < GRHR); - bool line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); + FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); + FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); + FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); line1_r = line1_r_ok ? pLineR[nOffset - nStrideR] : 0; line2_r = line2_r_ok ? pLineR[nOffset] : 0; line3_r = line3_r_ok ? pLineR[nOffset + nStrideR] : 0; @@ -1555,7 +1555,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD } CJBig2_Image *CJBig2_GRRDProc::decode_Template1_unopt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line2, line3, line4, line5; @@ -1633,7 +1633,7 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_unopt(CJBig2_ArithDecoder *pArit } CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext) { - bool LTP, SLTP, bVal; + FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; @@ -1668,9 +1668,9 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD } line1 = (h > 0) ? pLine[-nStride] << 1 : 0; int32_t reference_h = h - GRREFERENCEDY; - bool line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); - bool line2_r_ok = (reference_h > -1 && reference_h < GRHR); - bool line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); + FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); + FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); + FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); line1_r = line1_r_ok ? pLineR[nOffset - nStrideR] : 0; line2_r = line2_r_ok ? pLineR[nOffset] : 0; line3_r = line3_r_ok ? pLineR[nOffset + nStrideR] : 0; @@ -1758,8 +1758,8 @@ CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD } CJBig2_Image *CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext) { - bool LTP, SLTP, bVal; - bool TPGRPIX, TPGRVAL; + FX_BOOL LTP, SLTP, bVal; + FX_BOOL TPGRPIX, TPGRVAL; FX_DWORD CONTEXT; CJBig2_Image *GRREG; LTP = 0; @@ -1881,12 +1881,12 @@ CJBig2_Image *CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream *pStream, JBig2Ari CJBig2_Image *IBI; FX_DWORD WI, HI; int32_t IDS; - bool RI; + FX_BOOL RI; int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; - bool bFirst; + FX_BOOL bFirst; FX_DWORD nTmp; int32_t nVal, nBits; CJBig2_HuffmanDecoder *pHuffmanDecoder; @@ -1910,7 +1910,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream *pStream, JBig2Ari } DT *= SBSTRIPS; STRIPT = STRIPT + DT; - bFirst = true; + bFirst = TRUE; for(;;) { if(bFirst) { if(pHuffmanDecoder->decodeAValue(SBHUFFFS, &DFS) != 0) { @@ -1919,7 +1919,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream *pStream, JBig2Ari } FIRSTS = FIRSTS + DFS; CURS = FIRSTS; - bFirst = false; + bFirst = FALSE; } else { nVal = pHuffmanDecoder->decodeAValue(SBHUFFDS, &IDS); if(nVal == JBIG2_OOB) { @@ -2106,7 +2106,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J CJBig2_Image *IBOI; FX_DWORD WOI, HOI; CJBig2_Image *SBREG; - bool bFirst; + FX_BOOL bFirst; int32_t nRet, nVal; int32_t bRetained; CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, *IARDX, *IARDY; @@ -2123,7 +2123,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J IARDX = pIDS->IARDX; IARDY = pIDS->IARDY; IAID = pIDS->IAID; - bRetained = true; + bRetained = TRUE; } else { JBIG2_ALLOC(IADT, CJBig2_ArithIntDecoder()); JBIG2_ALLOC(IAFS, CJBig2_ArithIntDecoder()); @@ -2135,7 +2135,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J JBIG2_ALLOC(IARDX, CJBig2_ArithIntDecoder()); JBIG2_ALLOC(IARDY, CJBig2_ArithIntDecoder()); JBIG2_ALLOC(IAID , CJBig2_ArithIaidDecoder(SBSYMCODELEN)); - bRetained = false; + bRetained = FALSE; } JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH)); SBREG->fill(SBDEFPIXEL); @@ -2154,7 +2154,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J } DT *= SBSTRIPS; STRIPT = STRIPT + DT; - bFirst = true; + bFirst = TRUE; for(;;) { if(bFirst) { if(IAFS->decode(pArithDecoder, &DFS) == -1) { @@ -2163,7 +2163,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J } FIRSTS = FIRSTS + DFS; CURS = FIRSTS; - bFirst = false; + bFirst = FALSE; } else { nRet = IADS->decode(pArithDecoder, &IDS); if(nRet == JBIG2_OOB) { @@ -2299,7 +2299,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J NINSTANCES = NINSTANCES + 1; } } - if(bRetained == false) { + if(bRetained == FALSE) { delete IADT; delete IAFS; delete IADS; @@ -2313,7 +2313,7 @@ CJBig2_Image *CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, J } return SBREG; failed: - if(bRetained == false) { + if(bRetained == FALSE) { delete IADT; delete IAFS; delete IADS; @@ -2338,9 +2338,9 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod int32_t DW; CJBig2_Image *BS; FX_DWORD I, J, REFAGGNINST; - bool *EXFLAGS; + FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; - bool CUREXFLAG; + FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; int32_t nVal; FX_DWORD nTmp; @@ -2585,7 +2585,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod } EXINDEX = 0; CUREXFLAG = 0; - EXFLAGS = (bool*)m_pModule->JBig2_Malloc2(sizeof(bool), (SDNUMINSYMS + SDNUMNEWSYMS)); + EXFLAGS = (FX_BOOL*)m_pModule->JBig2_Malloc2(sizeof(FX_BOOL), (SDNUMINSYMS + SDNUMNEWSYMS)); while(EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { if(IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH) == -1) { m_pModule->JBig2_Free(EXFLAGS); @@ -2676,9 +2676,9 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, int32_t DW; CJBig2_Image *BS, *BHC; FX_DWORD I, J, REFAGGNINST; - bool *EXFLAGS; + FX_BOOL *EXFLAGS; FX_DWORD EXINDEX; - bool CUREXFLAG; + FX_BOOL CUREXFLAG; FX_DWORD EXRUNLENGTH; int32_t nVal, nBits; FX_DWORD nTmp; @@ -2976,7 +2976,7 @@ CJBig2_SymbolDict *CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream *pStream, CUREXFLAG = 0; JBIG2_ALLOC(pTable, CJBig2_HuffmanTable(HuffmanTable_B1, sizeof(HuffmanTable_B1) / sizeof(JBig2TableLine), HuffmanTable_HTOOB_B1)); - EXFLAGS = (bool*)m_pModule->JBig2_Malloc2(sizeof(bool), (SDNUMINSYMS + SDNUMNEWSYMS)); + EXFLAGS = (FX_BOOL*)m_pModule->JBig2_Malloc2(sizeof(FX_BOOL), (SDNUMINSYMS + SDNUMNEWSYMS)); while(EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { if(pHuffmanDecoder->decodeAValue(pTable, (int*)&EXRUNLENGTH) != 0) { delete pTable; @@ -3477,7 +3477,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith_V2(CJBig2_Image** pImage, CJBi } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V2(IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; CJBig2_Image *GBREG = *m_pImage; FX_DWORD line1, line2, line3; @@ -3650,7 +3650,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith_V1(CJBig2_Image** pImage, CJBi } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V1(IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT = 0; CJBig2_Image *GBREG = (*m_pImage); for(; m_loopIndex < GBH; m_loopIndex++) { @@ -3799,7 +3799,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; uint8_t *pLine1, *pLine2, cVal; @@ -3891,7 +3891,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; for(; m_loopIndex < GBH; m_loopIndex++) { @@ -3940,7 +3940,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_Image * pImag } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; uint8_t *pLine1, *pLine2, cVal; @@ -4031,7 +4031,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; for(FX_DWORD h = 0; h < GBH; h++) { @@ -4078,7 +4078,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_Image * pImag } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; uint8_t *pLine1, *pLine2, cVal; @@ -4169,7 +4169,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; for(; m_loopIndex < GBH; m_loopIndex++) { @@ -4214,7 +4214,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_Image * pImag } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1; uint8_t *pLine1, cVal; @@ -4290,7 +4290,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, } FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt(CJBig2_Image * pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause) { - bool SLTP, bVal; + FX_BOOL SLTP, bVal; FX_DWORD CONTEXT; FX_DWORD line1, line2; for(; m_loopIndex < GBH; m_loopIndex++) { diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h index f348e96546..2bd2ceac95 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h @@ -76,7 +76,7 @@ private: CJBig2_ArithDecoder *m_pArithDecoder; JBig2ArithCtx *m_gbContext; FX_WORD m_DecodeType; - bool LTP; + FX_BOOL LTP; FX_RECT m_ReplaceRect; private: @@ -112,12 +112,12 @@ private: CJBig2_Image *decode_Arith_Template3_unopt(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext); public: - bool MMR; + FX_BOOL MMR; FX_DWORD GBW; FX_DWORD GBH; uint8_t GBTEMPLATE; - bool TPGDON; - bool USESKIP; + FX_BOOL TPGDON; + FX_BOOL USESKIP; CJBig2_Image * SKIP; signed char GBAT[8]; }; @@ -139,11 +139,11 @@ public: public: FX_DWORD GRW; FX_DWORD GRH; - bool GRTEMPLATE; + FX_BOOL GRTEMPLATE; CJBig2_Image *GRREFERENCE; int32_t GRREFERENCEDX; int32_t GRREFERENCEDY; - bool TPGRON; + FX_BOOL TPGRON; signed char GRAT[4]; }; typedef struct { @@ -167,8 +167,8 @@ public: CJBig2_Image *decode_Arith(CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *grContext, JBig2IntDecoderState *pIDS = NULL); public: - bool SBHUFF; - bool SBREFINE; + FX_BOOL SBHUFF; + FX_BOOL SBREFINE; FX_DWORD SBW; FX_DWORD SBH; FX_DWORD SBNUMINSTANCES; @@ -179,10 +179,10 @@ public: uint8_t SBSYMCODELEN; CJBig2_Image **SBSYMS; - bool SBDEFPIXEL; + FX_BOOL SBDEFPIXEL; JBig2ComposeOp SBCOMBOP; - bool TRANSPOSED; + FX_BOOL TRANSPOSED; JBig2Corner REFCORNER; signed char SBDSOFFSET; @@ -194,7 +194,7 @@ public: *SBHUFFRDX, *SBHUFFRDY, *SBHUFFRSIZE; - bool SBRTEMPLATE; + FX_BOOL SBRTEMPLATE; signed char SBRAT[4]; }; class CJBig2_SDDProc : public CJBig2_Object @@ -205,8 +205,8 @@ public: CJBig2_SymbolDict *decode_Huffman(CJBig2_BitStream *pStream, JBig2ArithCtx *gbContext, JBig2ArithCtx *grContext, IFX_Pause* pPause); public: - bool SDHUFF; - bool SDREFAGG; + FX_BOOL SDHUFF; + FX_BOOL SDREFAGG; FX_DWORD SDNUMINSYMS; CJBig2_Image ** SDINSYMS; FX_DWORD SDNUMNEWSYMS; @@ -217,7 +217,7 @@ public: *SDHUFFAGGINST; uint8_t SDTEMPLATE; signed char SDAT[8]; - bool SDRTEMPLATE; + FX_BOOL SDRTEMPLATE; signed char SDRAT[4]; }; class CJBig2_HTRDProc : public CJBig2_Object @@ -230,13 +230,13 @@ public: public: FX_DWORD HBW, HBH; - bool HMMR; + FX_BOOL HMMR; uint8_t HTEMPLATE; FX_DWORD HNUMPATS; CJBig2_Image **HPATS; - bool HDEFPIXEL; + FX_BOOL HDEFPIXEL; JBig2ComposeOp HCOMBOP; - bool HENABLESKIP; + FX_BOOL HENABLESKIP; FX_DWORD HGW, HGH; int32_t HGX, @@ -254,7 +254,7 @@ public: CJBig2_PatternDict *decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause); public: - bool HDMMR; + FX_BOOL HDMMR; uint8_t HDPW, HDPH; FX_DWORD GRAYMAX; @@ -268,8 +268,8 @@ public: FX_DWORD *decode_MMR(CJBig2_BitStream *pStream, IFX_Pause* pPause); public: - bool GSMMR; - bool GSUSESKIP; + FX_BOOL GSMMR; + FX_BOOL GSUSESKIP; uint8_t GSBPP; FX_DWORD GSW, GSH; diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp index 4932e571f2..0616123c1e 100644 --- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp +++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp @@ -9,7 +9,7 @@ #include CJBig2_HuffmanTable::CJBig2_HuffmanTable(const JBig2TableLine *pTable, int nLines, - bool bHTOOB) + FX_BOOL bHTOOB) { init(); m_bOK = parseFromStandardTable(pTable, nLines, bHTOOB); @@ -38,14 +38,14 @@ CJBig2_HuffmanTable::~CJBig2_HuffmanTable() } void CJBig2_HuffmanTable::init() { - HTOOB = false; + HTOOB = FALSE; NTEMP = 0; CODES = NULL; PREFLEN = NULL; RANGELEN = NULL; RANGELOW = NULL; } -int CJBig2_HuffmanTable::parseFromStandardTable(const JBig2TableLine *pTable, int nLines, bool bHTOOB) +int CJBig2_HuffmanTable::parseFromStandardTable(const JBig2TableLine *pTable, int nLines, FX_BOOL bHTOOB) { int CURLEN, LENMAX, CURCODE, CURTEMP, i; int *LENCOUNT; @@ -188,7 +188,7 @@ int CJBig2_HuffmanTable::parseFromCodedBuffer(CJBig2_BitStream *pStream) } m_pModule->JBig2_Free(LENCOUNT); m_pModule->JBig2_Free(FIRSTCODE); - return true; + return TRUE; failed: - return false; + return FALSE; } diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h index d6bc3d1c4b..d68ced2fca 100644 --- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h +++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h @@ -13,7 +13,7 @@ class CJBig2_HuffmanTable : public CJBig2_Object { public: - CJBig2_HuffmanTable(const JBig2TableLine *pTable, int nLines, bool bHTOOB); + CJBig2_HuffmanTable(const JBig2TableLine *pTable, int nLines, FX_BOOL bHTOOB); CJBig2_HuffmanTable(CJBig2_BitStream *pStream); @@ -21,22 +21,22 @@ public: void init(); - int parseFromStandardTable(const JBig2TableLine *pTable, int nLines, bool bHTOOB); + int parseFromStandardTable(const JBig2TableLine *pTable, int nLines, FX_BOOL bHTOOB); int parseFromCodedBuffer(CJBig2_BitStream *pStream); - bool isOK() + FX_BOOL isOK() { return m_bOK; } private: - bool HTOOB; + FX_BOOL HTOOB; int NTEMP; int *CODES; int *PREFLEN; int *RANGELEN; int *RANGELOW; - bool m_bOK; + FX_BOOL m_bOK; friend class CJBig2_HuffmanDecoder; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h b/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h index c08d2456d4..428b2c3671 100644 --- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h +++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h @@ -11,7 +11,7 @@ typedef struct { int RANDELEN; int RANGELOW; } JBig2TableLine; -const bool HuffmanTable_HTOOB_B1 = false; +const FX_BOOL HuffmanTable_HTOOB_B1 = FALSE; const JBig2TableLine HuffmanTable_B1[] = { { 1, 4, 0 }, { 2, 8, 16 }, @@ -19,7 +19,7 @@ const JBig2TableLine HuffmanTable_B1[] = { { 0, 32, -1 }, { 3, 32, 65808 } }; -const bool HuffmanTable_HTOOB_B2 = true; +const FX_BOOL HuffmanTable_HTOOB_B2 = TRUE; const JBig2TableLine HuffmanTable_B2[] = { { 1, 0, 0 }, { 2, 0, 1 }, @@ -30,7 +30,7 @@ const JBig2TableLine HuffmanTable_B2[] = { { 6, 32, 75 }, { 6, 0, 0 } }; -const bool HuffmanTable_HTOOB_B3 = true; +const FX_BOOL HuffmanTable_HTOOB_B3 = TRUE; const JBig2TableLine HuffmanTable_B3[] = { { 8, 8, -256 }, { 1, 0, 0 }, @@ -42,7 +42,7 @@ const JBig2TableLine HuffmanTable_B3[] = { { 7, 32, 75 }, { 6, 0, 0 } }; -const bool HuffmanTable_HTOOB_B4 = false; +const FX_BOOL HuffmanTable_HTOOB_B4 = FALSE; const JBig2TableLine HuffmanTable_B4[] = { { 1, 0, 1 }, { 2, 0, 2 }, @@ -52,7 +52,7 @@ const JBig2TableLine HuffmanTable_B4[] = { { 0, 32, -1 }, { 5, 32, 76 }, }; -const bool HuffmanTable_HTOOB_B5 = false; +const FX_BOOL HuffmanTable_HTOOB_B5 = FALSE; const JBig2TableLine HuffmanTable_B5[] = { { 7, 8, -255 }, { 1, 0, 1 }, @@ -63,7 +63,7 @@ const JBig2TableLine HuffmanTable_B5[] = { { 7, 32, -256 }, { 6, 32, 76 } }; -const bool HuffmanTable_HTOOB_B6 = false; +const FX_BOOL HuffmanTable_HTOOB_B6 = FALSE; const JBig2TableLine HuffmanTable_B6[] = { { 5, 10, -2048 }, { 4, 9, -1024 }, @@ -80,7 +80,7 @@ const JBig2TableLine HuffmanTable_B6[] = { { 6, 32, -2049 }, { 6, 32, 2048 } }; -const bool HuffmanTable_HTOOB_B7 = false; +const FX_BOOL HuffmanTable_HTOOB_B7 = FALSE; const JBig2TableLine HuffmanTable_B7[] = { { 4, 9, -1024 }, { 3, 8, -512 }, @@ -98,7 +98,7 @@ const JBig2TableLine HuffmanTable_B7[] = { { 5, 32, -1025 }, { 5, 32, 2048 }, }; -const bool HuffmanTable_HTOOB_B8 = true; +const FX_BOOL HuffmanTable_HTOOB_B8 = TRUE; const JBig2TableLine HuffmanTable_B8[] = { { 8, 3, -15 }, { 9, 1, -7 }, @@ -122,7 +122,7 @@ const JBig2TableLine HuffmanTable_B8[] = { { 9, 32, 1670 }, { 2, 0, 0 } }; -const bool HuffmanTable_HTOOB_B9 = true; +const FX_BOOL HuffmanTable_HTOOB_B9 = TRUE; const JBig2TableLine HuffmanTable_B9[] = { { 8, 4, -31 }, { 9, 2, -15 }, @@ -147,7 +147,7 @@ const JBig2TableLine HuffmanTable_B9[] = { { 9, 32, 3339 }, { 2, 0, 0 } }; -const bool HuffmanTable_HTOOB_B10 = true; +const FX_BOOL HuffmanTable_HTOOB_B10 = TRUE; const JBig2TableLine HuffmanTable_B10[] = { { 7, 4, -21 }, { 8, 0, -5 }, @@ -171,7 +171,7 @@ const JBig2TableLine HuffmanTable_B10[] = { { 8, 32, 4166 }, { 2, 0, 0 } }; -const bool HuffmanTable_HTOOB_B11 = false; +const FX_BOOL HuffmanTable_HTOOB_B11 = FALSE; const JBig2TableLine HuffmanTable_B11[] = { { 1, 0, 1 }, { 2, 1, 2 }, @@ -188,7 +188,7 @@ const JBig2TableLine HuffmanTable_B11[] = { { 0, 32, 0 }, { 7, 32, 141 } }; -const bool HuffmanTable_HTOOB_B12 = false; +const FX_BOOL HuffmanTable_HTOOB_B12 = FALSE; const JBig2TableLine HuffmanTable_B12[] = { { 1, 0, 1 }, { 2, 0, 2 }, @@ -205,7 +205,7 @@ const JBig2TableLine HuffmanTable_B12[] = { { 0, 32, 0 }, { 8, 32, 73 } }; -const bool HuffmanTable_HTOOB_B13 = false; +const FX_BOOL HuffmanTable_HTOOB_B13 = FALSE; const JBig2TableLine HuffmanTable_B13[] = { { 1, 0, 1 }, { 3, 0, 2 }, @@ -222,7 +222,7 @@ const JBig2TableLine HuffmanTable_B13[] = { { 0, 32, 0 }, { 7, 32, 141 } }; -const bool HuffmanTable_HTOOB_B14 = false; +const FX_BOOL HuffmanTable_HTOOB_B14 = FALSE; const JBig2TableLine HuffmanTable_B14[] = { { 3, 0, -2 }, { 3, 0, -1 }, @@ -232,7 +232,7 @@ const JBig2TableLine HuffmanTable_B14[] = { { 0, 32, -3 }, { 0, 32, 3 } }; -const bool HuffmanTable_HTOOB_B15 = false; +const FX_BOOL HuffmanTable_HTOOB_B15 = FALSE; const JBig2TableLine HuffmanTable_B15[] = { { 7, 4, -24 }, { 6, 2, -8 }, diff --git a/core/src/fxcodec/jbig2/JBig2_Image.cpp b/core/src/fxcodec/jbig2/JBig2_Image.cpp index 030b0c2493..9ef4464ef0 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Image.cpp @@ -16,7 +16,7 @@ CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) m_nHeight = h; if (m_nWidth <= 0 || m_nHeight <= 0 || m_nWidth > INT_MAX - 31) { m_pData = NULL; - m_bNeedFree = false; + m_bNeedFree = FALSE; return; } m_nStride = ((w + 31) >> 5) << 2; @@ -25,7 +25,7 @@ CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) } else { m_pData = NULL; } - m_bNeedFree = true; + m_bNeedFree = TRUE; } CJBig2_Image::CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf) { @@ -33,7 +33,7 @@ CJBig2_Image::CJBig2_Image(int32_t w, int32_t h, int32_t stride, uint8_t*pBuf) m_nHeight = h; m_nStride = stride; m_pData = pBuf; - m_bNeedFree = false; + m_bNeedFree = FALSE; } CJBig2_Image::CJBig2_Image(CJBig2_Image &im) { @@ -47,7 +47,7 @@ CJBig2_Image::CJBig2_Image(CJBig2_Image &im) } else { m_pData = NULL; } - m_bNeedFree = true; + m_bNeedFree = TRUE; } CJBig2_Image::~CJBig2_Image() { @@ -55,7 +55,7 @@ CJBig2_Image::~CJBig2_Image() m_pModule->JBig2_Free(m_pData); } } -bool CJBig2_Image::getPixel(int32_t x, int32_t y) +FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) { if (!m_pData) { return 0; @@ -72,7 +72,7 @@ bool CJBig2_Image::getPixel(int32_t x, int32_t y) return ((m_pData[m] >> (7 - n)) & 1); } -int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, bool v) +int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, FX_BOOL v) { if (!m_pData) { return 0; @@ -104,31 +104,31 @@ void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) JBIG2_memcpy(m_pData + hTo * m_nStride, m_pData + hFrom * m_nStride, m_nStride); } } -void CJBig2_Image::fill(bool v) +void CJBig2_Image::fill(FX_BOOL v) { if (!m_pData) { return; } JBIG2_memset(m_pData, v ? 0xff : 0, m_nStride * m_nHeight); } -bool CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { if (!m_pData) { - return false; + return FALSE; } return composeTo_opt2(pDst, x, y, op); } -bool CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { - return false; + return FALSE; } if (NULL == pSrcRect || *pSrcRect == FX_RECT(0, 0, m_nWidth, m_nHeight)) { return composeTo_opt2(pDst, x, y, op); } return composeTo_opt2(pDst, x, y, op, pSrcRect); } -bool CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { int32_t w, h, dx, dy; int32_t i, j; @@ -192,17 +192,17 @@ bool CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBi } break; } - return true; + return TRUE; } -bool CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { int32_t x0, x1, y0, y1, xx, yy; uint8_t *pLineSrc, *pLineDst, *srcPtr, *destPtr; FX_DWORD src0, src1, src, dest, s1, s2, m1, m2, m3; - bool oneByte; + FX_BOOL oneByte; if (!m_pData) { - return false; + return FALSE; } if (y < 0) { y0 = -y; @@ -215,7 +215,7 @@ bool CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2 y1 = m_nHeight; } if (y0 >= y1) { - return false; + return FALSE; } if (x >= 0) { x0 = x & ~7; @@ -227,7 +227,7 @@ bool CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2 x1 = pDst->m_nWidth; } if (x0 >= x1) { - return false; + return FALSE; } s1 = x & 7; s2 = 8 - s1; @@ -679,19 +679,19 @@ bool CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2 } } } - return true; + return TRUE; } -bool CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op) { if (!m_pData) { - return false; + return FALSE; } return pSrc->composeTo(this, x, y, op); } -bool CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect) { if (!m_pData) { - return false; + return FALSE; } return pSrc->composeTo(this, x, y, op, pSrcRect); } @@ -765,7 +765,7 @@ CJBig2_Image *CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) } return pImage; } -void CJBig2_Image::expand(int32_t h, bool v) +void CJBig2_Image::expand(int32_t h, FX_BOOL v) { if (!m_pData || h <= m_nHeight) { return; @@ -788,7 +788,7 @@ void CJBig2_Image::expand(int32_t h, bool v) JBIG2_memset(m_pData + dwHeight * dwStride, v ? 0xff : 0, (dwH - dwHeight) * dwStride); m_nHeight = h; } -bool CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) { int32_t xs0 = 0, ys0 = 0, xs1 = 0, ys1 = 0, xd0 = 0, yd0 = 0, xd1 = 0, yd1 = 0, xx = 0, yy = 0, w = 0, h = 0, middleDwords = 0, lineLeft = 0; @@ -799,10 +799,10 @@ bool CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig uint8_t *lineSrc = NULL, *lineDst = NULL, *sp = NULL, *dp = NULL; if (!m_pData) { - return false; + return FALSE; } if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576) { - return false; + return FALSE; } if(y < 0) { ys0 = -y; @@ -1205,17 +1205,17 @@ bool CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig } return 1; } -bool CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) +FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect) { int32_t xs0, ys0, xs1, ys1, xd0, yd0, xd1, yd1, xx, yy, w, h, middleDwords, lineLeft; FX_DWORD s1, d1, d2, shift, shift1, shift2, tmp, tmp1, tmp2, maskL, maskR, maskM; uint8_t *lineSrc, *lineDst, *sp, *dp; int32_t sw, sh; if (!m_pData) { - return false; + return FALSE; } if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576) { - return false; + return FALSE; } sw = pSrcRect->Width(); sh = pSrcRect->Height(); diff --git a/core/src/fxcodec/jbig2/JBig2_Image.h b/core/src/fxcodec/jbig2/JBig2_Image.h index d51d99907d..423bebcede 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.h +++ b/core/src/fxcodec/jbig2/JBig2_Image.h @@ -28,31 +28,31 @@ public: ~CJBig2_Image(); - bool getPixel(int32_t x, int32_t y); + FX_BOOL getPixel(int32_t x, int32_t y); - int32_t setPixel(int32_t x, int32_t y, bool v); + int32_t setPixel(int32_t x, int32_t y, FX_BOOL v); void copyLine(int32_t hTo, int32_t hFrom); - void fill(bool v); + void fill(FX_BOOL v); - bool composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - bool composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - bool composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - bool composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - bool composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); - bool composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op); + FX_BOOL composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op, const FX_RECT* pSrcRect); - bool composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op); - bool composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op); + FX_BOOL composeFrom(int32_t x, int32_t y, CJBig2_Image *pSrc, JBig2ComposeOp op, const FX_RECT* pSrcRect); CJBig2_Image *subImage_unopt(int32_t x, int32_t y, int32_t w, int32_t h); CJBig2_Image *subImage(int32_t x, int32_t y, int32_t w, int32_t h); - void expand(int32_t h, bool v); + void expand(int32_t h, FX_BOOL v); public: int32_t m_nWidth; @@ -63,6 +63,6 @@ public: uint8_t *m_pData; - bool m_bNeedFree; + FX_BOOL m_bNeedFree; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_Page.h b/core/src/fxcodec/jbig2/JBig2_Page.h index b4e159f2a2..b07eba8a3a 100644 --- a/core/src/fxcodec/jbig2/JBig2_Page.h +++ b/core/src/fxcodec/jbig2/JBig2_Page.h @@ -13,7 +13,7 @@ struct JBig2PageInfo : public CJBig2_Object { FX_DWORD m_dwResolutionX, m_dwResolutionY; uint8_t m_cFlags; - bool m_bIsStriped; + FX_BOOL m_bIsStriped; FX_WORD m_wMaxStripeSize; }; #endif diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp index c10d461623..0e5b92ff5a 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp @@ -9,7 +9,7 @@ CJBig2_SymbolDict::CJBig2_SymbolDict() { SDNUMEXSYMS = 0; SDEXSYMS = NULL; - m_bContextRetained = false; + m_bContextRetained = FALSE; m_gbContext = m_grContext = NULL; } diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h index 5f94dc7be8..9156e30ea8 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h @@ -19,7 +19,7 @@ public: public: FX_DWORD SDNUMEXSYMS; CJBig2_Image **SDEXSYMS; - bool m_bContextRetained; + FX_BOOL m_bContextRetained; JBig2ArithCtx *m_gbContext, *m_grContext; }; -- cgit v1.2.3