From 605c9f71d33540ba99983d89ac79b2ca250fc730 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 27 Oct 2016 19:39:17 -0700 Subject: Fix FX_BOOL / int noise in JBig2, pass 3 Review-Url: https://codereview.chromium.org/2457943002 --- core/fxcodec/jbig2/JBig2_GrrdProc.h | 2 +- core/fxcodec/jbig2/JBig2_Image.cpp | 46 ++++++++++++++++++------------------- core/fxcodec/jbig2/JBig2_TrdProc.h | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) (limited to 'core/fxcodec') diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.h b/core/fxcodec/jbig2/JBig2_GrrdProc.h index 7329b9f988..389c760ed9 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.h @@ -32,7 +32,7 @@ class CJBig2_GRRDProc { uint32_t GRW; uint32_t GRH; - FX_BOOL GRTEMPLATE; + int GRTEMPLATE; CJBig2_Image* GRREFERENCE; int32_t GRREFERENCEDX; int32_t GRREFERENCEDY; 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; diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h index 2779676314..94f54442fb 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.h +++ b/core/fxcodec/jbig2/JBig2_TrdProc.h @@ -74,7 +74,7 @@ class CJBig2_TRDProc { CJBig2_HuffmanTable* SBHUFFRDX; CJBig2_HuffmanTable* SBHUFFRDY; CJBig2_HuffmanTable* SBHUFFRSIZE; - FX_BOOL SBRTEMPLATE; + int SBRTEMPLATE; int8_t SBRAT[4]; }; -- cgit v1.2.3