diff options
author | tsepez <tsepez@chromium.org> | 2016-10-27 19:39:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-27 19:39:17 -0700 |
commit | 605c9f71d33540ba99983d89ac79b2ca250fc730 (patch) | |
tree | efd750c19e5f7516973a8bf54c114657953b5376 /core/fxcodec/jbig2/JBig2_Image.cpp | |
parent | eaddead23892907cfdc008dc28363f366913eead (diff) | |
download | pdfium-605c9f71d33540ba99983d89ac79b2ca250fc730.tar.xz |
Fix FX_BOOL / int noise in JBig2, pass 3
Review-Url: https://codereview.chromium.org/2457943002
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Image.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Image.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Image.cpp b/core/fxcodec/jbig2/JBig2_Image.cpp index 7ac7e6147c..f20a1e8a2f 100644 --- a/core/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/fxcodec/jbig2/JBig2_Image.cpp @@ -72,42 +72,42 @@ CJBig2_Image::~CJBig2_Image() { FX_Free(m_pData); } } -FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) { - if (!m_pData) { + +int CJBig2_Image::getPixel(int32_t x, int32_t y) { + if (!m_pData) return 0; - } - int32_t m, n; - if (x < 0 || x >= m_nWidth) { + + if (x < 0 || x >= m_nWidth) return 0; - } - if (y < 0 || y >= m_nHeight) { + + if (y < 0 || y >= m_nHeight) return 0; - } - m = y * m_nStride + (x >> 3); - n = x & 7; + + int32_t m = y * m_nStride + (x >> 3); + int32_t n = x & 7; return ((m_pData[m] >> (7 - n)) & 1); } -int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, FX_BOOL v) { - if (!m_pData) { +int32_t CJBig2_Image::setPixel(int32_t x, int32_t y, int v) { + if (!m_pData) return 0; - } - int32_t m, n; - if (x < 0 || x >= m_nWidth) { + + if (x < 0 || x >= m_nWidth) return 0; - } - if (y < 0 || y >= m_nHeight) { + + if (y < 0 || y >= m_nHeight) return 0; - } - m = y * m_nStride + (x >> 3); - n = x & 7; - if (v) { + + int32_t m = y * m_nStride + (x >> 3); + int32_t n = x & 7; + if (v) m_pData[m] |= 1 << (7 - n); - } else { + else m_pData[m] &= ~(1 << (7 - n)); - } + return 1; } + void CJBig2_Image::copyLine(int32_t hTo, int32_t hFrom) { if (!m_pData) { return; |