diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:17:29 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:17:30 -0700 |
commit | 12f3e4a58f05850b93af35619cb04f0231d86acc (patch) | |
tree | 9851d8e46e5c168f5d148864caa2eebf814529dd /core/fxge/dib | |
parent | 3b3ce1a242f8445848d3f23d6c35ba01d7c645f4 (diff) | |
download | pdfium-12f3e4a58f05850b93af35619cb04f0231d86acc.tar.xz |
Remove FX_BOOL from core
Review-Url: https://codereview.chromium.org/2477443002
Diffstat (limited to 'core/fxge/dib')
-rw-r--r-- | core/fxge/dib/dib_int.h | 10 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_composite.cpp | 236 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_convert.cpp | 318 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_engine.cpp | 91 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_main.cpp | 299 | ||||
-rw-r--r-- | core/fxge/dib/fx_dib_transform.cpp | 36 |
6 files changed, 494 insertions, 496 deletions
diff --git a/core/fxge/dib/dib_int.h b/core/fxge/dib/dib_int.h index aa79b73154..000003a9c6 100644 --- a/core/fxge/dib/dib_int.h +++ b/core/fxge/dib/dib_int.h @@ -75,10 +75,10 @@ class CStretchEngine { int flags); ~CStretchEngine(); - FX_BOOL Continue(IFX_Pause* pPause); + bool Continue(IFX_Pause* pPause); - FX_BOOL StartStretchHorz(); - FX_BOOL ContinueStretchHorz(IFX_Pause* pPause); + bool StartStretchHorz(); + bool ContinueStretchHorz(IFX_Pause* pPause); void StretchVert(); FXDIB_Format m_DestFormat; @@ -110,7 +110,7 @@ class CStretchEngine { FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, - FX_BOOL bFlipX, - FX_BOOL bFlipY); + bool bFlipX, + bool bFlipY); #endif // CORE_FXGE_DIB_DIB_INT_H_ diff --git a/core/fxge/dib/fx_dib_composite.cpp b/core/fxge/dib/fx_dib_composite.cpp index d180b7a831..e3dc7404f3 100644 --- a/core/fxge/dib/fx_dib_composite.cpp +++ b/core/fxge/dib/fx_dib_composite.cpp @@ -307,7 +307,7 @@ void CompositeRow_Argb2Graya(uint8_t* dest_scan, pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col++) { uint8_t back_alpha = *dst_alpha_scan; @@ -511,7 +511,7 @@ void CompositeRow_Argb2Gray(uint8_t* dest_scan, pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; if (src_alpha_scan) { for (int col = 0; col < pixel_count; col++) { int src_alpha = *src_alpha_scan++; @@ -607,7 +607,7 @@ void CompositeRow_Rgb2Gray(uint8_t* dest_scan, pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { if (pIccTransform) { pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1); @@ -657,7 +657,7 @@ void CompositeRow_Rgb2Graya(uint8_t* dest_scan, pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); } if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { int back_alpha = *dest_alpha_scan; if (back_alpha == 0) { @@ -747,7 +747,7 @@ void CompositeRow_Argb2Argb(uint8_t* dest_scan, uint8_t* dest_alpha_scan, const uint8_t* src_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; if (!dest_alpha_scan) { if (!src_alpha_scan) { uint8_t back_alpha = 0; @@ -970,7 +970,7 @@ void CompositeRow_Rgb2Argb_Blend_NoClip(uint8_t* dest_scan, int src_Bpp, uint8_t* dest_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; if (dest_alpha_scan) { for (int col = 0; col < width; col++) { @@ -1039,7 +1039,7 @@ void CompositeRow_Rgb2Argb_Blend_Clip(uint8_t* dest_scan, const uint8_t* clip_scan, uint8_t* dest_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; if (dest_alpha_scan) { for (int col = 0; col < width; col++) { @@ -1222,7 +1222,7 @@ void CompositeRow_Argb2Rgb_Blend(uint8_t* dest_scan, const uint8_t* clip_scan, const uint8_t* src_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; if (src_alpha_scan) { for (int col = 0; col < width; col++) { @@ -1355,7 +1355,7 @@ void CompositeRow_Rgb2Rgb_Blend_NoClip(uint8_t* dest_scan, int dest_Bpp, int src_Bpp) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col++) { @@ -1385,7 +1385,7 @@ void CompositeRow_Rgb2Rgb_Blend_Clip(uint8_t* dest_scan, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col++) { @@ -1487,7 +1487,7 @@ void CompositeRow_Argb2Argb_Transform(uint8_t* dest_scan, } else { if (dest_alpha_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); @@ -1673,7 +1673,7 @@ void CompositeRow_Argb2Rgb_Blend_Transform(uint8_t* dest_scan, width); } else { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int dest_gap = dest_Bpp - 3; for (int col = 0; col < width; col++) { pIccModule->TranslateScanline(pIccTransform, src_cache_scan, src_scan, 1); @@ -1867,7 +1867,7 @@ void CompositeRow_8bppPal2Gray(uint8_t* dest_scan, const uint8_t* src_alpha_scan) { if (src_alpha_scan) { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { uint8_t gray = pPalette[*src_scan]; int src_alpha = *src_alpha_scan++; @@ -1904,7 +1904,7 @@ void CompositeRow_8bppPal2Gray(uint8_t* dest_scan, } } else { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { uint8_t gray = pPalette[*src_scan]; if (bNonseparableBlend) @@ -1944,7 +1944,7 @@ void CompositeRow_8bppPal2Graya(uint8_t* dest_scan, const uint8_t* src_alpha_scan) { if (src_alpha_scan) { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { uint8_t gray = pPalette[*src_scan]; src_scan++; @@ -2018,7 +2018,7 @@ void CompositeRow_8bppPal2Graya(uint8_t* dest_scan, } } else { if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { uint8_t gray = pPalette[*src_scan]; src_scan++; @@ -2082,7 +2082,7 @@ void CompositeRow_1bppPal2Gray(uint8_t* dest_scan, int reset_gray = pPalette[0]; int set_gray = pPalette[1]; if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) @@ -2126,7 +2126,7 @@ void CompositeRow_1bppPal2Graya(uint8_t* dest_scan, int reset_gray = pPalette[0]; int set_gray = pPalette[1]; if (blend_type) { - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { uint8_t gray = (src_scan[(col + src_left) / 8] & (1 << (7 - (col + src_left) % 8))) @@ -2989,7 +2989,7 @@ void CompositeRow_Argb2Argb_RgbByteOrder(uint8_t* dest_scan, int blend_type, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < pixel_count; col++) { uint8_t back_alpha = dest_scan[3]; if (back_alpha == 0) { @@ -3053,7 +3053,7 @@ void CompositeRow_Rgb2Argb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, int blend_type, int src_Bpp) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col++) { uint8_t back_alpha = dest_scan[3]; @@ -3097,7 +3097,7 @@ void CompositeRow_Argb2Rgb_Blend_RgbByteOrder(uint8_t* dest_scan, int dest_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; for (int col = 0; col < width; col++) { uint8_t src_alpha; if (clip_scan) { @@ -3154,7 +3154,7 @@ void CompositeRow_Rgb2Rgb_Blend_NoClip_RgbByteOrder(uint8_t* dest_scan, int dest_Bpp, int src_Bpp) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col++) { if (bNonseparableBlend) { @@ -3236,7 +3236,7 @@ void CompositeRow_Rgb2Argb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col++) { int src_alpha = *clip_scan++; @@ -3288,7 +3288,7 @@ void CompositeRow_Rgb2Rgb_Blend_Clip_RgbByteOrder(uint8_t* dest_scan, int src_Bpp, const uint8_t* clip_scan) { int blended_colors[3]; - FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; + bool bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE; int src_gap = src_Bpp - 3; for (int col = 0; col < width; col++) { uint8_t src_alpha = *clip_scan++; @@ -3802,16 +3802,16 @@ void CompositeRow_BitMask2Rgb_RgbByteOrder(uint8_t* dest_scan, } } -FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, - int alpha_flag, - uint32_t mask_color, - int& mask_alpha, - int& mask_red, - int& mask_green, - int& mask_blue, - int& mask_black, - CCodec_IccModule* pIccModule, - void* pIccTransform) { +bool ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, + int alpha_flag, + uint32_t mask_color, + int& mask_alpha, + int& mask_red, + int& mask_green, + int& mask_blue, + int& mask_black, + CCodec_IccModule* pIccModule, + void* pIccTransform) { if (alpha_flag >> 8) { mask_alpha = alpha_flag & 0xff; mask_red = FXSYS_GetCValue(mask_color); @@ -3825,7 +3825,7 @@ FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, mask_blue = FXARGB_B(mask_color); } if (dest_format == FXDIB_8bppMask) { - return TRUE; + return true; } if ((dest_format & 0xff) == 8) { if (pIccTransform) { @@ -3866,7 +3866,7 @@ FX_BOOL ScanlineCompositor_InitSourceMask(FXDIB_Format dest_format, mask_blue = mask_color_p[0]; } } - return TRUE; + return true; } void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, @@ -3875,8 +3875,8 @@ void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, uint32_t* pSrcPalette, CCodec_IccModule* pIccModule, void* pIccTransform) { - FX_BOOL isSrcCmyk = !!(src_format & 0x0400); - FX_BOOL isDstCmyk = !!(dest_format & 0x0400); + bool isSrcCmyk = !!(src_format & 0x0400); + bool isDstCmyk = !!(dest_format & 0x0400); pDestPalette = nullptr; if (pIccTransform) { if (pSrcPalette) { @@ -4012,7 +4012,7 @@ CFX_ScanlineCompositor::CFX_ScanlineCompositor() { m_pSrcPalette = nullptr; m_pCacheScanline = nullptr; m_CacheSize = 0; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } @@ -4021,16 +4021,16 @@ CFX_ScanlineCompositor::~CFX_ScanlineCompositor() { FX_Free(m_pCacheScanline); } -FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, - FXDIB_Format src_format, - int32_t width, - uint32_t* pSrcPalette, - uint32_t mask_color, - int blend_type, - FX_BOOL bClip, - FX_BOOL bRgbByteOrder, - int alpha_flag, - void* pIccTransform) { +bool CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, + FXDIB_Format src_format, + int32_t width, + uint32_t* pSrcPalette, + uint32_t mask_color, + int blend_type, + bool bClip, + bool bRgbByteOrder, + int alpha_flag, + void* pIccTransform) { m_SrcFormat = src_format; m_DestFormat = dest_format; m_BlendType = blend_type; @@ -4044,7 +4044,7 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, } m_pIccTransform = pIccTransform; if ((dest_format & 0xff) == 1) { - return FALSE; + return false; } if (m_SrcFormat == FXDIB_1bppMask || m_SrcFormat == FXDIB_8bppMask) { return ScanlineCompositor_InitSourceMask( @@ -4052,11 +4052,11 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, m_MaskGreen, m_MaskBlue, m_MaskBlack, pIccModule, pIccTransform); } if (!pIccTransform && (~src_format & 0x0400) && (dest_format & 0x0400)) { - return FALSE; + return false; } if ((m_SrcFormat & 0xff) <= 8) { if (dest_format == FXDIB_8bppMask) { - return TRUE; + return true; } ScanlineCompositor_InitSourcePalette(src_format, dest_format, m_pSrcPalette, pSrcPalette, pIccModule, @@ -4064,14 +4064,14 @@ FX_BOOL CFX_ScanlineCompositor::Init(FXDIB_Format dest_format, m_Transparency = (dest_format == FXDIB_Argb ? 1 : 0) + (dest_format & 0x0200 ? 2 : 0) + (dest_format & 0x0400 ? 4 : 0) + ((src_format & 0xff) == 1 ? 8 : 0); - return TRUE; + return true; } m_Transparency = (src_format & 0x0200 ? 0 : 1) + (dest_format & 0x0200 ? 0 : 2) + (blend_type == FXDIB_BLEND_NORMAL ? 4 : 0) + (bClip ? 8 : 0) + (src_format & 0x0400 ? 16 : 0) + (dest_format & 0x0400 ? 32 : 0) + (pIccTransform ? 64 : 0); - return TRUE; + return true; } void CFX_ScanlineCompositor::CompositeRgbBitmapLine( @@ -4481,29 +4481,29 @@ void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan, } } -FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top, - int blend_type, - const CFX_ClipRgn* pClipRgn, - FX_BOOL bRgbByteOrder, - void* pIccTransform) { +bool CFX_DIBitmap::CompositeBitmap(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top, + int blend_type, + const CFX_ClipRgn* pClipRgn, + bool bRgbByteOrder, + void* pIccTransform) { if (!m_pBuffer) { - return FALSE; + return false; } ASSERT(!pSrcBitmap->IsAlphaMask()); ASSERT(m_bpp >= 8); if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn); if (width == 0 || height == 0) { - return TRUE; + return true; } const CFX_DIBitmap* pClipMask = nullptr; FX_RECT clip_box; @@ -4516,11 +4516,11 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, if (!compositor.Init(GetFormat(), pSrcBitmap->GetFormat(), width, pSrcBitmap->GetPalette(), 0, blend_type, pClipMask != nullptr, bRgbByteOrder, 0, pIccTransform)) { - return FALSE; + return false; } int dest_Bpp = m_bpp / 8; int src_Bpp = pSrcBitmap->GetBPP() / 8; - FX_BOOL bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); + bool bRgb = src_Bpp > 1 && !pSrcBitmap->IsCmykImage(); CFX_DIBitmap* pSrcAlphaMask = pSrcBitmap->m_pAlphaMask; for (int row = 0; row < height; row++) { uint8_t* dest_scan = @@ -4550,39 +4550,39 @@ FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left, dst_scan_extra_alpha); } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pMask, - uint32_t color, - int src_left, - int src_top, - int blend_type, - const CFX_ClipRgn* pClipRgn, - FX_BOOL bRgbByteOrder, - int alpha_flag, - void* pIccTransform) { +bool CFX_DIBitmap::CompositeMask(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pMask, + uint32_t color, + int src_left, + int src_top, + int blend_type, + const CFX_ClipRgn* pClipRgn, + bool bRgbByteOrder, + int alpha_flag, + void* pIccTransform) { if (!m_pBuffer) { - return FALSE; + return false; } ASSERT(pMask->IsAlphaMask()); ASSERT(m_bpp >= 8); if (!pMask->IsAlphaMask() || m_bpp < 8) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask->GetHeight(), src_left, src_top, pClipRgn); if (width == 0 || height == 0) { - return TRUE; + return true; } int src_alpha = (uint8_t)(alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); if (src_alpha == 0) { - return TRUE; + return true; } const CFX_DIBitmap* pClipMask = nullptr; FX_RECT clip_box; @@ -4597,7 +4597,7 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, if (!compositor.Init(GetFormat(), pMask->GetFormat(), width, nullptr, color, blend_type, pClipMask != nullptr, bRgbByteOrder, alpha_flag, pIccTransform)) { - return FALSE; + return false; } for (int row = 0; row < height; row++) { uint8_t* dest_scan = @@ -4621,27 +4621,27 @@ FX_BOOL CFX_DIBitmap::CompositeMask(int dest_left, clip_scan, dst_scan_extra_alpha); } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::CompositeRect(int left, - int top, - int width, - int height, - uint32_t color, - int alpha_flag, - void* pIccTransform) { +bool CFX_DIBitmap::CompositeRect(int left, + int top, + int width, + int height, + uint32_t color, + int alpha_flag, + void* pIccTransform) { if (!m_pBuffer) { - return FALSE; + return false; } int src_alpha = (alpha_flag >> 8) ? (alpha_flag & 0xff) : FXARGB_A(color); if (src_alpha == 0) { - return TRUE; + return true; } FX_RECT rect(left, top, left + width, top + height); rect.Intersect(0, 0, m_Width, m_Height); if (rect.IsEmpty()) { - return TRUE; + return true; } width = rect.Width(); uint32_t dst_color; @@ -4684,7 +4684,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, } } } - return TRUE; + return true; } if (m_bpp == 1) { ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0); @@ -4723,11 +4723,11 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, } } } - return TRUE; + return true; } ASSERT(m_bpp >= 24); if (m_bpp < 24) { - return FALSE; + return false; } if (pIccTransform && CFX_GEModule::Get()->GetCodecModule()) { CCodec_IccModule* pIccModule = @@ -4739,14 +4739,14 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, FXSYS_GetYValue(color), FXSYS_GetKValue(color), color_p[2], color_p[1], color_p[0]); } else if (!(alpha_flag >> 8) && IsCmykImage()) { - return FALSE; + return false; } } if (!IsCmykImage()) { color_p[3] = (uint8_t)src_alpha; } int Bpp = m_bpp / 8; - FX_BOOL bAlpha = HasAlpha(); + bool bAlpha = HasAlpha(); bool bArgb = GetFormat() == FXDIB_Argb; if (src_alpha == 255) { for (int row = rect.top; row < rect.bottom; row++) { @@ -4770,7 +4770,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, } } } - return TRUE; + return true; } for (int row = rect.top; row < rect.bottom; row++) { uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left * Bpp; @@ -4830,7 +4830,7 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, } } } - return TRUE; + return true; } CFX_BitmapComposer::CFX_BitmapComposer() { @@ -4838,7 +4838,7 @@ CFX_BitmapComposer::CFX_BitmapComposer() { m_pScanlineAlphaV = nullptr; m_pClipScanV = nullptr; m_pAddClipScan = nullptr; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } @@ -4854,10 +4854,10 @@ void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, int bitmap_alpha, uint32_t mask_color, FX_RECT& dest_rect, - FX_BOOL bVertical, - FX_BOOL bFlipX, - FX_BOOL bFlipY, - FX_BOOL bRgbByteOrder, + bool bVertical, + bool bFlipX, + bool bFlipY, + bool bRgbByteOrder, int alpha_flag, void* pIccTransform, int blend_type) { @@ -4881,16 +4881,16 @@ void CFX_BitmapComposer::Compose(CFX_DIBitmap* pDest, m_bRgbByteOrder = bRgbByteOrder; m_BlendType = blend_type; } -FX_BOOL CFX_BitmapComposer::SetInfo(int width, - int height, - FXDIB_Format src_format, - uint32_t* pSrcPalette) { +bool CFX_BitmapComposer::SetInfo(int width, + int height, + FXDIB_Format src_format, + uint32_t* pSrcPalette) { m_SrcFormat = src_format; if (!m_Compositor.Init(m_pBitmap->GetFormat(), src_format, width, pSrcPalette, m_MaskColor, FXDIB_BLEND_NORMAL, m_pClipMask != nullptr || (m_BitmapAlpha < 255), m_bRgbByteOrder, m_AlphaFlag, m_pIccTransform)) { - return FALSE; + return false; } if (m_bVertical) { m_pScanlineV = FX_Alloc(uint8_t, m_pBitmap->GetBPP() / 8 * width + 4); @@ -4903,7 +4903,7 @@ FX_BOOL CFX_BitmapComposer::SetInfo(int width, m_pAddClipScan = FX_Alloc( uint8_t, m_bVertical ? m_pBitmap->GetHeight() : m_pBitmap->GetWidth()); } - return TRUE; + return true; } void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp index e3ee626fff..5eac2ac8e4 100644 --- a/core/fxge/dib/fx_dib_convert.cpp +++ b/core/fxge/dib/fx_dib_convert.cpp @@ -12,7 +12,7 @@ class CFX_Palette { CFX_Palette(); ~CFX_Palette(); - FX_BOOL BuildPalette(const CFX_DIBSource* pBitmap); + bool BuildPalette(const CFX_DIBSource* pBitmap); uint32_t* GetPalette() const { return m_pPalette; } uint32_t* GetColorLut() const { return m_cLut; } uint32_t* GetAmountLut() const { return m_aLut; } @@ -96,9 +96,9 @@ CFX_Palette::~CFX_Palette() { m_lut = 0; } -FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) { +bool CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) { if (!pBitmap) { - return FALSE; + return false; } FX_Free(m_pPalette); m_pPalette = FX_Alloc(uint32_t, 256); @@ -133,16 +133,16 @@ FX_BOOL CFX_Palette::BuildPalette(const CFX_DIBSource* pBitmap) { } _Qsort(m_aLut, m_cLut, 0, m_lut - 1); _Obtain_Pal(m_aLut, m_cLut, m_pPalette, m_lut); - return TRUE; + return true; } -FX_BOOL ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { uint8_t set_gray, reset_gray; set_gray = 0xff; reset_gray = 0x00; @@ -157,31 +157,31 @@ FX_BOOL ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, dest_scan++; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; FXSYS_memcpy(dest_scan, src_scan, width); } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); uint8_t gray[2]; uint8_t reset_r; @@ -219,16 +219,16 @@ FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, dest_scan++; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { uint32_t* src_plt = pSrcBitmap->GetPalette(); uint8_t gray[256]; if (pSrcBitmap->IsCmykImage()) { @@ -255,16 +255,16 @@ FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, *dest_scan++ = gray[*src_scan++]; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { int Bpp = pSrcBitmap->GetBPP() / 8; if (pSrcBitmap->IsCmykImage()) { for (int row = 0; row < height; row++) { @@ -292,7 +292,7 @@ FX_BOOL ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, } } } - return TRUE; + return true; } void ConvertBuffer_IndexCopy(uint8_t* dest_buf, @@ -324,14 +324,14 @@ void ConvertBuffer_IndexCopy(uint8_t* dest_buf, } } -FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top, - uint32_t* dst_plt) { +bool ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top, + uint32_t* dst_plt) { ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); uint32_t* src_plt = pSrcBitmap->GetPalette(); @@ -349,24 +349,24 @@ FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, } else { FXSYS_memcpy(dst_plt, src_plt, plt_size * 4); } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top, - uint32_t* dst_plt) { +bool ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top, + uint32_t* dst_plt) { int bpp = pSrcBitmap->GetBPP() / 8; CFX_Palette palette; palette.BuildPalette(pSrcBitmap); uint32_t* cLut = palette.GetColorLut(); uint32_t* aLut = palette.GetAmountLut(); if (!cLut || !aLut) { - return FALSE; + return false; } int lut = palette.Getlut(); uint32_t* pPalette = palette.GetPalette(); @@ -411,17 +411,17 @@ FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, } } FXSYS_memcpy(dst_plt, pPalette, sizeof(uint32_t) * 256); - return TRUE; + return true; } -FX_BOOL ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, + uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { int comps = (dst_format & 0xff) / 8; uint8_t set_gray, reset_gray; set_gray = 0xff; @@ -442,17 +442,17 @@ FX_BOOL ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, dest_scan += comps; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, + uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { int comps = (dst_format & 0xff) / 8; for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; @@ -466,17 +466,17 @@ FX_BOOL ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, dest_scan += comps - 2; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, + uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { int comps = (dst_format & 0xff) / 8; uint32_t* src_plt = pSrcBitmap->GetPalette(); uint32_t plt[2]; @@ -518,17 +518,17 @@ FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, dest_scan += comps - 2; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, + uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { int comps = (dst_format & 0xff) / 8; uint32_t* src_plt = pSrcBitmap->GetPalette(); uint32_t plt[256]; @@ -564,32 +564,32 @@ FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, dest_scan += comps - 2; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; FXSYS_memcpy(dest_scan, src_scan, width * 3); } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = @@ -601,16 +601,16 @@ FX_BOOL ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, src_scan++; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { int comps = pSrcBitmap->GetBPP() / 8; for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; @@ -624,16 +624,16 @@ FX_BOOL ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, src_scan += comps - 3; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = @@ -645,26 +645,26 @@ FX_BOOL ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, src_scan += 4; } } - return TRUE; + return true; } -FX_BOOL ConvertBuffer(FXDIB_Format dest_format, - uint8_t* dest_buf, - int dest_pitch, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top, - std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) { +bool ConvertBuffer(FXDIB_Format dest_format, + uint8_t* dest_buf, + int dest_pitch, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top, + std::unique_ptr<uint32_t, FxFreeDeleter>* p_pal) { FXDIB_Format src_format = pSrcBitmap->GetFormat(); switch (dest_format) { case FXDIB_Invalid: case FXDIB_1bppCmyk: case FXDIB_1bppMask: case FXDIB_1bppRgb: - ASSERT(FALSE); - return FALSE; + ASSERT(false); + return false; case FXDIB_8bppMask: { if ((src_format & 0xff) == 1) { if (pSrcBitmap->GetPalette()) { @@ -686,7 +686,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, return ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); } - return FALSE; + return false; } case FXDIB_8bppRgb: case FXDIB_8bppRgba: { @@ -706,7 +706,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, pSrcBitmap, src_left, src_top, p_pal->get()); } - return FALSE; + return false; } case FXDIB_Rgb: case FXDIB_Rgba: { @@ -738,7 +738,7 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, return ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); } - return FALSE; + return false; } case FXDIB_Argb: case FXDIB_Rgb32: { @@ -771,10 +771,10 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, return ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top); } - return FALSE; + return false; } default: - return FALSE; + return false; } } @@ -793,7 +793,7 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) const { return nullptr; } - FX_BOOL ret = TRUE; + bool ret = true; if (dest_format & 0x0200) { if (dest_format == FXDIB_Argb) { ret = pSrcAlpha ? pClone->LoadChannel(FXDIB_Alpha, pSrcAlpha, FXDIB_Alpha) @@ -819,15 +819,15 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format) const { return pClone.release(); } -FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { +bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { FXDIB_Format src_format = GetFormat(); if (dest_format == src_format) - return TRUE; + return true; if (dest_format == FXDIB_8bppMask && src_format == FXDIB_8bppRgb && !m_pPalette) { m_AlphaFlag = 1; - return TRUE; + return true; } if (dest_format == FXDIB_Argb && src_format == FXDIB_Rgb32) { m_AlphaFlag = 2; @@ -838,13 +838,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { scanline += 4; } } - return TRUE; + return true; } int dest_bpp = dest_format & 0xff; int dest_pitch = (dest_bpp * m_Width + 31) / 32 * 4; uint8_t* dest_buf = FX_TryAlloc(uint8_t, dest_pitch * m_Height + 4); if (!dest_buf) { - return FALSE; + return false; } CFX_DIBitmap* pAlphaMask = nullptr; if (dest_format == FXDIB_Argb) { @@ -864,13 +864,13 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { pAlphaMask = GetAlphaMask(); if (!pAlphaMask) { FX_Free(dest_buf); - return FALSE; + return false; } } else { if (!m_pAlphaMask) { if (!BuildAlphaMask()) { FX_Free(dest_buf); - return FALSE; + return false; } pAlphaMask = m_pAlphaMask; m_pAlphaMask = nullptr; @@ -879,7 +879,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { } } } - FX_BOOL ret = FALSE; + bool ret = false; std::unique_ptr<uint32_t, FxFreeDeleter> pal_8bpp; ret = ConvertBuffer(dest_format, dest_buf, dest_pitch, m_Width, m_Height, this, 0, 0, &pal_8bpp); @@ -887,7 +887,7 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { if (pAlphaMask != m_pAlphaMask) delete pAlphaMask; FX_Free(dest_buf); - return FALSE; + return false; } if (m_pAlphaMask && pAlphaMask != m_pAlphaMask) delete m_pAlphaMask; @@ -895,10 +895,10 @@ FX_BOOL CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { m_pPalette = std::move(pal_8bpp); if (!m_bExtBuf) FX_Free(m_pBuffer); - m_bExtBuf = FALSE; + m_bExtBuf = false; m_pBuffer = dest_buf; m_bpp = (uint8_t)dest_format; m_AlphaFlag = (uint8_t)(dest_format >> 8); m_Pitch = dest_pitch; - return TRUE; + return true; } diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index 47dcf03259..c004aac538 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -308,8 +308,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, m_SrcHeight = pSrcBitmap->GetHeight(); m_SrcPitch = (m_SrcWidth * m_SrcBpp + 31) / 32 * 4; if ((flags & FXDIB_NOSMOOTH) == 0) { - FX_BOOL bInterpol = - flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL; + bool bInterpol = flags & FXDIB_INTERPOL || flags & FXDIB_BICUBIC_INTERPOL; if (!bInterpol && FXSYS_abs(dest_width) != 0 && FXSYS_abs(dest_height) / 8 < static_cast<long long>(m_SrcWidth) * m_SrcHeight / FXSYS_abs(dest_width)) { @@ -382,29 +381,29 @@ CStretchEngine::~CStretchEngine() { FX_Free(m_pDestMaskScanline); } -FX_BOOL CStretchEngine::Continue(IFX_Pause* pPause) { +bool CStretchEngine::Continue(IFX_Pause* pPause) { while (m_State == 1) { if (ContinueStretchHorz(pPause)) { - return TRUE; + return true; } m_State = 2; StretchVert(); } - return FALSE; + return false; } -FX_BOOL CStretchEngine::StartStretchHorz() { +bool CStretchEngine::StartStretchHorz() { if (m_DestWidth == 0 || m_InterPitch == 0 || !m_pDestScanline) - return FALSE; + return false; if (m_SrcClip.Height() == 0 || m_SrcClip.Height() > (1 << 29) / m_InterPitch) { - return FALSE; + return false; } m_pInterBuf = FX_TryAlloc(unsigned char, m_SrcClip.Height() * m_InterPitch); if (!m_pInterBuf) - return FALSE; + return false; if (m_pSource && m_bHasAlpha && m_pSource->m_pAlphaMask) { m_pExtraAlphaBuf = @@ -412,25 +411,25 @@ FX_BOOL CStretchEngine::StartStretchHorz() { uint32_t size = (m_DestClip.Width() * 8 + 31) / 32 * 4; m_pDestMaskScanline = FX_TryAlloc(unsigned char, size); if (!m_pDestMaskScanline) - return FALSE; + return false; } bool ret = m_WeightTable.Calc(m_DestWidth, m_DestClip.left, m_DestClip.right, m_SrcWidth, m_SrcClip.left, m_SrcClip.right, m_Flags); if (!ret) - return FALSE; + return false; m_CurRow = m_SrcClip.top; m_State = 1; - return TRUE; + return true; } -FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { +bool CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { if (!m_DestWidth) - return FALSE; + return false; if (m_pSource->SkipToScanline(m_CurRow, pPause)) - return TRUE; + return true; int Bpp = m_DestBpp / 8; static const int kStrechPauseRows = 10; @@ -438,7 +437,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { for (; m_CurRow < m_SrcClip.bottom; m_CurRow++) { if (rows_to_go == 0) { if (pPause && pPause->NeedToPauseNow()) - return TRUE; + return true; rows_to_go = kStrechPauseRows; } @@ -464,7 +463,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { int* pWeight = m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j); if (!pWeight) - return FALSE; + return false; int pixel_weight = *pWeight; if (src_scan[j / 8] & (1 << (7 - j % 8))) { @@ -487,7 +486,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { int* pWeight = m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j); if (!pWeight) - return FALSE; + return false; int pixel_weight = *pWeight; dest_a += pixel_weight * src_scan[j]; @@ -508,7 +507,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { int* pWeight = m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j); if (!pWeight) - return FALSE; + return false; int pixel_weight = *pWeight; pixel_weight = pixel_weight * src_scan_mask[j] / 255; @@ -533,7 +532,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { int* pWeight = m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j); if (!pWeight) - return FALSE; + return false; int pixel_weight = *pWeight; unsigned long argb_cmyk = m_pSrcPalette[src_scan[j]]; @@ -570,7 +569,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { int* pWeight = m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j); if (!pWeight) - return FALSE; + return false; int pixel_weight = *pWeight; pixel_weight = pixel_weight * src_scan_mask[j] / 255; @@ -611,7 +610,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { int* pWeight = m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j); if (!pWeight) - return FALSE; + return false; int pixel_weight = *pWeight; const uint8_t* src_pixel = src_scan + j * Bpp; @@ -643,7 +642,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { int* pWeight = m_WeightTable.GetValueFromPixelWeight(pPixelWeights, j); if (!pWeight) - return FALSE; + return false; int pixel_weight = *pWeight; const uint8_t* src_pixel = src_scan + j * Bpp; @@ -682,7 +681,7 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause) { } rows_to_go--; } - return FALSE; + return false; } void CStretchEngine::StretchVert() { @@ -865,8 +864,8 @@ CFX_ImageStretcher::CFX_ImageStretcher(IFX_ScanlineComposer* pDest, : m_pDest(pDest), m_pSource(pSource), m_Flags(flags), - m_bFlipX(FALSE), - m_bFlipY(FALSE), + m_bFlipX(false), + m_bFlipY(false), m_DestWidth(dest_width), m_DestHeight(dest_height), m_ClipRect(bitmap_rect), @@ -877,9 +876,9 @@ CFX_ImageStretcher::CFX_ImageStretcher(IFX_ScanlineComposer* pDest, CFX_ImageStretcher::~CFX_ImageStretcher() { } -FX_BOOL CFX_ImageStretcher::Start() { +bool CFX_ImageStretcher::Start() { if (m_DestWidth == 0 || m_DestHeight == 0) - return FALSE; + return false; if (m_pSource->GetFormat() == FXDIB_1bppRgb && m_pSource->GetPalette()) { FX_ARGB pal[256]; @@ -895,7 +894,7 @@ FX_BOOL CFX_ImageStretcher::Start() { } if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat, pal)) { - return FALSE; + return false; } } else if (m_pSource->GetFormat() == FXDIB_1bppCmyk && m_pSource->GetPalette()) { @@ -912,11 +911,11 @@ FX_BOOL CFX_ImageStretcher::Start() { } if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat, pal)) { - return FALSE; + return false; } } else if (!m_pDest->SetInfo(m_ClipRect.Width(), m_ClipRect.Height(), m_DestFormat, nullptr)) { - return FALSE; + return false; } if (m_Flags & FXDIB_DOWNSAMPLE) @@ -924,40 +923,40 @@ FX_BOOL CFX_ImageStretcher::Start() { return StartStretch(); } -FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) { +bool CFX_ImageStretcher::Continue(IFX_Pause* pPause) { if (m_Flags & FXDIB_DOWNSAMPLE) return ContinueQuickStretch(pPause); return ContinueStretch(pPause); } -FX_BOOL CFX_ImageStretcher::StartStretch() { +bool CFX_ImageStretcher::StartStretch() { m_pStretchEngine = pdfium::MakeUnique<CStretchEngine>( m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags); m_pStretchEngine->StartStretchHorz(); if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) { m_pStretchEngine->Continue(nullptr); - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) { +bool CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) { return m_pStretchEngine && m_pStretchEngine->Continue(pPause); } -FX_BOOL CFX_ImageStretcher::StartQuickStretch() { +bool CFX_ImageStretcher::StartQuickStretch() { if (m_DestWidth < 0) { - m_bFlipX = TRUE; + m_bFlipX = true; m_DestWidth = -m_DestWidth; } if (m_DestHeight < 0) { - m_bFlipY = TRUE; + m_bFlipY = true; m_DestHeight = -m_DestHeight; } uint32_t size = m_ClipRect.Width(); if (size && m_DestBPP > (int)(INT_MAX / size)) { - return FALSE; + return false; } size *= m_DestBPP; m_pScanline.reset(FX_Alloc(uint8_t, (size / 8 + 3) / 4 * 4)); @@ -966,14 +965,14 @@ FX_BOOL CFX_ImageStretcher::StartQuickStretch() { if (SourceSizeWithinLimit(m_pSource->GetWidth(), m_pSource->GetHeight())) { ContinueQuickStretch(nullptr); - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) { +bool CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) { if (!m_pScanline) - return FALSE; + return false; int result_width = m_ClipRect.Width(); int result_height = m_ClipRect.Height(); @@ -992,7 +991,7 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) { src_y = std::max(std::min(src_y, src_height - 1), 0); if (m_pSource->SkipToScanline(src_y, pPause)) - return TRUE; + return true; m_pSource->DownSampleScanline(src_y, m_pScanline.get(), m_DestBPP, m_DestWidth, m_bFlipX, m_ClipRect.left, @@ -1004,5 +1003,5 @@ FX_BOOL CFX_ImageStretcher::ContinueQuickStretch(IFX_Pause* pPause) { } m_pDest->ComposeScanline(dest_y, m_pScanline.get(), m_pMaskScanline.get()); } - return FALSE; + return false; } diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp index df448a66bd..e593a637af 100644 --- a/core/fxge/dib/fx_dib_main.cpp +++ b/core/fxge/dib/fx_dib_main.cpp @@ -55,48 +55,48 @@ uint8_t* CFX_DIBSource::GetBuffer() const { return nullptr; } -FX_BOOL CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const { - return FALSE; +bool CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const { + return false; } CFX_DIBitmap::CFX_DIBitmap() { - m_bExtBuf = FALSE; + m_bExtBuf = false; m_pBuffer = nullptr; m_pPalette = nullptr; } #define _MAX_OOM_LIMIT_ 12000000 -FX_BOOL CFX_DIBitmap::Create(int width, - int height, - FXDIB_Format format, - uint8_t* pBuffer, - int pitch) { +bool CFX_DIBitmap::Create(int width, + int height, + FXDIB_Format format, + uint8_t* pBuffer, + int pitch) { m_pBuffer = nullptr; m_bpp = (uint8_t)format; m_AlphaFlag = (uint8_t)(format >> 8); m_Width = m_Height = m_Pitch = 0; if (width <= 0 || height <= 0 || pitch < 0) { - return FALSE; + return false; } if ((INT_MAX - 31) / width < (format & 0xff)) { - return FALSE; + return false; } if (!pitch) { pitch = (width * (format & 0xff) + 31) / 32 * 4; } if ((1 << 30) / pitch < height) { - return FALSE; + return false; } if (pBuffer) { m_pBuffer = pBuffer; - m_bExtBuf = TRUE; + m_bExtBuf = true; } else { int size = pitch * height + 4; int oomlimit = _MAX_OOM_LIMIT_; if (oomlimit >= 0 && size >= oomlimit) { m_pBuffer = FX_TryAlloc(uint8_t, size); if (!m_pBuffer) { - return FALSE; + return false; } } else { m_pBuffer = FX_Alloc(uint8_t, size); @@ -106,33 +106,33 @@ FX_BOOL CFX_DIBitmap::Create(int width, m_Height = height; m_Pitch = pitch; if (HasAlpha() && format != FXDIB_Argb) { - FX_BOOL ret = TRUE; + bool ret = true; ret = BuildAlphaMask(); if (!ret) { if (!m_bExtBuf) { FX_Free(m_pBuffer); m_pBuffer = nullptr; m_Width = m_Height = m_Pitch = 0; - return FALSE; + return false; } } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) { +bool CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) { if (m_pBuffer) { - return FALSE; + return false; } if (!Create(pSrc->GetWidth(), pSrc->GetHeight(), pSrc->GetFormat())) { - return FALSE; + return false; } CopyPalette(pSrc->GetPalette()); CopyAlphaMask(pSrc->m_pAlphaMask); for (int row = 0; row < pSrc->GetHeight(); row++) { FXSYS_memcpy(m_pBuffer + row * m_Pitch, pSrc->GetScanline(row), m_Pitch); } - return TRUE; + return true; } CFX_DIBitmap::~CFX_DIBitmap() { @@ -235,19 +235,19 @@ void CFX_DIBSource::BuildPalette() { } } -FX_BOOL CFX_DIBSource::BuildAlphaMask() { +bool CFX_DIBSource::BuildAlphaMask() { if (m_pAlphaMask) { - return TRUE; + return true; } m_pAlphaMask = new CFX_DIBitmap; if (!m_pAlphaMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete m_pAlphaMask; m_pAlphaMask = nullptr; - return FALSE; + return false; } FXSYS_memset(m_pAlphaMask->GetBuffer(), 0xff, m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch()); - return TRUE; + return true; } uint32_t CFX_DIBSource::GetPaletteEntry(int index) const { @@ -397,20 +397,20 @@ void CFX_DIBSource::GetOverlapRect(int& dest_left, height = dest_rect.bottom - dest_rect.top; } -FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pSrcBitmap, - int src_left, - int src_top) { +bool CFX_DIBitmap::TransferBitmap(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pSrcBitmap, + int src_left, + int src_top) { if (!m_pBuffer) - return FALSE; + return false; GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), src_left, src_top, nullptr); if (width == 0 || height == 0) - return TRUE; + return true; FXDIB_Format dest_format = GetFormat(); FXDIB_Format src_format = pSrcBitmap->GetFormat(); @@ -442,7 +442,7 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, } } else { if (m_pPalette) - return FALSE; + return false; if (m_bpp == 8) dest_format = FXDIB_8bppMask; @@ -452,34 +452,34 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, std::unique_ptr<uint32_t, FxFreeDeleter> d_plt; if (!ConvertBuffer(dest_format, dest_buf, m_Pitch, width, height, pSrcBitmap, src_left, src_top, &d_plt)) { - return FALSE; + return false; } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, - int dest_top, - int width, - int height, - const CFX_DIBSource* pMask, - uint32_t color, - int src_left, - int src_top, - int alpha_flag, - void* pIccTransform) { +bool CFX_DIBitmap::TransferMask(int dest_left, + int dest_top, + int width, + int height, + const CFX_DIBSource* pMask, + uint32_t color, + int src_left, + int src_top, + int alpha_flag, + void* pIccTransform) { if (!m_pBuffer) { - return FALSE; + return false; } ASSERT(HasAlpha() && (m_bpp >= 24)); ASSERT(pMask->IsAlphaMask()); if (!HasAlpha() || !pMask->IsAlphaMask() || m_bpp < 24) { - return FALSE; + return false; } GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask->GetHeight(), src_left, src_top, nullptr); if (width == 0 || height == 0) { - return TRUE; + return true; } int src_bpp = pMask->GetBPP(); int alpha; @@ -503,7 +503,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, FXSYS_GetYValue(color), FXSYS_GetKValue(color), color_p[2], color_p[1], color_p[0]); } else if (!(alpha_flag >> 8) && IsCmykImage()) { - return FALSE; + return false; } } if (!IsCmykImage()) { @@ -565,7 +565,7 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, } } } - return TRUE; + return true; } void CFX_DIBSource::CopyPalette(const uint32_t* pSrc) { @@ -627,10 +627,10 @@ CFX_DIBitmap* CFX_DIBSource::GetAlphaMask(const FX_RECT* pClip) const { return pMask; } -FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, - const FX_RECT* pClip) { +bool CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, + const FX_RECT* pClip) { if (!HasAlpha() || GetFormat() == FXDIB_Argb) { - return FALSE; + return false; } if (pAlphaMask) { FX_RECT rect(0, 0, pAlphaMask->m_Width, pAlphaMask->m_Height); @@ -638,11 +638,11 @@ FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, rect.Intersect(*pClip); if (rect.IsEmpty() || rect.Width() != m_Width || rect.Height() != m_Height) { - return FALSE; + return false; } } else { if (pAlphaMask->m_Width != m_Width || pAlphaMask->m_Height != m_Height) { - return FALSE; + return false; } } for (int row = 0; row < m_Height; row++) @@ -652,27 +652,27 @@ FX_BOOL CFX_DIBSource::CopyAlphaMask(const CFX_DIBSource* pAlphaMask, } else { m_pAlphaMask->Clear(0xff000000); } - return TRUE; + return true; } const int g_ChannelOffset[] = {0, 2, 1, 0, 0, 1, 2, 3, 3}; -FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, - const CFX_DIBSource* pSrcBitmap, - FXDIB_Channel srcChannel) { +bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, + const CFX_DIBSource* pSrcBitmap, + FXDIB_Channel srcChannel) { if (!m_pBuffer) { - return FALSE; + return false; } CFX_DIBSource* pSrcClone = (CFX_DIBSource*)pSrcBitmap; CFX_DIBitmap* pDst = this; int destOffset, srcOffset; if (srcChannel == FXDIB_Alpha) { if (!pSrcBitmap->HasAlpha() && !pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (pSrcBitmap->GetBPP() == 1) { pSrcClone = pSrcBitmap->CloneConvert(FXDIB_8bppMask); if (!pSrcClone) { - return FALSE; + return false; } } if (pSrcBitmap->GetFormat() == FXDIB_Argb) { @@ -682,7 +682,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, } } else { if (pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (pSrcBitmap->GetBPP() < 24) { if (pSrcBitmap->IsCmykImage()) { @@ -693,7 +693,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, (FXDIB_Format)((pSrcBitmap->GetFormat() & 0xff00) | 0x18)); } if (!pSrcClone) { - return FALSE; + return false; } } srcOffset = g_ChannelOffset[srcChannel]; @@ -704,7 +704,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } destOffset = 0; } else { @@ -713,7 +713,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } if (GetFormat() == FXDIB_Argb) { destOffset = 3; @@ -724,7 +724,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } if (GetBPP() < 24) { if (HasAlpha()) { @@ -732,7 +732,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) { @@ -742,7 +742,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } destOffset = g_ChannelOffset[destChannel]; @@ -757,7 +757,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } } } @@ -774,7 +774,7 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, delete pSrcClone; } if (!pSrcMatched) { - return FALSE; + return false; } pSrcClone = pSrcMatched; } @@ -796,24 +796,24 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, if (pSrcClone != pSrcBitmap && pSrcClone != pSrcBitmap->m_pAlphaMask) { delete pSrcClone; } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { +bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { if (!m_pBuffer) { - return FALSE; + return false; } int destOffset; if (destChannel == FXDIB_Alpha) { if (IsAlphaMask()) { if (!ConvertFormat(FXDIB_8bppMask)) { - return FALSE; + return false; } destOffset = 0; } else { destOffset = 0; if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) { - return FALSE; + return false; } if (GetFormat() == FXDIB_Argb) { destOffset = 3; @@ -821,19 +821,19 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { } } else { if (IsAlphaMask()) { - return FALSE; + return false; } if (GetBPP() < 24) { if (HasAlpha()) { if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) { - return FALSE; + return false; } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) { #else } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) { #endif - return FALSE; + return false; } } destOffset = g_ChannelOffset[destChannel]; @@ -841,12 +841,12 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { int Bpp = GetBPP() / 8; if (Bpp == 1) { FXSYS_memset(m_pBuffer, value, m_Height * m_Pitch); - return TRUE; + return true; } if (destChannel == FXDIB_Alpha && m_pAlphaMask) { FXSYS_memset(m_pAlphaMask->GetBuffer(), value, m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch()); - return TRUE; + return true; } for (int row = 0; row < m_Height; row++) { uint8_t* scan_line = m_pBuffer + row * m_Pitch + destOffset; @@ -855,16 +855,16 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { scan_line += Bpp; } } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { +bool CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { if (!m_pBuffer) { - return FALSE; + return false; } ASSERT(pSrcBitmap->IsAlphaMask()); if (!pSrcBitmap->IsAlphaMask()) { - return FALSE; + return false; } if (!IsAlphaMask() && !HasAlpha()) { return LoadChannel(FXDIB_Alpha, pSrcBitmap, FXDIB_Alpha); @@ -874,7 +874,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { pSrcBitmap->GetHeight() != m_Height) { pSrcClone = pSrcBitmap->StretchTo(m_Width, m_Height); if (!pSrcClone) { - return FALSE; + return false; } } if (IsAlphaMask()) { @@ -882,7 +882,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } for (int row = 0; row < m_Height; row++) { uint8_t* dest_scan = m_pBuffer + m_Pitch * row; @@ -906,7 +906,7 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return FALSE; + return false; } for (int row = 0; row < m_Height; row++) { uint8_t* dest_scan = m_pBuffer + m_Pitch * row + 3; @@ -923,17 +923,17 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(const CFX_DIBSource* pSrcBitmap) { if (pSrcClone != pSrcBitmap) { delete pSrcClone; } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) { +bool CFX_DIBitmap::GetGrayData(void* pIccTransform) { if (!m_pBuffer) { - return FALSE; + return false; } switch (GetFormat()) { case FXDIB_1bppRgb: { if (!m_pPalette) { - return FALSE; + return false; } uint8_t gray[2]; for (int i = 0; i < 2; i++) { @@ -945,7 +945,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) { CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } FXSYS_memset(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height); for (int row = 0; row < m_Height; row++) { @@ -964,7 +964,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) { } case FXDIB_8bppRgb: { if (!m_pPalette) { - return FALSE; + return false; } uint8_t gray[256]; for (int i = 0; i < 256; i++) { @@ -976,7 +976,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) { CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } for (int row = 0; row < m_Height; row++) { uint8_t* dest_pos = pMask->GetBuffer() + row * pMask->GetPitch(); @@ -993,7 +993,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) { CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } for (int row = 0; row < m_Height; row++) { uint8_t* src_pos = m_pBuffer + row * m_Pitch; @@ -1011,7 +1011,7 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) { CFX_DIBitmap* pMask = new CFX_DIBitmap; if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) { delete pMask; - return FALSE; + return false; } for (int row = 0; row < m_Height; row++) { uint8_t* src_pos = m_pBuffer + row * m_Pitch; @@ -1026,19 +1026,19 @@ FX_BOOL CFX_DIBitmap::GetGrayData(void* pIccTransform) { break; } default: - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) { +bool CFX_DIBitmap::MultiplyAlpha(int alpha) { if (!m_pBuffer) { - return FALSE; + return false; } switch (GetFormat()) { case FXDIB_1bppMask: if (!ConvertFormat(FXDIB_8bppMask)) { - return FALSE; + return false; } MultiplyAlpha(alpha); break; @@ -1066,18 +1066,18 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) { m_pAlphaMask->MultiplyAlpha(alpha); } else if (IsCmykImage()) { if (!ConvertFormat((FXDIB_Format)(GetFormat() | 0x0200))) { - return FALSE; + return false; } m_pAlphaMask->MultiplyAlpha(alpha); } else { if (!ConvertFormat(FXDIB_Argb)) { - return FALSE; + return false; } MultiplyAlpha(alpha); } break; } - return TRUE; + return true; } uint32_t CFX_DIBitmap::GetPixel(int x, int y) const { @@ -1189,7 +1189,7 @@ void CFX_DIBitmap::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const { if (!m_pBuffer) { @@ -1252,11 +1252,10 @@ void CFX_DIBitmap::DownSampleScanline(int line, // TODO(weili): Split this function into two for handling CMYK and RGB // colors separately. -FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, - uint32_t backcolor) { +bool CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, uint32_t backcolor) { ASSERT(!IsAlphaMask()); if (!m_pBuffer || IsAlphaMask()) { - return FALSE; + return false; } // Values used for CMYK colors. int fc = 0; @@ -1274,7 +1273,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, int br = 0; int bg = 0; int bb = 0; - FX_BOOL isCmykImage = IsCmykImage(); + bool isCmykImage = IsCmykImage(); if (isCmykImage) { fc = FXSYS_GetCValue(forecolor); fm = FXSYS_GetMValue(forecolor); @@ -1295,10 +1294,10 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, if (m_bpp <= 8) { if (isCmykImage) { if (forecolor == 0xff && backcolor == 0 && !m_pPalette) { - return TRUE; + return true; } } else if (forecolor == 0 && backcolor == 0xffffff && !m_pPalette) { - return TRUE; + return true; } if (!m_pPalette) { BuildPalette(); @@ -1326,7 +1325,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, bb + (fb - bb) * gray / 255); } } - return TRUE; + return true; } if (isCmykImage) { if (forecolor == 0xff && backcolor == 0x00) { @@ -1342,7 +1341,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, *scanline++ = 255 - FXRGB2GRAY(r, g, b); } } - return TRUE; + return true; } } else if (forecolor == 0 && backcolor == 0xffffff) { for (int row = 0; row < m_Height; row++) { @@ -1356,7 +1355,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, scanline += gap; } } - return TRUE; + return true; } if (isCmykImage) { for (int row = 0; row < m_Height; row++) { @@ -1385,10 +1384,10 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor, } } } - return TRUE; + return true; } -CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const { +CFX_DIBitmap* CFX_DIBSource::FlipImage(bool bXFlip, bool bYFlip) const { CFX_DIBitmap* pFlipped = new CFX_DIBitmap; if (!pFlipped->Create(m_Width, m_Height, GetFormat())) { delete pFlipped; @@ -1485,7 +1484,7 @@ CFX_FilteredDIB::~CFX_FilteredDIB() { } } -void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) { +void CFX_FilteredDIB::LoadSrc(const CFX_DIBSource* pSrc, bool bAutoDropSrc) { m_pSrc = pSrc; m_bAutoDropSrc = bAutoDropSrc; m_Width = pSrc->GetWidth(); @@ -1507,7 +1506,7 @@ void CFX_FilteredDIB::DownSampleScanline(int line, uint8_t* dest_scan, int dest_bpp, int dest_width, - FX_BOOL bFlipX, + bool bFlipX, int clip_left, int clip_width) const { m_pSrc->DownSampleScanline(line, dest_scan, dest_bpp, dest_width, bFlipX, @@ -1517,23 +1516,23 @@ void CFX_FilteredDIB::DownSampleScanline(int line, CFX_ImageRenderer::CFX_ImageRenderer() { m_Status = 0; - m_bRgbByteOrder = FALSE; + m_bRgbByteOrder = false; m_BlendType = FXDIB_BLEND_NORMAL; } CFX_ImageRenderer::~CFX_ImageRenderer() {} -FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, - const CFX_ClipRgn* pClipRgn, - const CFX_DIBSource* pSource, - int bitmap_alpha, - uint32_t mask_color, - const CFX_Matrix* pMatrix, - uint32_t dib_flags, - FX_BOOL bRgbByteOrder, - int alpha_flag, - void* pIccTransform, - int blend_type) { +bool CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, + const CFX_ClipRgn* pClipRgn, + const CFX_DIBSource* pSource, + int bitmap_alpha, + uint32_t mask_color, + const CFX_Matrix* pMatrix, + uint32_t dib_flags, + bool bRgbByteOrder, + int alpha_flag, + void* pIccTransform, + int blend_type) { m_Matrix = *pMatrix; CFX_FloatRect image_rect_f = m_Matrix.GetUnitRect(); FX_RECT image_rect = image_rect_f.GetOuterRect(); @@ -1541,7 +1540,7 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, pDevice->GetHeight()); m_ClipBox.Intersect(image_rect); if (m_ClipBox.IsEmpty()) - return FALSE; + return false; m_pDevice = pDevice; m_pClipRgn = pClipRgn; @@ -1566,22 +1565,22 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, bitmap_clip = FXDIB_SwapClipBox(bitmap_clip, dest_width, dest_height, m_Matrix.c > 0, m_Matrix.b < 0); m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, - TRUE, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, + true, m_Matrix.c > 0, m_Matrix.b < 0, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( &m_Composer, pSource, dest_height, dest_width, bitmap_clip, dib_flags); if (!m_Stretcher->Start()) - return FALSE; + return false; m_Status = 1; - return TRUE; + return true; } m_Status = 2; m_pTransformer.reset( new CFX_ImageTransformer(pSource, &m_Matrix, dib_flags, &m_ClipBox)); m_pTransformer->Start(); - return TRUE; + return true; } int dest_width = image_rect.Width(); @@ -1593,12 +1592,12 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, dest_height = -dest_height; if (dest_width == 0 || dest_height == 0) - return FALSE; + return false; FX_RECT bitmap_clip = m_ClipBox; bitmap_clip.Offset(-image_rect.left, -image_rect.top); m_Composer.Compose(pDevice, pClipRgn, bitmap_alpha, mask_color, m_ClipBox, - FALSE, FALSE, FALSE, m_bRgbByteOrder, alpha_flag, + false, false, false, m_bRgbByteOrder, alpha_flag, pIccTransform, m_BlendType); m_Status = 1; m_Stretcher = pdfium::MakeUnique<CFX_ImageStretcher>( @@ -1606,17 +1605,17 @@ FX_BOOL CFX_ImageRenderer::Start(CFX_DIBitmap* pDevice, return m_Stretcher->Start(); } -FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) { +bool CFX_ImageRenderer::Continue(IFX_Pause* pPause) { if (m_Status == 1) return m_Stretcher->Continue(pPause); if (m_Status == 2) { if (m_pTransformer->Continue(pPause)) - return TRUE; + return true; std::unique_ptr<CFX_DIBitmap> pBitmap(m_pTransformer->DetachBitmap()); if (!pBitmap || !pBitmap->GetBuffer()) - return FALSE; + return false; if (pBitmap->IsAlphaMask()) { if (m_BitmapAlpha != 255) { @@ -1641,9 +1640,9 @@ FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause) { pBitmap->GetWidth(), pBitmap->GetHeight(), pBitmap.get(), 0, 0, m_BlendType, m_pClipRgn, m_bRgbByteOrder, m_pIccTransform); } - return FALSE; + return false; } - return FALSE; + return false; } CFX_BitmapStorer::CFX_BitmapStorer() { @@ -1677,16 +1676,16 @@ void CFX_BitmapStorer::ComposeScanline(int line, } } -FX_BOOL CFX_BitmapStorer::SetInfo(int width, - int height, - FXDIB_Format src_format, - uint32_t* pSrcPalette) { +bool CFX_BitmapStorer::SetInfo(int width, + int height, + FXDIB_Format src_format, + uint32_t* pSrcPalette) { m_pBitmap = pdfium::MakeUnique<CFX_DIBitmap>(); if (!m_pBitmap->Create(width, height, src_format)) { m_pBitmap.reset(); - return FALSE; + return false; } if (pSrcPalette) m_pBitmap->CopyPalette(pSrcPalette); - return TRUE; + return true; } diff --git a/core/fxge/dib/fx_dib_transform.cpp b/core/fxge/dib/fx_dib_transform.cpp index 559c6e2a38..e2b95237d5 100644 --- a/core/fxge/dib/fx_dib_transform.cpp +++ b/core/fxge/dib/fx_dib_transform.cpp @@ -175,8 +175,8 @@ class CFX_BilinearMatrix : public CPDF_FixedMatrix { y1 /= base; } }; -CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, - FX_BOOL bYFlip, +CFX_DIBitmap* CFX_DIBSource::SwapXY(bool bXFlip, + bool bYFlip, const FX_RECT* pDestClip) const { FX_RECT dest_clip(0, 0, m_Height, m_Width); if (pDestClip) { @@ -277,8 +277,8 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, - FX_BOOL bFlipX, - FX_BOOL bFlipY) { + bool bFlipX, + bool bFlipY) { FX_RECT rect; if (bFlipY) { rect.left = height - clip.top; @@ -345,7 +345,7 @@ CFX_ImageTransformer::CFX_ImageTransformer(const CFX_DIBSource* pSrc, CFX_ImageTransformer::~CFX_ImageTransformer() {} -FX_BOOL CFX_ImageTransformer::Start() { +bool CFX_ImageTransformer::Start() { CFX_FloatRect unit_rect = m_pMatrix->GetUnitRect(); FX_RECT result_rect = unit_rect.GetClosestRect(); FX_RECT result_clip = result_rect; @@ -353,7 +353,7 @@ FX_BOOL CFX_ImageTransformer::Start() { result_clip.Intersect(*m_pClip); if (result_clip.IsEmpty()) - return FALSE; + return false; m_result = result_clip; if (FXSYS_fabs(m_pMatrix->a) < FXSYS_fabs(m_pMatrix->b) / 20 && @@ -368,7 +368,7 @@ FX_BOOL CFX_ImageTransformer::Start() { &m_Storer, m_pSrc, dest_height, dest_width, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 1; - return TRUE; + return true; } if (FXSYS_fabs(m_pMatrix->b) < FIX16_005 && FXSYS_fabs(m_pMatrix->c) < FIX16_005) { @@ -381,7 +381,7 @@ FX_BOOL CFX_ImageTransformer::Start() { &m_Storer, m_pSrc, dest_width, dest_height, result_clip, m_Flags); m_Stretcher->Start(); m_Status = 2; - return TRUE; + return true; } int stretch_width = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->a, m_pMatrix->b)); int stretch_height = (int)FXSYS_ceil(FXSYS_sqrt2(m_pMatrix->c, m_pMatrix->d)); @@ -400,35 +400,35 @@ FX_BOOL CFX_ImageTransformer::Start() { &m_Storer, m_pSrc, stretch_width, stretch_height, m_StretchClip, m_Flags); m_Stretcher->Start(); m_Status = 3; - return TRUE; + return true; } -FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { +bool CFX_ImageTransformer::Continue(IFX_Pause* pPause) { if (m_Status == 1) { if (m_Stretcher->Continue(pPause)) - return TRUE; + return true; if (m_Storer.GetBitmap()) { std::unique_ptr<CFX_DIBitmap> swapped( m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0)); m_Storer.Replace(std::move(swapped)); } - return FALSE; + return false; } if (m_Status == 2) return m_Stretcher->Continue(pPause); if (m_Status != 3) - return FALSE; + return false; if (m_Stretcher->Continue(pPause)) - return TRUE; + return true; int stretch_width = m_StretchClip.Width(); int stretch_height = m_StretchClip.Height(); if (!m_Storer.GetBitmap()) - return FALSE; + return false; const uint8_t* stretch_buf = m_Storer.GetBitmap()->GetBuffer(); const uint8_t* stretch_buf_mask = nullptr; @@ -439,7 +439,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { std::unique_ptr<CFX_DIBitmap> pTransformed(new CFX_DIBitmap); FXDIB_Format transformF = GetTransformedFormat(m_Stretcher->source()); if (!pTransformed->Create(m_result.Width(), m_result.Height(), transformF)) - return FALSE; + return false; pTransformed->Clear(0); if (pTransformed->m_pAlphaMask) @@ -749,7 +749,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { } } } else { - FX_BOOL bHasAlpha = m_Storer.GetBitmap()->HasAlpha(); + bool bHasAlpha = m_Storer.GetBitmap()->HasAlpha(); int destBpp = pTransformed->GetBPP() / 8; if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) { @@ -947,7 +947,7 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { } } m_Storer.Replace(std::move(pTransformed)); - return FALSE; + return false; } std::unique_ptr<CFX_DIBitmap> CFX_ImageTransformer::DetachBitmap() { |