From 12f3e4a58f05850b93af35619cb04f0231d86acc Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 2 Nov 2016 15:17:29 -0700 Subject: Remove FX_BOOL from core Review-Url: https://codereview.chromium.org/2477443002 --- core/fxcodec/jbig2/JBig2_BitStream.cpp | 2 +- core/fxcodec/jbig2/JBig2_BitStream.h | 2 +- core/fxcodec/jbig2/JBig2_Context.cpp | 6 +-- core/fxcodec/jbig2/JBig2_GrdProc.h | 6 +-- core/fxcodec/jbig2/JBig2_GrrdProc.h | 2 +- core/fxcodec/jbig2/JBig2_GsidProc.h | 4 +- core/fxcodec/jbig2/JBig2_HtrdProc.h | 6 +-- core/fxcodec/jbig2/JBig2_Image.cpp | 74 +++++++++++++++++----------------- core/fxcodec/jbig2/JBig2_Image.h | 48 ++++++++++------------ core/fxcodec/jbig2/JBig2_Page.h | 2 +- core/fxcodec/jbig2/JBig2_PddProc.h | 2 +- core/fxcodec/jbig2/JBig2_SddProc.cpp | 12 +++--- core/fxcodec/jbig2/JBig2_SddProc.h | 4 +- core/fxcodec/jbig2/JBig2_TrdProc.cpp | 2 +- core/fxcodec/jbig2/JBig2_TrdProc.h | 8 ++-- 15 files changed, 87 insertions(+), 93 deletions(-) (limited to 'core/fxcodec/jbig2') diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp index b5dfe92cda..dc4beabc4b 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.cpp +++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp @@ -73,7 +73,7 @@ int32_t CJBig2_BitStream::read1Bit(uint32_t* dwResult) { return 0; } -int32_t CJBig2_BitStream::read1Bit(FX_BOOL* bResult) { +int32_t CJBig2_BitStream::read1Bit(bool* bResult) { if (!IsInBound()) return -1; diff --git a/core/fxcodec/jbig2/JBig2_BitStream.h b/core/fxcodec/jbig2/JBig2_BitStream.h index 24e8faaf5b..aeb2eba693 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/fxcodec/jbig2/JBig2_BitStream.h @@ -20,7 +20,7 @@ class CJBig2_BitStream { int32_t readNBits(uint32_t nBits, uint32_t* dwResult); int32_t readNBits(uint32_t nBits, int32_t* nResult); int32_t read1Bit(uint32_t* dwResult); - int32_t read1Bit(FX_BOOL* bResult); + int32_t read1Bit(bool* bResult); int32_t read1Byte(uint8_t* cResult); int32_t readInteger(uint32_t* dwResult); int32_t readShortInteger(uint16_t* wResult); diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index c0e40e325d..febd00b463 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -377,8 +377,8 @@ int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment, pPageInfo->m_bIsStriped = !!(wTemp & 0x8000); pPageInfo->m_wMaxStripeSize = wTemp & 0x7fff; bool bMaxHeight = (pPageInfo->m_dwHeight == 0xffffffff); - if (bMaxHeight && pPageInfo->m_bIsStriped != TRUE) - pPageInfo->m_bIsStriped = TRUE; + if (bMaxHeight && pPageInfo->m_bIsStriped != true) + pPageInfo->m_bIsStriped = true; if (!m_bBufSpecified) { uint32_t height = @@ -582,7 +582,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, CJBig2_CacheKey key = CJBig2_CacheKey(pSegment->m_dwObjNum, pSegment->m_dwDataOffset); - FX_BOOL cache_hit = false; + bool cache_hit = false; pSegment->m_nResultType = JBIG2_SYMBOL_DICT_POINTER; if (m_bIsGlobal && key.first != 0) { for (auto it = m_pSymbolDictCache->begin(); it != m_pSymbolDictCache->end(); diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h index 3b334b113c..a82aecbf12 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrdProc.h @@ -34,12 +34,12 @@ class CJBig2_GRDProc { FXCODEC_STATUS Continue_decode(IFX_Pause* pPause); FX_RECT GetReplaceRect() const { return m_ReplaceRect; } - FX_BOOL MMR; + bool MMR; uint32_t GBW; uint32_t GBH; uint8_t GBTEMPLATE; - FX_BOOL TPGDON; - FX_BOOL USESKIP; + bool TPGDON; + bool USESKIP; CJBig2_Image* SKIP; int8_t GBAT[8]; diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.h b/core/fxcodec/jbig2/JBig2_GrrdProc.h index 1ba0d6add0..bdb49d7e91 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.h @@ -36,7 +36,7 @@ class CJBig2_GRRDProc { CJBig2_Image* GRREFERENCE; int32_t GRREFERENCEDX; int32_t GRREFERENCEDY; - FX_BOOL TPGRON; + bool TPGRON; int8_t GRAT[4]; }; diff --git a/core/fxcodec/jbig2/JBig2_GsidProc.h b/core/fxcodec/jbig2/JBig2_GsidProc.h index c440ddb2b9..3d5dc2dd4a 100644 --- a/core/fxcodec/jbig2/JBig2_GsidProc.h +++ b/core/fxcodec/jbig2/JBig2_GsidProc.h @@ -24,8 +24,8 @@ class CJBig2_GSIDProc { uint32_t* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); public: - FX_BOOL GSMMR; - FX_BOOL GSUSESKIP; + bool GSMMR; + bool GSUSESKIP; uint8_t GSBPP; uint32_t GSW; uint32_t GSH; diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.h b/core/fxcodec/jbig2/JBig2_HtrdProc.h index 0ff79dcf29..9a9a5c59c4 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.h +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.h @@ -26,13 +26,13 @@ class CJBig2_HTRDProc { public: uint32_t HBW; uint32_t HBH; - FX_BOOL HMMR; + bool HMMR; uint8_t HTEMPLATE; uint32_t HNUMPATS; CJBig2_Image** HPATS; - FX_BOOL HDEFPIXEL; + bool HDEFPIXEL; JBig2ComposeOp HCOMBOP; - FX_BOOL HENABLESKIP; + bool HENABLESKIP; uint32_t HGW; uint32_t HGH; int32_t HGX; diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp index f20a1e8a2f..8f935ceb1f 100644 --- a/core/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/fxcodec/jbig2/JBig2_Image.cpp @@ -119,28 +119,28 @@ void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { m_nStride); } } -void CJBig2_Image::fill(FX_BOOL v) { +void CJBig2_Image::fill(bool v) { if (!m_pData) { return; } JBIG2_memset(m_pData, v ? 0xff : 0, m_nStride * m_nHeight); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image* pDst, - int32_t x, - int32_t y, - JBig2ComposeOp op) { +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); } -FX_BOOL CJBig2_Image::composeTo(CJBig2_Image* pDst, - int32_t x, - int32_t y, - JBig2ComposeOp op, - const FX_RECT* pSrcRect) { +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 (!pSrcRect || *pSrcRect == FX_RECT(0, 0, m_nWidth, m_nHeight)) return composeTo_opt2(pDst, x, y, op); @@ -148,22 +148,22 @@ FX_BOOL CJBig2_Image::composeTo(CJBig2_Image* pDst, return composeTo_opt2(pDst, x, y, op, pSrcRect); } -FX_BOOL CJBig2_Image::composeFrom(int32_t x, - int32_t y, - CJBig2_Image* pSrc, - JBig2ComposeOp op) { +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); } -FX_BOOL CJBig2_Image::composeFrom(int32_t x, - int32_t y, - CJBig2_Image* pSrc, - JBig2ComposeOp op, - const FX_RECT* pSrcRect) { +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); } @@ -229,7 +229,7 @@ CJBig2_Image* CJBig2_Image::subImage(int32_t x, return pImage; } -void CJBig2_Image::expand(int32_t h, FX_BOOL v) { +void CJBig2_Image::expand(int32_t h, bool v) { if (!m_pData || h <= m_nHeight || h > kMaxImageBytes / m_nStride) return; @@ -246,10 +246,10 @@ void CJBig2_Image::expand(int32_t h, FX_BOOL v) { m_nHeight = h; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, - int32_t x, - int32_t y, - JBig2ComposeOp op) { +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; @@ -257,10 +257,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, tmp1 = 0, tmp2 = 0, maskL = 0, maskR = 0, maskM = 0; 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; @@ -674,17 +674,17 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, } return 1; } -FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, - int32_t x, - int32_t y, - JBig2ComposeOp op, - const FX_RECT* pSrcRect) { +bool CJBig2_Image::composeTo_opt2(CJBig2_Image* pDst, + int32_t x, + int32_t y, + JBig2ComposeOp op, + const FX_RECT* pSrcRect) { if (!m_pData) { - return FALSE; + return false; } // TODO(weili): Check whether the range check is correct. Should x>=1048576? if (x < -1048576 || x > 1048576 || y < -1048576 || y > 1048576) { - return FALSE; + return false; } int32_t sw = pSrcRect->Width(); int32_t sh = pSrcRect->Height(); diff --git a/core/fxcodec/jbig2/JBig2_Image.h b/core/fxcodec/jbig2/JBig2_Image.h index 695420d76c..54529ef868 100644 --- a/core/fxcodec/jbig2/JBig2_Image.h +++ b/core/fxcodec/jbig2/JBig2_Image.h @@ -34,40 +34,34 @@ class CJBig2_Image { int32_t setPixel(int32_t x, int32_t y, int bVal); void copyLine(int32_t hTo, int32_t hFrom); - void fill(FX_BOOL v); - - 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); - - 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); - - FX_BOOL composeFrom(int32_t x, + void fill(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); + + bool composeTo_opt2(CJBig2_Image* pDst, + int32_t x, int32_t y, - CJBig2_Image* pSrc, JBig2ComposeOp op); - FX_BOOL composeFrom(int32_t x, + bool composeTo_opt2(CJBig2_Image* pDst, + int32_t x, int32_t y, - CJBig2_Image* pSrc, 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); + CJBig2_Image* subImage(int32_t x, int32_t y, int32_t w, int32_t h); - void expand(int32_t h, FX_BOOL v); + void expand(int32_t h, bool v); uint8_t* m_pData; diff --git a/core/fxcodec/jbig2/JBig2_Page.h b/core/fxcodec/jbig2/JBig2_Page.h index 131d6c8ba7..064b9b3545 100644 --- a/core/fxcodec/jbig2/JBig2_Page.h +++ b/core/fxcodec/jbig2/JBig2_Page.h @@ -15,7 +15,7 @@ struct JBig2PageInfo { uint32_t m_dwResolutionX; uint32_t m_dwResolutionY; uint8_t m_cFlags; - FX_BOOL m_bIsStriped; + bool m_bIsStriped; uint16_t m_wMaxStripeSize; }; diff --git a/core/fxcodec/jbig2/JBig2_PddProc.h b/core/fxcodec/jbig2/JBig2_PddProc.h index 93b2d350c1..578f603122 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.h +++ b/core/fxcodec/jbig2/JBig2_PddProc.h @@ -24,7 +24,7 @@ class CJBig2_PDDProc { CJBig2_PatternDict* decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause); public: - FX_BOOL HDMMR; + bool HDMMR; uint8_t HDPW; uint8_t HDPH; uint32_t GRAYMAX; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index f6afb13497..7e9ace2046 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -30,9 +30,9 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( int32_t DW; CJBig2_Image* BS; uint32_t I, J, REFAGGNINST; - FX_BOOL* EXFLAGS; + bool* EXFLAGS; uint32_t EXINDEX; - FX_BOOL CUREXFLAG; + bool CUREXFLAG; uint32_t EXRUNLENGTH; uint32_t nTmp; uint32_t SBNUMSYMS; @@ -235,7 +235,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } EXINDEX = 0; CUREXFLAG = 0; - EXFLAGS = FX_Alloc(FX_BOOL, SDNUMINSYMS + SDNUMNEWSYMS); + EXFLAGS = FX_Alloc(bool, SDNUMINSYMS + SDNUMNEWSYMS); num_ex_syms = 0; while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH); @@ -299,9 +299,9 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( int32_t DW; CJBig2_Image *BS, *BHC; uint32_t I, J, REFAGGNINST; - FX_BOOL* EXFLAGS; + bool* EXFLAGS; uint32_t EXINDEX; - FX_BOOL CUREXFLAG; + bool CUREXFLAG; uint32_t EXRUNLENGTH; int32_t nVal, nBits; uint32_t nTmp; @@ -564,7 +564,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( CUREXFLAG = 0; pTable.reset(new CJBig2_HuffmanTable(HuffmanTable_B1, HuffmanTable_B1_Size, HuffmanTable_HTOOB_B1)); - EXFLAGS = FX_Alloc(FX_BOOL, SDNUMINSYMS + SDNUMNEWSYMS); + EXFLAGS = FX_Alloc(bool, SDNUMINSYMS + SDNUMNEWSYMS); num_ex_syms = 0; while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { if (pHuffmanDecoder->decodeAValue(pTable.get(), (int*)&EXRUNLENGTH) != 0) { diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h index fa799cb83f..4df0cb4146 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.h +++ b/core/fxcodec/jbig2/JBig2_SddProc.h @@ -30,8 +30,8 @@ class CJBig2_SDDProc { IFX_Pause* pPause); public: - FX_BOOL SDHUFF; - FX_BOOL SDREFAGG; + bool SDHUFF; + bool SDREFAGG; uint32_t SDNUMINSYMS; CJBig2_Image** SDINSYMS; uint32_t SDNUMNEWSYMS; diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp index f3dd6be2b3..ccd8ebf98d 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp @@ -89,7 +89,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, break; } } - FX_BOOL RI = 0; + bool RI = 0; if (SBREFINE != 0 && pStream->read1Bit(&RI) != 0) { return nullptr; } diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h index 9429a6a738..be50ec152f 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.h +++ b/core/fxcodec/jbig2/JBig2_TrdProc.h @@ -47,8 +47,8 @@ class CJBig2_TRDProc { JBig2ArithCtx* grContext, JBig2IntDecoderState* pIDS); - FX_BOOL SBHUFF; - FX_BOOL SBREFINE; + bool SBHUFF; + bool SBREFINE; uint32_t SBW; uint32_t SBH; uint32_t SBNUMINSTANCES; @@ -59,10 +59,10 @@ class CJBig2_TRDProc { uint8_t SBSYMCODELEN; CJBig2_Image** SBSYMS; - FX_BOOL SBDEFPIXEL; + bool SBDEFPIXEL; JBig2ComposeOp SBCOMBOP; - FX_BOOL TRANSPOSED; + bool TRANSPOSED; JBig2Corner REFCORNER; int8_t SBDSOFFSET; -- cgit v1.2.3