From 5c15e67e12e245d102a2e0ef1b4ade54379f252c Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 27 Oct 2016 12:57:52 -0700 Subject: Fix some FX_BOOL / int noise in core/fx* Review-Url: https://codereview.chromium.org/2459673002 --- core/fxcodec/codec/fx_codec_fax.cpp | 4 +--- core/fxge/agg/fx_agg_driver.cpp | 34 +++++++++++++++------------------- core/fxge/ge/cfx_renderdevice.cpp | 2 +- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index a7ffd8bbdd..9af812381a 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -522,9 +522,7 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() { } else if (m_Encoding == 0) { FaxGet1DLine(m_pSrcBuf, bitsize, &m_bitpos, &m_ScanlineBuf, m_OrigWidth); } else { - FX_BOOL bNext1D = m_pSrcBuf[m_bitpos / 8] & (1 << (7 - m_bitpos % 8)); - ++m_bitpos; - if (bNext1D) { + if (NextBit(m_pSrcBuf, &m_bitpos)) { FaxGet1DLine(m_pSrcBuf, bitsize, &m_bitpos, &m_ScanlineBuf, m_OrigWidth); } else { FaxG4GetRow(m_pSrcBuf, bitsize, &m_bitpos, m_ScanlineBuf.data(), m_RefBuf, diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp index d3be763def..ed6410b4c3 100644 --- a/core/fxge/agg/fx_agg_driver.cpp +++ b/core/fxge/agg/fx_agg_driver.cpp @@ -240,7 +240,7 @@ FX_BOOL DibSetPixel(CFX_DIBitmap* pDevice, uint32_t color, int alpha_flag, void* pIccTransform) { - FX_BOOL bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag); + FX_BOOL bObjCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag); int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); if (pIccTransform) { CCodec_IccModule* pIccModule = @@ -1315,7 +1315,7 @@ class CFX_Renderer { m_pClipMask = m_pClipRgn->GetMask().GetObject(); } m_bFullCover = bFullCover; - FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag); + FX_BOOL bObjectCMYK = !!FXGETFLAG_COLORTYPE(alpha_flag); FX_BOOL bDeviceCMYK = pDevice->IsCmykImage(); m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color); CCodec_IccModule* pIccModule = nullptr; @@ -1468,8 +1468,9 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, rasterizer.filling_rule((fill_mode & 3) == FXFILL_WINDING ? agg::fill_non_zero : agg::fill_even_odd); - if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOVER, - FALSE, 0, nullptr)) { + if (!RenderRasterizer(rasterizer, fill_color, + !!(fill_mode & FXFILL_FULLCOVER), FALSE, 0, + nullptr)) { return FALSE; } } @@ -1484,13 +1485,10 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); RasterizeStroke(rasterizer, path_data.m_PathData, nullptr, pGraphState, 1, - FALSE, fill_mode & FX_STROKE_TEXT_MODE); - if (!RenderRasterizer(rasterizer, stroke_color, - fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout, 0, - nullptr)) { - return FALSE; - } - return TRUE; + FALSE, !!(fill_mode & FX_STROKE_TEXT_MODE)); + return RenderRasterizer(rasterizer, stroke_color, + !!(fill_mode & FXFILL_FULLCOVER), m_bGroupKnockout, + 0, nullptr); } CFX_Matrix matrix1; CFX_Matrix matrix2; @@ -1512,12 +1510,10 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData, rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)), (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT))); RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState, - matrix1.a, FALSE, fill_mode & FX_STROKE_TEXT_MODE); - if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLCOVER, - m_bGroupKnockout, 0, nullptr)) { - return FALSE; - } - return TRUE; + matrix1.a, FALSE, !!(fill_mode & FX_STROKE_TEXT_MODE)); + return RenderRasterizer(rasterizer, stroke_color, + !!(fill_mode & FXFILL_FULLCOVER), m_bGroupKnockout, 0, + nullptr); } FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, uint32_t color) { @@ -1752,8 +1748,8 @@ bool CFX_FxgeDevice::Create(int width, return false; } SetBitmap(pBitmap); - SetDeviceDriver(pdfium::MakeUnique(pBitmap, FALSE, - pOriDevice, FALSE)); + SetDeviceDriver(pdfium::MakeUnique(pBitmap, false, + pOriDevice, false)); return true; } diff --git a/core/fxge/ge/cfx_renderdevice.cpp b/core/fxge/ge/cfx_renderdevice.cpp index 0ee99947a4..1c3611ed9b 100644 --- a/core/fxge/ge/cfx_renderdevice.cpp +++ b/core/fxge/ge/cfx_renderdevice.cpp @@ -532,7 +532,7 @@ FX_BOOL CFX_RenderDevice::DrawPathWithBlend( CFX_PathData newPath; FX_BOOL bThin = FALSE; if (pPathData->GetZeroAreaPath(newPath, (CFX_Matrix*)pObject2Device, bThin, - m_pDeviceDriver->GetDriverType())) { + !!m_pDeviceDriver->GetDriverType())) { CFX_GraphStateData graphState; graphState.m_LineWidth = 0.0f; uint32_t strokecolor = fill_color; -- cgit v1.2.3