From ff46aaf499edcf153ee2f57c7016587aa96dcfa0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Jul 2015 11:55:29 -0700 Subject: FX Bool considered harmful, part 3 Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 . --- core/src/fxcodec/jbig2/JBig2_Image.cpp | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'core/src/fxcodec/jbig2/JBig2_Image.cpp') diff --git a/core/src/fxcodec/jbig2/JBig2_Image.cpp b/core/src/fxcodec/jbig2/JBig2_Image.cpp index 9ef4464ef0..030b0c2493 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); } } -FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) +bool CJBig2_Image::getPixel(int32_t x, int32_t y) { if (!m_pData) { return 0; @@ -72,7 +72,7 @@ FX_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, FX_BOOL v) +int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, 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(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 (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); } -FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) +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 @@ FX_BOOL CJBig2_Image::composeTo_unopt(CJBig2_Image *pDst, int32_t x, int32_t y, } break; } - return TRUE; + return true; } -FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JBig2ComposeOp op) +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; - FX_BOOL oneByte; + bool oneByte; if (!m_pData) { - return FALSE; + return false; } if (y < 0) { y0 = -y; @@ -215,7 +215,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JB y1 = m_nHeight; } if (y0 >= y1) { - return FALSE; + return false; } if (x >= 0) { x0 = x & ~7; @@ -227,7 +227,7 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JB x1 = pDst->m_nWidth; } if (x0 >= x1) { - return FALSE; + return false; } s1 = x & 7; s2 = 8 - s1; @@ -679,19 +679,19 @@ FX_BOOL CJBig2_Image::composeTo_opt(CJBig2_Image *pDst, int32_t x, int32_t y, JB } } } - return TRUE; + return true; } -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); } @@ -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, FX_BOOL v) +void CJBig2_Image::expand(int32_t h, bool v) { if (!m_pData || h <= m_nHeight) { return; @@ -788,7 +788,7 @@ void CJBig2_Image::expand(int32_t h, FX_BOOL v) JBIG2_memset(m_pData + dwHeight * dwStride, v ? 0xff : 0, (dwH - dwHeight) * dwStride); 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; @@ -799,10 +799,10 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, J 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 @@ FX_BOOL CJBig2_Image::composeTo_opt2(CJBig2_Image *pDst, int32_t x, int32_t y, J } 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) { 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(); -- cgit v1.2.3